Commit graph

23 commits

Author SHA1 Message Date
J. Nick Koston
5114a1400f
Ensure logbook still responds if describe event throws (#91961)
* Ensure logbook still responds if describe event throws

If describe fails, the logbook stream should not collapse

* Ensure logbook still responds if describe event throws

If describe fails, the logbook stream should not collapse
2023-04-24 22:22:53 -04:00
J. Nick Koston
b76551cf35
Reduce number of columns selected for logbook (#91718) 2023-04-22 14:25:22 +02:00
J. Nick Koston
95fcdc5684
Speed up sql queries where ORM rows are not needed (#91839)
* Speed up logbook and history queries where ORM rows are not needed

This avoids having sqlalchemy wrap Result in ChunkedIteratorResult
which has additional overhead we do not need for these cases

* more places

* anything that uses _sorted_statistics_to_dict does not need orm rows either
2023-04-21 23:28:07 -04:00
J. Nick Koston
56a6244d90
Remove legacy context lookup implementation from logbook (#91710)
* Remove legacy context lookup implemention from logbook

This object can now be replaced with a simple dict

* Remove legacy context lookup implemention from logbook

This object can now be replaced with a simple dict

* scope

* fix order issue
2023-04-19 21:54:34 -04:00
J. Nick Koston
2530031454
Use cache to lookup event type ids in logbook (#91576)
noticed we can speed this up while looking at
https://github.com/home-assistant/core/issues/91514

Note: this will not fix that issue as there is more going on there
2023-04-17 23:40:03 -04:00
rlippmann
f5911bcad6
Add slots to dataclasses in default_config (#91410)
* add dataclass slots to default config items

* remove slots from sun mixing
2023-04-14 14:22:39 -04:00
J. Nick Koston
f1fa63281e
Adjust context id variable names in the logbook processor to improve readability (#90617)
Adjust some variable names in the logbook process to improve readablity

There were some places were we used context_id that should have been context_id_bin
2023-04-01 10:24:02 -04:00
J. Nick Koston
7f3e4cb3af
Guard against selecting all invalid entity_ids in history (#89929)
If all the entity_ids that were provided do not exist we would
end up passing an empty list of ids to the SQL query which
would do an unbounded select
2023-03-19 22:03:12 -04:00
J. Nick Koston
a244749712
Make StatesMetaManager thread-safe when an entity_id is fully deleted from the database and than re-added (#89732)
* refactor to make StatesMetaManager threadsafe

* refactor to make StatesMetaManager threadsafe

* refactor to make StatesMetaManager threadsafe

* refactor to make StatesMetaManager threadsafe

* reduce

* comments
2023-03-15 08:54:02 -04:00
J. Nick Koston
85ca94e9d4
Mark database sessions that do not write data as read_only (#89600)
* Mark sessions that do not write data as read_only

* Mark sessions that do not write data as read_only
2023-03-12 21:33:28 -04:00
J. Nick Koston
c41f91be89
Deduplicate entity_id in the states table (#89557) 2023-03-12 10:01:58 -10:00
J. Nick Koston
01e1221443
Refactor logbook data to use a dataclass (#89534) 2023-03-11 12:45:27 +01:00
J. Nick Koston
170a13302c
Reduce overhead to store context ids in the database (#88942) 2023-03-08 14:51:45 -10:00
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
epenet
b4dd1b8cb2
Rename logbook constant (#86464) 2023-01-23 18:00:25 +02: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
J. Nick Koston
28dd92d928
Fix logbook state query with postgresql (#73924) 2022-06-23 23:35:10 +02:00
J. Nick Koston
457c7a4ddc
Fix incompatiblity with live logbook and google_assistant (#73063) 2022-06-05 19:06:49 -10:00
J. Nick Koston
a28fa5377a
Remove unused code from logbook (#72950) 2022-06-03 08:59:00 +02:00
J. Nick Koston
5dc4c89acc
Small performance improvement for matching logbook rows (#72750) 2022-05-31 10:41:33 +02: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
0248a8710f
Always pass the source of the trigger for logbook context messages (#72333) 2022-05-23 13:35:45 -05: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