Commit graph

207 commits

Author SHA1 Message Date
J. Nick Koston
a8aa0e1cca
Add Estimated Database Size to the recorder system health (#71463) 2022-05-07 21:02:54 -07:00
J. Nick Koston
eb77f8db85
Complete strict typing for recorder (#71274)
* Complete strict typing for recorder

* update tests

* Update tests/components/recorder/test_migrate.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/recorder/test_migrate.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Remove the asserts

* remove ignore comments

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-05-04 12:22:50 -05:00
J. Nick Koston
13ce0a7d6a
Fix history using pre v25 queries during v26 migration (#71295) 2022-05-04 08:56:50 -07:00
J. Nick Koston
e30940ef2a
Move processing of recorder service call arguments into services.py (#71260) 2022-05-03 13:56:22 -07:00
J. Nick Koston
e1be6dd34f
Move recorder services to services.py (#71249) 2022-05-03 10:38:44 -07:00
J. Nick Koston
29bda196b5
Break apart recorder into tasks and core modules (#71222) 2022-05-02 21:53:56 -07:00
J. Nick Koston
75026f9fed
Separate recorder logic for state_changed and non-state_changed events (#71204) 2022-05-02 17:22:53 -05:00
J. Nick Koston
188040b8bb
Use lambda_stmt for recorder queries and migrate them to queries module (#71219) 2022-05-02 15:17:21 -07:00
J. Nick Koston
5db014666c
Avoid recording state_changed events in the events table (#71165)
* squash

fix mypy

* Update homeassistant/components/recorder/models.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* pass all columns

* fix commented out code

* reduce logbook query complexity

* merge

* comment

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-05-02 02:10:34 -05:00
J. Nick Koston
c23866e5e5
De-duplicate event data into a new event_data table (#71135) 2022-05-01 21:01:17 -05:00
J. Nick Koston
ff48720c6a
Remove db schema v23 stats migration tests (#71137) 2022-05-01 16:11:11 -07:00
J. Nick Koston
66a21e0bc3
Add basic system health data to the recorder (#71086) 2022-04-30 11:10:20 -05:00
J. Nick Koston
195811843b
Remove get_state and get_states history api calls (#70830) 2022-04-26 16:05:43 -07:00
J. Nick Koston
6ce768465f
Improve purge performance for non-sqlite databases (#70576) 2022-04-26 13:11:57 -07:00
J. Nick Koston
1c4a785fb3
Prevent autoflush from happening during attrs lookup (#70768) 2022-04-26 13:04:58 -07:00
J. Nick Koston
f073f17040
Refactor tracking of the recorder run history (#70456)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-04-26 09:59:43 -10:00
Erik Montnemery
3016b5fbfc
Use recorder fixtures and helpers in tests (#70773) 2022-04-26 06:08:00 -10:00
J. Nick Koston
89e3a48751
Use database executor in migration test (#70774) 2022-04-26 07:42:28 -07:00
Erik Montnemery
d045e8678d
Use recorder test fixtures in tests (#70652) 2022-04-25 14:23:52 +02:00
Erik Montnemery
28ebab9c5a
Simplify waiting for recorder in tests (#70647) 2022-04-25 12:04:47 +02:00
J. Nick Koston
9f11063724
Fix state_changes_during_period bakery caching for limit and descending (#70610) 2022-04-24 21:47:21 -07:00
Erik Montnemery
982e314de6
Use recorder_mock in tests (#70363)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-04-22 19:29:44 -10:00
J. Nick Koston
3737b58e85
Avoid fetching metadata multiple times during stat compile (#70397) 2022-04-22 00:25:42 -10:00
J. Nick Koston
3142a106fc
Additional prep work for sqlalchemy 2.0 (#70358) 2022-04-21 12:39:18 -10:00
J. Nick Koston
89807f0d2d
Reduce the number of queries needed to compile statistics (#69731)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-04-15 09:13:29 -07:00
J. Nick Koston
c85387290a
Increase recorder queue max backlog to 40k, improve message (#70065) 2022-04-14 11:45:07 -10:00
Erik Montnemery
eb3458a3d2
Add MutexPool for recorder tests (#69410)
* Add MutexPool for recorder tests

* Fix get_schema_version

* Update test test_last_run_was_recently_clean

* Update test test_shutdown_before_startup_finishes

* Revert comments in test_write_lock_db

* Make the MutexPool lock a class variable

* Remove stale comment

* Move MutexPool

* Tweak debug prints
2022-04-12 07:41:46 -10:00
J. Nick Koston
72fffde77a
Fix spelling of periodic in recorder (#69658)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-04-07 23:37:02 -10:00
J. Nick Koston
66f0a3816a
Reduce memory pressure during database migration (#69628) 2022-04-07 18:29:31 -10:00
Erik Montnemery
949b0e1b65
Don't allow in-memory SQLite database (#69616) 2022-04-08 00:43:09 +02:00
Erik Montnemery
4a7c978f69
Speedup recorder test test_write_lock_db (#69578) 2022-04-07 15:36:58 +02:00
J. Nick Koston
5c7c09726a
Cleanup recorder history typing (#69408) 2022-04-07 00:09:05 -10:00
J. Nick Koston
bde3646293
Always use a commit interval of 0 for the in memory db in tests (#69330) 2022-04-05 12:06:06 -10:00
J. Nick Koston
ec131d685e
Auto repack the database on the second sunday of the month (#69314) 2022-04-04 21:39:12 -10:00
J. Nick Koston
f5a13fc51b
Add ability to exclude attributes from being recorded by entity domain (#68824) 2022-03-29 20:13:08 -07:00
Joakim Sørensen
32b2d1e5c9
Add backup platform to recorder (#68229) 2022-03-25 23:17:11 -07:00
J. Nick Koston
a566d3943c
Fix history queries while the database migration is in progress (#68598) 2022-03-24 09:49:13 -10:00
J. Nick Koston
e911936a0d
Remove direct usage of concurrent.futures from recorder (#68593) 2022-03-24 09:48:49 -10:00
Erik Montnemery
61cc8e32f3
Include has_mean + has_sum in statistics metadata WS response (#68546)
* Include has_mean + has_sum in statistics metadata WS response

* Don't include has_mean/has_sum in history/list_statistic_ids

* Adjust tests

* Do include has_mean/has_sum in history/list_statistic_ids
2022-03-24 10:12:01 +01:00
Erik Montnemery
b5c5da96ac
Add WS API to adjust incorrect energy statistics (#65147)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-03-22 15:18:30 -07:00
Pawel
bcb8c7ec3c
Add API endpoint get_statistics_metadata (#68471)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-03-21 21:14:47 -07:00
J. Nick Koston
3150915cb7
Convert unindexed domain queries to entity_id queries (#68404) 2022-03-20 01:28:17 -10:00
J. Nick Koston
816695cc96
Avoid selecting attributes in the history api when no_attributes is passed (#68352) 2022-03-19 23:47:22 -10:00
Erik Montnemery
cf4033b1bc
Simplify time zone setting in tests (#68330)
* Simplify timezone setting in tests

* Fix typo

* Adjust caldav tests

* Adjust input_datetime tests

* Adjust time_date tests

* Adjust tod tests

* Adjust helper tests

* Adjust recorder tests

* Adjust risco tests

* Adjust aemet tests

* Adjust flux tests

* Adjust forecast_solar tests

* Revert unnecessary change in forecast_solar test

* Adjust climacell tests

* Adjust google tests

* Adjust sensor tests

* Adjust sonarr tests

* Adjust template tests

* Adjust zodiac tests

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-03-20 10:25:15 +01:00
J. Nick Koston
7ee647cc78
Fix FOREIGN KEY constraint failed when removing state_attributes (#68364) 2022-03-19 14:21:28 -07:00
J. Nick Koston
9215702388
Separate attrs into another table (reduces database size) (#68224) 2022-03-18 00:23:13 -10:00
J. Nick Koston
bc862e97ed
Use a dedicated executor pool for database operations (#68105)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-03-17 23:09:01 -10:00
J. Nick Koston
95f20500ca
Commit any pending changes before running non-EventTasks in the recorder (#68287) 2022-03-17 21:33:22 -07:00
Erik Montnemery
d360ac91ca
Disable recorder nightly jobs in tests (#68188) 2022-03-15 09:23:52 -07:00
J. Nick Koston
b18096fc54
Remove unused columns from states/events tables (#68078) 2022-03-13 23:44:55 -07:00