Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
* Phase out periodic tasks
* false by default or some tests will block forever, will need to fix each one manually
* kwarg works
* kwarg works
* kwarg works
* fixes
* fix more tests
* fix more tests
* fix lifx
* opensky
* pvpc_hourly_pricing
* adjust more
* adjust more
* smarttub
* adjust more
* adjust more
* adjust more
* adjust more
* adjust
* no eager executor
* zha
* qnap_qsw
* fix more
* fix fix
* docs
* its a wrapper now
* add more coverage
* coverage
* cover all combos
* more fixes
* more fixes
* more fixes
* remaining issues are legit bugs in tests
* make tplink test more predictable
* more fixes
* feedreader
* grind out some more
* make test race safe
* one more
* Add query type validation independent of declaration position
* Restore close sess
* Separates invalid query and non-read-only query tests
* Add more tests
* Use the SQLParseError exception for queries that are not read-only
* Add handling for multiple SQL queries.
* Fix test
* Clean ';' at the beginning of the SQL query
* Clean ';' at the beginning of the SQL query - init
* Query cleaning before storing
* Query cleaning before setup sesensor plataform - YAML
* Exception when the SQL query type is not detected
* Cleaning
* Cleaning
* Fix typing in tests
* Fix typing in tests
* Add test for query = ';;'
* Update homeassistant/components/sql/__init__.py
Co-authored-by: G Johansson <goran.johansson@shiftit.se>
* Update homeassistant/components/sql/__init__.py
Co-authored-by: G Johansson <goran.johansson@shiftit.se>
* Update __init__.py
* Update config_flow.py
* Clean query before storing
---------
Co-authored-by: G Johansson <goran.johansson@shiftit.se>
* Add device_class and state_class in config flow for SQL
* Update when selected NONE_SENTINEL
* Add tests
* Use SensorDeviceClass and SensorStateClass in tests
* Add volatile_organic_compounds_parts in strings selector
* Add test_attributes_from_entry_config
* Remove test_attributes_from_entry_config and complement test_device_state_class
* Add test_attributes_from_entry_config in test_sensor.py
* Use local timezone for recorder connection
The fix in #90335 had an unexpected side effect of
using UTC for the timezone since all recorder operations
use UTC. Since only sqlite much use the database executor
we can use a seperate connection pool which uses local time
This also ensures that the engines are disposed of
when Home Assistant is shutdown as previously we
did not cleanly disconnect
* coverage
* fix unclean shutdown in config flow
* tweaks
* Raise an issue for SQL queries that will cause full table scans
* Raise an issue for SQL queries that will cause full table scans
* Raise an issue for SQL queries that will cause full table scans
* Raise an issue for SQL queries that will cause full table scans
* Update homeassistant/components/sql/sensor.py
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* coverage
---------
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Fix sql doing I/O in the event loop
* Fix sql doing I/O in the event loop
* no test query on main db
* fix mocking because it was targeting the recorder
* Ensure sql sensors keep working after using the options flow
Fixes
```
2022-05-06 16:17:57 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up sql platform for sensor
Traceback (most recent call last):
File "/Users/bdraco/home-assistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
await asyncio.shield(task)
File "/Users/bdraco/home-assistant/homeassistant/components/sql/sensor.py", line 97, in async_setup_entry
name: str = entry.options[CONF_NAME]
KeyError: name
```
* ensure saving the options flow fixes the broken config entry
* ensure options changes take effect right away
* Add cover to validate the reload