Commit graph

43 commits

Author SHA1 Message Date
Erik Montnemery
94519de8dd
Upgrade SQLAlchemy to 2.0.2 (#86436)
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-02-08 08:17:32 -06:00
J. Nick Koston
0a1d5c85ad
Optimize history.get_last_state_changes query (#87554)
fixes undefined
2023-02-07 07:50:44 -06:00
Franck Nijhof
ca1a12898c
Enable Ruff D212 (#87347) 2023-02-03 23:08:48 +01:00
Franck Nijhof
c5dedb7a79
Code styling tweaks to the recorder integration (#86030) 2023-01-16 19:51:11 +01:00
J. Nick Koston
233332c3a0
Fix fetching history include_start_time_state when timezone is not UTC (#85983) 2023-01-16 09:01:32 +01:00
J. Nick Koston
57239769ba
Only build compressed states once (#85561) 2023-01-09 12:07:32 -10:00
J. Nick Koston
b8a1537b58
Improve performance of fetching and storing history and events with the database (#84870) 2023-01-02 13:26:08 -10:00
epenet
13f250319d
Import websocket api constants from root (#78250) 2022-09-12 22:07:58 -04:00
epenet
253d355526
Remove unused mypy ignore statements (#78292) 2022-09-12 09:25:11 -04:00
epenet
8ed689fede
Add new rule to enforce relative imports in pylint (#77358)
* Add new rule to enforce relative imports in pylint

* Early return

* Adjust components
2022-08-29 08:55:32 +02: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
bfa7693d18
Fixes for logbook filtering and add it to the live stream (#72501) 2022-05-25 15:17:08 -10: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
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
1f753ecd88
Relocate sqlalchemy filter builder to recorder/filters.py (#71883) 2022-05-14 23:04:23 -07:00
J. Nick Koston
65f44bd80b
Exclude last_changed when same as last_updated for history websocket api (#71886) 2022-05-14 23:03:56 -07: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
e2cef55162
Add history/history_during_period websocket endpoint (#71688) 2022-05-11 17:52:22 -05:00
J. Nick Koston
bf77c000ea
Complete baked query conversion for recorder.history (#71618) 2022-05-09 21:00:19 -07: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
195811843b
Remove get_state and get_states history api calls (#70830) 2022-04-26 16:05:43 -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
J. Nick Koston
96d64bd6b7
Avoid selecting last_updated from the db when filtering on last_updated==last_changed (#70459) 2022-04-25 08:46:37 -10: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
J. Nick Koston
022deb20fd
Fix history not including start time state (#70447) 2022-04-24 14:34:00 -07:00
J. Nick Koston
5c7c09726a
Cleanup recorder history typing (#69408) 2022-04-07 00:09:05 -10:00
J. Nick Koston
8b04c676ac
Fix typing on recorder.history (#68917) 2022-03-30 09:50:21 -10:00
J. Nick Koston
c5c34bc0d7
Typing and code quality for recorder history (#68647) 2022-03-24 17:58:38 -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
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
J. Nick Koston
9864090e0b
Cache parsing attr in LazyState (#68232) 2022-03-18 07:44:37 -07:00
J. Nick Koston
9215702388
Separate attrs into another table (reduces database size) (#68224) 2022-03-18 00:23:13 -10:00
Michael
83989d7b40
Use relative imports [L-R] (#61575) 2021-12-13 00:24:46 +01:00
Erik Montnemery
6af1a835e6
Optimize statistics generation (#56821)
* Optimize statistics generation

* pylint
2021-09-30 17:14:36 +02:00
Erik Montnemery
00651a4055
Optimize _get_states_with_session (#56734)
* Optimize _get_states_with_session

* Move custom filters to derived table

* Remove useless derived table

* Filter old states after grouping

* Split query

* Add comments

* Simplify state update period criteria

* Only apply custom filters if we didn't get an include list of entities

Co-authored-by: J. Nick Koston <nick@koston.org>
2021-09-29 17:08:27 +02:00
Erik Montnemery
89dd3292ba
Initial draft of statistics (#49852) 2021-05-16 10:23:37 -07:00
Erik Montnemery
973f59e423
Refactor history component (#50287)
* Refactor history component

* Update tests

* Address review comments

* Correct deprecated functions
2021-05-11 09:21:57 +02:00