Commit graph

422 commits

Author SHA1 Message Date
Erik Montnemery
b94e1e9ef8
Fire events when long term statistics is updated ()
* Fire events when long term statistics is updated

* Allow the new events to be subscribed to by anyone

* Address review comments

* Finish renaming events

* Finish renaming events

* Fix do_adhoc_statistics

* Adjust tests

* Adjust tests
2022-11-24 22:01:36 +01:00
Erik Montnemery
607a0e7697
Reduce size of get_statistics_during_period WS API response () 2022-11-16 17:36:30 +01:00
Erik Montnemery
9b8f94363c
Fix statistic_during_period for data with holes () 2022-11-16 12:46:29 +01:00
Erik Montnemery
68346599d2
Add WS API recorder/statistic_during_period () 2022-10-27 15:51:09 -04:00
Michael
8175dab7ab
Add week period to recorder statistics api ()
* add week period to get statistics api

* add test
2022-10-25 20:07:28 +02:00
epenet
e84e5f134e
Use US_CUSTOMARY_SYSTEM in tests ()
* Use US_CUSTOMARY_SYSTEM in tests

* Don't update test_unit_system
2022-10-20 15:42:23 +02:00
Erik Montnemery
f4951a4f31
Add CI job which runs recorder tests on MariaDB ()
Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-10-19 13:04:28 +02:00
Erik Montnemery
31a787558f
Ensure recorder test fixture is setup before hass fixture ()
* Ensure recorder test fixture is setup before hass fixture

* Adjust more tests
2022-10-19 07:58:47 +02:00
Erik Montnemery
2c206ad050
Fix flaky recorder test ()
* Fix flaky recorder test

* Update tests/components/recorder/test_init.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2022-10-14 09:10:38 +02:00
Erik Montnemery
04cc2ae264
Correct initialization of new databases () 2022-10-13 13:01:27 +02:00
Erik Montnemery
acb1477673
Avoid time traveling in recorder tests () 2022-10-13 11:51:27 +02:00
Erik Montnemery
4462f2fc46
Fix recorder tests related to mysql () 2022-10-13 11:44:48 +02:00
Erik Montnemery
466c4656ca
Refactor recorder migration ()
* Refactor recorder migration

* Improve test coverage
2022-10-13 08:11:54 +02:00
Erik
4a1c40f09b Revert "Refactor recorder migration"
This reverts commit 69e10e5982.
2022-10-12 15:12:12 +02:00
Erik
69e10e5982 Refactor recorder migration 2022-10-12 15:00:28 +02:00
Erik Montnemery
9aa6043255
Set character set to utf8mb4 when connecting to MySQL or MariaDB databases () 2022-10-11 14:01:46 +02:00
Erik Montnemery
e8af007124
Disable echo for non SQLite databases ()
* 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 ()
* 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 ()
* 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 () 2022-09-30 08:38:44 +02:00
epenet
12e4d18038
Add volume to SensorDeviceClass ()
* 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 ()
* 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 ()
* 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 () 2022-09-27 08:44:58 +02:00
epenet
df47fda2a0
Remove parametrization in recorder websocket api tests ()
Remove parametrization in websocket api tests
2022-09-27 08:27:26 +02:00
epenet
08ebb9f31a
Test sum AND mean in recorder tests () 2022-09-23 09:55:17 -04:00
Erik Montnemery
cd6697615f
Validate units when importing statistics () 2022-09-21 12:08:53 -04:00
Erik Montnemery
dae00c70de
Allow selecting display unit when fetching statistics () 2022-09-20 17:43:57 -04:00
epenet
019d297ff0
Apply hass-relative-import to recorder tests () 2022-09-19 12:35:03 +02:00
Erik Montnemery
dd20a7ea62
Display statistics in the source's unit () 2022-09-15 12:01:24 -04:00
Erik Montnemery
0a1fd36e03
Catch up with statistics after DB migration is done ()
* 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 () 2022-09-08 16:03:43 -04:00
Erik Montnemery
008ac8d10d
Improve statistics metadata WS API () 2022-08-31 11:30:45 +02:00
Erik Montnemery
f61edf0778
Fix updating of statistics metadata name ()
* 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 ()
* 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 () 2022-07-22 11:58:26 +02:00
Thibault Cohen
1d7d2875e1
Add websocket command recorder/import_statistics ()
* 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 ()
* Adjust entity filters to make includes stronger than excludes

Fixes 

* 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 ()" () 2022-06-23 13:59:55 -05:00
J. Nick Koston
7ae8bd5137
Remove sqlalchemy lambda_stmt usage from history, logbook, and statistics () 2022-06-07 16:15:50 -07:00
Erik Montnemery
5f2b4001f3
Separate recorder database schema from other classes ()
* 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 () 2022-06-06 12:50:52 -07:00
J. Nick Koston
c66b000d34
Reduce branching in generated lambda_stmts () 2022-06-05 21:13:31 -07:00
J. Nick Koston
5b31414225
Fix misalignments between sql based filtering with the entityfilter based filtering () 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 () 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 () 2022-06-01 22:12:00 -07:00
J. Nick Koston
d8b0376942
Fix purge of legacy database events that are not state changed () 2022-06-01 11:56:06 +02:00
J. Nick Koston
587fd05603
Make logbook inherit the recorder filter () 2022-05-30 17:34:32 -07:00
J. Nick Koston
040e120101
Fix recorder system health when the db_url is lacking a hostname () 2022-05-27 10:32:26 -07:00
Erik Montnemery
23bd64b7a2
Prevent duplication of statistics metadata ()
* 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