Commit graph

104 commits

Author SHA1 Message Date
Erik Montnemery
037f6947d8
Fail recorder setup with unsupported dialect or version (#70888) 2022-05-18 16:52:46 +02:00
J. Nick Koston
c4fc84ec1e
Add support for selecting device_ids from the logbook (#72039)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-05-18 01:58:30 -05:00
J. Nick Koston
a70e2a33dc
Fixing purging legacy rows and improve performance (#71916) 2022-05-15 21:25:07 -07:00
J. Nick Koston
089eb9960a
Reduce logbook websocket payload size and parse json attributes via the DBM (#71895) 2022-05-15 20:48:57 -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
0584e84c30
Add MySQL index hints to logbook (#71864)
* Add MySQL index hints to logbook

* fix mysql query planner
2022-05-14 17:01:36 -05:00
J. Nick Koston
ebce5660e3
Sync event timed_fired and the context ulid time (#71854) 2022-05-14 12:12:08 -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
1d9fb4bca8
Fix process_datetime_to_timestamp and add test coverage (#71755) 2022-05-12 17:12:50 -07:00
J. Nick Koston
8ab27f26b9
Use ciso8601 for parsing datetimes with sqlalchemy sqlite dialect (#71766) 2022-05-12 17:11:43 -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
6922209ddb
Ensure all mysql tables get optimized (#71538) 2022-05-08 12:15:06 -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
6ce768465f
Improve purge performance for non-sqlite databases (#70576) 2022-04-26 13:11:57 -07: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
522a9bb6b1
Exclude supported features and attribution from being recorded in the database (#69165) 2022-04-03 13:51:42 +02: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
J. Nick Koston
d7634d1cb1
Additional strict typing for additional recorder internals (#68689)
* Strict typing for additional recorder internals

* revert

* fix refactoring error
2022-03-29 09:45:25 +02:00
Marc Mueller
53245c6523
Update pylint to 2.13.0 (#68656) 2022-03-25 15:14:48 -07:00
J. Nick Koston
c5c34bc0d7
Typing and code quality for recorder history (#68647) 2022-03-24 17:58:38 -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
0c0df07c52
Avoid hashing attributes when they are already in the cache (#68395) 2022-03-19 23:33:37 -07: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
J. Nick Koston
b18096fc54
Remove unused columns from states/events tables (#68078) 2022-03-13 23:44:55 -07:00
Marc Mueller
cb736eaeaf
Add type ignore error codes [recorder] (#66780) 2022-02-18 10:37:38 +01:00
Erik Montnemery
bceeaec2f8
Remove duplicated statistics rows (#61146)
* Remove duplicated statistics

* Fix misleading docstring

* Pylint knows best

* Correct test

* Oops

* Prevent insertion of duplicated statistics

* Tweak

* pylint

* Add models_schema_23.py

* Tweak
2021-12-13 14:15:36 +01:00
Erik Montnemery
f594bc353b
Add support for external statistics (#56607)
* Support external statistics

* Update tests

* Lint

* Adjust code after rebase

* Separate external statistic_id with :, add name to metadata

* Adjust tests

* Simplify get_metadata_with_session

* Address review comments

* Allow updating external statistics

* Validate input

* Adjust tests after rebase

* Pylint

* Adjust tests

* Improve test coverage
2021-10-26 10:26:50 +02:00
Erik Montnemery
a966714032
Minor cleanup of recorder statistics code (#55339) 2021-09-29 11:42:39 -07:00
Erik Montnemery
40ecf22bac
Remove automatic splitting of net meters from statistics (#56772) 2021-09-29 17:20:17 +02:00
Erik Montnemery
92253f5192
Minor refactoring of periodic statistics (#56492) 2021-09-22 13:31:33 -07:00
Marcin Ciupak
b9ffd74db5
Fix recorder Oracle DB models (#55564)
* Fix recorder models for Oracle DB

* Fix StatisticsRuns

* Update migration for Oracle Identity columns.

* Update migration logic

Migration to schema version 22 done only for engine dialect oracle

* Add missing table check in schema 22 migration
2021-09-21 00:38:42 +02:00
Erik Montnemery
8c5efafdd8
Add 5-minute statistics for sensors (#56006)
* Add 5-minute statistics for sensors

* Address pylint issues

* Black

* Apply suggestion from code review

* Apply suggestions from code review

* Improve tests
2021-09-16 10:57:15 +02:00
Erik Montnemery
d2a9f7904a
Include end time of statistics data points in API response (#56063)
* Include end time of statistics data points in API response

* Correct typing

* Update tests
2021-09-13 10:02:24 +02:00
Erik Montnemery
2a8121bdcd
Really change character set of statistics_meta table to utf8 (#56029) 2021-09-09 22:55:51 +02:00
Erik Montnemery
a47532c69b
Change character set of statistics_meta table to utf8 (#56011) 2021-09-09 17:24:20 +02:00
Erik Montnemery
80fd330479
Add sum_decrease and sum_increase statistics (#55850) 2021-09-08 23:35:53 -07:00
Erik Montnemery
7e70252de5
Handle statistics for sensor with changing state class (#55316) 2021-08-27 16:18:49 +02:00
Erik Montnemery
6d4a47a53d
Fix double precision float for postgresql (#55249) 2021-08-26 10:06:53 +02:00
Erik Montnemery
8877f37da0
Fix statistics for sensors setting last_reset (#55136)
* Re-add state_class total to sensor

* Make energy cost sensor enforce state_class total_increasing

* Drop state_class total

* Only report energy sensor issues once
2021-08-24 17:02:34 +02:00
Erik Montnemery
0624859bf4
Set statistics columns to double precision (#55053) 2021-08-24 11:18:59 +02:00
Erik Montnemery
32e297f4a0
Compile missing statistics (#54690) 2021-08-19 22:10:45 -07:00
Erik Montnemery
e1926caeb9
Remove STATE_CLASS_TOTAL and last_reset from sensor (#54755)
* Remove STATE_CLASS_TOTAL

* Update mill sensor

* Update tests

* Kill last_reset

* Return ATTR_LAST_RESET to utility_meter

* Update energy cost sensor

* Restore last_reset for backwards compatibility

* Re-add and update deprecation warning

* Update tests

* Fix utility_meter

* Update EnergyCostSensor

* Tweak

* Fix rebase mistake

* Fix test
2021-08-18 10:03:27 +02:00
Paulus Schoutsen
557cc792e9
Fix SQLAlchemy test warnings (#54116) 2021-08-08 20:33:47 -07:00
Franck Nijhof
c875ff8648
Store JSON in database in compact format (#53364)
* Store JSON in database in compact format

* Fix logbook
2021-07-22 12:05:59 -10:00
Erik Montnemery
19d3aa71ad
Enable basic type checking for recorder (#52440)
* Enable basic type checking for recorder

* Tweak
2021-07-13 21:21:45 +02:00
Erik Montnemery
ed25e6fada
Correct recorder table arguments (#52436) 2021-07-02 16:28:16 +02:00
Erik Montnemery
24ae05b734
Drop statistic_id and source columns from statistics table (#52417)
* Drop statistic_id and source columns from statistics table

* Remove useless double drop of statistics table

* Update homeassistant/components/recorder/models.py

Co-authored-by: Franck Nijhof <git@frenck.dev>

* black

Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-07-02 13:17:00 +02:00
Erik Montnemery
0ab999738b
Add statistics meta data table (#52331)
* Add statistics meta data table

* Tweak meta data generation
2021-06-30 13:32:17 +02:00