Commit graph

18 commits

Author SHA1 Message Date
dougiteixeira
4b1d096e6b
Add device_class and state_class in config flow for SQL ()
* 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
2023-07-08 21:00:22 +02:00
G Johansson
2c5cad4ca0
Clean config flow for SQL () 2023-05-07 01:42:37 +02:00
G Johansson
9795699669
Fix db_url issue in SQL ()
* db_url fix

* Add test

* assert entry.options
2023-05-01 16:17:01 +02:00
dougiteixeira
dc03a5c81e
Fix error for when column does not exist in query to SQL ()
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-04-15 12:54:56 -10:00
J. Nick Koston
4366f83ac8
Restore use of local timezone for MariaDB/MySQL in SQL integration ()
* Use local timezone for recorder connection

The fix in  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
2023-04-12 20:24:55 -04:00
dougiteixeira
1ef6391e9c
Preserves config flow information in case of error for SQL () 2023-04-12 09:03:14 -10:00
G Johansson
afa58b80bd
Default to recorder db for SQL integration ()
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-03-13 17:41:32 -10:00
Erik Montnemery
94519de8dd
Upgrade SQLAlchemy to 2.0.2 ()
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-02-08 08:17:32 -06:00
Franck Nijhof
5e81d28116
Update black to 23.1.0 () 2023-02-02 18:35:24 +01:00
G Johansson
2a965a6e44
SQL reintroduce yaml support ()
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-01-07 18:14:36 -10:00
G Johansson
18be5f1387
SQL fix entry options save ()
* SQL fix options

* Testing
2022-09-28 08:49:37 +02:00
G Johansson
76006ce9d7
Allow empty db in SQL options flow () 2022-09-05 14:50:47 -05:00
G Johansson
a746d7c1d7
Improve code quality in sql integration () 2022-05-12 19:40:00 -04:00
J. Nick Koston
18bdc70185
Update sql to prepare for sqlalchemy 2.0 ()
* Update sql to prepare for sqlalchemy 2.0

* config flow as well
2022-05-11 20:45:47 -07:00
J. Nick Koston
3883bad70a
Fix display of multiline queries in sql config flow () 2022-05-07 14:19:01 -07:00
J. Nick Koston
523828c81e
Ensure sql sensors keep working after using the options flow ()
* 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
2022-05-07 14:18:40 -07:00
G Johansson
c90eb4d6b4
Fix sql integration issues 5.0 beta ()
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-04-29 10:00:44 -07:00
G Johansson
472ffd3bc6
Implement config flow for SQL integration () 2022-04-24 08:50:32 -10:00