1
0
mirror of https://github.com/home-assistant/core.git synced 2026-06-06 07:26:58 +01:00
Commit Graph

257 Commits

Author SHA1 Message Date
Erik Montnemery 9aa6043255 Set character set to utf8mb4 when connecting to MySQL or MariaDB databases (#79755) 2022-10-11 14:01:46 +02:00
Erik Montnemery e8af007124 Disable echo for non SQLite databases (#80032)
* Disable echo for non SQLite databases

* Add test
2022-10-10 22:42:38 +03:00
Erik Montnemery a2e3978d53 Don't normalize units of long term statistics (#79320)
* Don't normalize units of long term statistics

* Update statistics.py
2022-10-03 21:42:44 +02:00
Erik Montnemery 2de273500e Remove state_unit_of_measurement from metadata DB table (#79370)
* Remove state_unit_of_measurement from metadata DB table

* Adjust test
2022-10-01 18:55:00 +02:00
Erik Montnemery bc2dffabc4 Improve naming of units used in statistics (#79276) 2022-09-30 08:38:44 +02:00
epenet 12e4d18038 Add volume to SensorDeviceClass (#77960)
* Add volume to SensorDeviceClass

* Adjust recorder

* Adjust tests

* Adjust sensor UNIT_CONVERTERS

* Adjust recorder

* Update strings.json
2022-09-27 19:37:52 +02:00
epenet 7c448416e1 Add speed to SensorDeviceClass (#77953)
* Add speed to SensorDeviceClass

* Adjust recorder

* Adjust tests

* Adjust sensor UNIT_CONVERTERS

* Add tests

* Add websocket tests

* Update strings.json
2022-09-27 17:19:34 +01:00
epenet bfcc18e5b8 Add distance to SensorDeviceClass (#77951)
* Add distance to SensorDeviceClass

* Adjust recorder

* Adjust tests

* Adjust recorder

* Update __init__.py

* Update test_websocket_api.py

* Update test_websocket_api.py

* Update test_websocket_api.py

* Update strings.json

* Fix tests

* Adjust docstring
2022-09-27 15:34:00 +01:00
Erik Montnemery c52d0f7495 Support converting statistics to another unit (#79117) 2022-09-27 08:44:58 +02:00
epenet df47fda2a0 Remove parametrization in recorder websocket api tests (#78864)
Remove parametrization in websocket api tests
2022-09-27 08:27:26 +02:00
epenet 08ebb9f31a Test sum AND mean in recorder tests (#78998) 2022-09-23 09:55:17 -04:00
Erik Montnemery cd6697615f Validate units when importing statistics (#78891) 2022-09-21 12:08:53 -04:00
Erik Montnemery dae00c70de Allow selecting display unit when fetching statistics (#78578) 2022-09-20 17:43:57 -04:00
epenet 019d297ff0 Apply hass-relative-import to recorder tests (#78734) 2022-09-19 12:35:03 +02:00
Erik Montnemery dd20a7ea62 Display statistics in the source's unit (#78031) 2022-09-15 12:01:24 -04:00
Erik Montnemery 0a1fd36e03 Catch up with statistics after DB migration is done (#78469)
* Catch up with statistics after DB migration is done

* Don't access the database from the event loop

* Fix deadlocking test

* Fix test
2022-09-15 07:40:56 +02:00
Erik Montnemery 7937bfeedb Deprecate history integration's statistics API (#78056) 2022-09-08 16:03:43 -04:00
Erik Montnemery 008ac8d10d Improve statistics metadata WS API (#77209) 2022-08-31 11:30:45 +02:00
Erik Montnemery f61edf0778 Fix updating of statistics metadata name (#77207)
* Fix updating of statistics metadata name

* Fix test

* Test renaming
2022-08-23 17:51:17 +02:00
Erik Montnemery fd6ffef52f Support non-live database migration (#72433)
* Support non-live database migration

* Tweak startup order, add test

* Address review comments

* Fix typo

* Clarify comment about promoting dependencies

* Tweak

* Fix merge mistake

* Fix some tests

* Fix additional test

* Fix additional test

* Adjust tests

* Improve test coverage
2022-07-22 15:11:34 +02:00
Erik Montnemery 606d544157 Use recorder get_instance function to improve typing (#75567) 2022-07-22 11:58:26 +02:00
Thibault Cohen 1d7d2875e1 Add websocket command recorder/import_statistics (#73937)
* Expose ws_add_external_statistics in websocket API

* Refactor

* Add tests

* Improve test coverage

Co-authored-by: Thibault Cohen <titilambert@users.noreply.github.com>
Co-authored-by: Erik <erik@montnemery.com>
2022-07-21 12:36:49 +02:00
J. Nick Koston a8349a4866 Adjust entity filters to make includes stronger than excludes (#74080)
* Adjust entity filters to make includes stronger than excludes

Fixes #59080

* adjust test for stronger entity glob includes

* sync with docs
2022-06-28 11:42:51 -05:00
J. Nick Koston 00a79635c1 Revert "Remove sqlalchemy lambda_stmt usage from history, logbook, and statistics (#73191)" (#73917) 2022-06-23 13:59:55 -05:00
J. Nick Koston 7ae8bd5137 Remove sqlalchemy lambda_stmt usage from history, logbook, and statistics (#73191) 2022-06-07 16:15:50 -07:00
Erik Montnemery 5f2b4001f3 Separate recorder database schema from other classes (#72977)
* Separate recorder database schema from other classes

* fix logbook imports

* migrate new tests

* few more

* last one

* fix merge

Co-authored-by: J. Nick Koston <nick@koston.org>
2022-06-07 14:41:43 +02:00
J. Nick Koston de2e9b6d77 Fix state_changes_during_period history query when no entities are passed (#73139) 2022-06-06 12:50:52 -07:00
J. Nick Koston c66b000d34 Reduce branching in generated lambda_stmts (#73042) 2022-06-05 21:13:31 -07:00
J. Nick Koston 5b31414225 Fix misalignments between sql based filtering with the entityfilter based filtering (#72936) 2022-06-02 20:52:53 -07:00
J. Nick Koston f79e5e002b Ensure recorder shuts down when its startup future is canceled out from under it (#72866) 2022-06-01 22:13:09 -07:00
J. Nick Koston c6e56c26b3 Fix logbook not setting up with an recorder filter that has empty fields (#72869) 2022-06-01 22:12:00 -07:00
J. Nick Koston d8b0376942 Fix purge of legacy database events that are not state changed (#72815) 2022-06-01 11:56:06 +02:00
J. Nick Koston 587fd05603 Make logbook inherit the recorder filter (#72728) 2022-05-30 17:34:32 -07:00
J. Nick Koston 040e120101 Fix recorder system health when the db_url is lacking a hostname (#72612) 2022-05-27 10:32:26 -07:00
Erik Montnemery 23bd64b7a2 Prevent duplication of statistics metadata (#71637)
* Prevent duplication of statistics metadata

* Add models_schema_28.py

* Handle entity renaming as a recorder job

* Improve tests
2022-05-24 15:34:46 +02:00
J. Nick Koston 4dbc1ed7a7 Add dialect (database engine) and version to recorder system health data (#72339) 2022-05-22 21:29:30 -07:00
J. Nick Koston 9c3f949165 Add live streaming logbook websocket endpoint (#72258)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-05-22 14:57:54 -05:00
J. Nick Koston 1001f9e39a Fix last state in history minimal respones when all the states at the end are skipped (#72203) 2022-05-19 20:58:32 -07:00
Erik Montnemery edd7a3427c Remove support for databases without ROW_NUMBER (#72092) 2022-05-18 21:52:38 -05:00
Erik Montnemery 037f6947d8 Fail recorder setup with unsupported dialect or version (#70888) 2022-05-18 16:52:46 +02:00
J. Nick Koston a4c1bcefb9 Tune sqlite based on configured settings (#72016) 2022-05-17 18:12:15 -05:00
J. Nick Koston a70e2a33dc Fixing purging legacy rows and improve performance (#71916) 2022-05-15 21:25:07 -07:00
J. Nick Koston 98809675ff Convert history queries to use lambda_stmt (#71870)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-05-15 10:47:29 -05:00
J. Nick Koston 8c2743bb67 Avoid storing last_changed in the database if its the same as last_updated (#71843) 2022-05-14 12:06:31 -07:00
J. Nick Koston a8f1dda004 Use ciso8601 for parsing MySQLdb datetimes (#71818)
* Use ciso8601 for parsing MySQLDB datetimes

The default parser is this:

https://github.com/PyMySQL/mysqlclient/blob/5340191feb16b1f99a7b43fe7c74a2f690138cb1/MySQLdb/times.py#L66

* tweak

* tweak

* add coverage for building the MySQLdb connect conv param
2022-05-13 19:26:09 -05:00
J. Nick Koston 7ab4960b1e Restore v23 stats migration tests (#71743) 2022-05-12 21:14:02 -04:00
J. Nick Koston 1d9fb4bca8 Fix process_datetime_to_timestamp and add test coverage (#71755) 2022-05-12 17:12:50 -07:00
J. Nick Koston e2cef55162 Add history/history_during_period websocket endpoint (#71688) 2022-05-11 17:52:22 -05:00
J. Nick Koston 222baa53dd Make database access in the eventloop raise an exception (#71547) 2022-05-09 15:22:08 -05:00
J. Nick Koston 7c9c0e911a Move do_adhoc_statistics to recorder test helpers (#71544) 2022-05-08 12:45:57 -07:00