* 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
* Moved climate components with tests into platform dirs.
* Updated tests from climate component.
* Moved binary_sensor components with tests into platform dirs.
* Updated tests from binary_sensor component.
* Moved calendar components with tests into platform dirs.
* Updated tests from calendar component.
* Moved camera components with tests into platform dirs.
* Updated tests from camera component.
* Moved cover components with tests into platform dirs.
* Updated tests from cover component.
* Moved device_tracker components with tests into platform dirs.
* Updated tests from device_tracker component.
* Moved fan components with tests into platform dirs.
* Updated tests from fan component.
* Moved geo_location components with tests into platform dirs.
* Updated tests from geo_location component.
* Moved image_processing components with tests into platform dirs.
* Updated tests from image_processing component.
* Moved light components with tests into platform dirs.
* Updated tests from light component.
* Moved lock components with tests into platform dirs.
* Moved media_player components with tests into platform dirs.
* Updated tests from media_player component.
* Moved scene components with tests into platform dirs.
* Moved sensor components with tests into platform dirs.
* Updated tests from sensor component.
* Moved switch components with tests into platform dirs.
* Updated tests from sensor component.
* Moved vacuum components with tests into platform dirs.
* Updated tests from vacuum component.
* Moved weather components with tests into platform dirs.
* Fixed __init__.py files
* Fixes for stuff moved as part of this branch.
* Fix stuff needed to merge with balloob's branch.
* Formatting issues.
* Missing __init__.py files.
* Fix-ups
* Fixup
* Regenerated requirements.
* Linting errors fixed.
* Fixed more broken tests.
* Missing init files.
* Fix broken tests.
* More broken tests
* There seems to be a thread race condition.
I suspect the logger stuff is running in another thread, which means waiting until the aio loop is done is missing the log messages.
Used sleep instead because that allows the logger thread to run. I think the api_streams sensor might not be thread safe.
* Disabled tests, will remove sensor in #22147
* Updated coverage and codeowners.