Commit Graph

33 Commits (f95c9d0f02ca9a0f740d212e1d6d6969c65964ad)

Author SHA1 Message Date
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 bfa7693d18
Fixes for logbook filtering and add it to the live stream () 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 () 2022-05-19 20:58:32 -07:00
J. Nick Koston 98809675ff
Convert history queries to use lambda_stmt ()
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 () 2022-05-14 23:04:23 -07:00
J. Nick Koston 65f44bd80b
Exclude last_changed when same as last_updated for history websocket api () 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 () 2022-05-14 12:06:31 -07:00
J. Nick Koston e2cef55162
Add history/history_during_period websocket endpoint () 2022-05-11 17:52:22 -05:00
J. Nick Koston bf77c000ea
Complete baked query conversion for recorder.history () 2022-05-09 21:00:19 -07:00
J. Nick Koston 13ce0a7d6a
Fix history using pre v25 queries during v26 migration () 2022-05-04 08:56:50 -07:00
J. Nick Koston 195811843b
Remove get_state and get_states history api calls () 2022-04-26 16:05:43 -07:00
J. Nick Koston f073f17040
Refactor tracking of the recorder run history ()
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 () 2022-04-25 08:46:37 -10:00
J. Nick Koston 9f11063724
Fix state_changes_during_period bakery caching for limit and descending () 2022-04-24 21:47:21 -07:00
J. Nick Koston 022deb20fd
Fix history not including start time state () 2022-04-24 14:34:00 -07:00
J. Nick Koston 5c7c09726a
Cleanup recorder history typing () 2022-04-07 00:09:05 -10:00
J. Nick Koston 8b04c676ac
Fix typing on recorder.history () 2022-03-30 09:50:21 -10:00
J. Nick Koston c5c34bc0d7
Typing and code quality for recorder history () 2022-03-24 17:58:38 -07:00
J. Nick Koston a566d3943c
Fix history queries while the database migration is in progress () 2022-03-24 09:49:13 -10:00
J. Nick Koston 3150915cb7
Convert unindexed domain queries to entity_id queries () 2022-03-20 01:28:17 -10:00
J. Nick Koston 816695cc96
Avoid selecting attributes in the history api when `no_attributes` is passed () 2022-03-19 23:47:22 -10:00
J. Nick Koston 9864090e0b
Cache parsing attr in LazyState () 2022-03-18 07:44:37 -07:00
J. Nick Koston 9215702388
Separate attrs into another table (reduces database size) () 2022-03-18 00:23:13 -10:00
Michael 83989d7b40
Use relative imports [L-R] () 2021-12-13 00:24:46 +01:00
Erik Montnemery 6af1a835e6
Optimize statistics generation ()
* Optimize statistics generation

* pylint
2021-09-30 17:14:36 +02:00
Erik Montnemery 00651a4055
Optimize _get_states_with_session ()
* 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 () 2021-05-16 10:23:37 -07:00
Erik Montnemery 973f59e423
Refactor history component ()
* Refactor history component

* Update tests

* Address review comments

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