Erik Montnemery
bcd9f3c05f
Correct end time for monthly statistics summary ( #59551 )
...
* Correct end time for monthly statistics summary
* Add tests
2021-11-12 15:01:40 +01:00
Erik Montnemery
e5ee38d3b0
Adjust recorder tests according to #59087 ( #59143 )
2021-11-05 10:49:58 +01:00
Erik Montnemery
470b01e4ce
Move async_migration_in_progress ( #59087 )
2021-11-05 10:40:56 +01:00
Erik Montnemery
185f7beafc
Improve recorder migration tests ( #59075 )
2021-11-04 20:21:38 -07:00
Erik Montnemery
4c5aca93df
Add recorder status WS API ( #58989 )
...
* Add recorder status WS API
* Rename recorder/status to recorder/info
* Silence pylint
* Improve tests
* Address review comments
* Tweak
* Try to fix tests
* Try to debug flaky tests
* Try to fix tests
* Revert changes to async_migration_in_progress
* Try to fix tests
* Remove debug prints
* Apply suggestions from code review
2021-11-04 16:46:45 +01:00
Erik Montnemery
be4e9f91b6
Change minimum supported SQLite version to 3.31.0 ( #59073 )
2021-11-04 16:34:35 +01:00
Erik Montnemery
dfa50a842a
Simplify recorder PgSQL version checks ( #58533 )
2021-10-27 16:05:40 +02:00
Erik Montnemery
ac5e32d648
Corrections for external statistics ( #58469 )
2021-10-26 14:05:45 +02:00
Erik Montnemery
e9ba5f3b4b
Warn when recorder connects to an unsupported database ( #58161 )
2021-10-26 13:41:59 +02: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
b301ab25a3
Purge short term statistics ( #58028 )
...
* Purge short term statistics
* Less meep
* Add tests
2021-10-20 16:00:59 +02:00
Erik Montnemery
8ef8838801
Correct detection of row_number support for MariaDB ( #57663 )
2021-10-14 11:19:39 -07:00
Erik Montnemery
0139bfa749
Detect if mysql and sqlite support row_number ( #57475 )
2021-10-11 21:17:18 -07:00
Paulus Schoutsen
a4d9019ffc
Refactor persistent notification to no longer route all data via a service ( #57157 )
...
* Convert persistent notification tests to async
* Create/dismiss persistent notifications in exposed functions, not service calls
* Fix notify persistent_notification
* Remove setting up persistent_notification
* Drop more setups
* Empty methods
* Undeprecate sync methods because too big task
* Fix setup clearing notifications
* Fix a bunch of tests
* Fix more tests
* Uno mas
* Test persistent notification events
* Clean up stale comment
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-10-07 12:58:00 +02:00
Erik Montnemery
69875cbd11
Improve sensor statistics validation ( #56892 )
2021-10-04 09:47:44 -07:00
Erik Montnemery
8567aa9e13
Evict purged states from recorder's old_state cache ( #56877 )
...
Co-authored-by: J. Nick Koston <nick@koston.org>
2021-10-04 08:21:40 -07:00
Erik Montnemery
40ecf22bac
Remove automatic splitting of net meters from statistics ( #56772 )
2021-09-29 17:20:17 +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
8ef123259e
Add WS API for updating unit_of_measurement in statistics metadata ( #56184 )
...
* Add WS API for updating statistics metadata
* Update homeassistant/components/recorder/websocket_api.py
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
* Update homeassistant/components/recorder/websocket_api.py
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
* Fix typo
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-09-28 00:43:29 +02:00
Erik Montnemery
5976f898da
Add WS API for removing statistics for a list of statistic_ids ( #55078 )
...
* Add WS API for removing statistics for a list of statistic_ids
* Refactor according to code review, enable foreign keys support for sqlite
* Adjust tests
* Move clear_statistics WS API to recorder
* Adjust tests after rebase
* Update docstring
* Update homeassistant/components/recorder/websocket_api.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Adjust tests after rebase
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-09-27 23:30:13 +02:00
Erik Montnemery
64393b462d
Add migration for 5-minute statistics ( #56585 )
...
* Add migration for 5-minute statistics
* Tweaks
2021-09-24 09:19:22 +02:00
Erik Montnemery
92253f5192
Minor refactoring of periodic statistics ( #56492 )
2021-09-22 13:31:33 -07:00
Erik Montnemery
6f36419c6f
Improve statistics validation ( #56457 )
2021-09-20 17:54:25 +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
d899d15a1e
Add statistics validation ( #56020 )
...
* Add statistics validation
* Remove redundant None-check
* Move validate_statistics WS API to recorder
* Apply suggestion from code review
2021-09-13 13:44:22 +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
80fd330479
Add sum_decrease and sum_increase statistics ( #55850 )
2021-09-08 23:35:53 -07:00
Erik Montnemery
27764e9985
Fix handling of imperial units in long term statistics ( #55959 )
2021-09-08 08:08:48 -07:00
Erik Montnemery
22e6ddf8df
Do not let one bad statistic spoil the bunch ( #55942 )
2021-09-08 07:55:40 -07: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
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
Erik Montnemery
e541bcd54d
Update statistics meta data on entity_id change ( #52755 )
2021-07-14 13:23:11 +02:00
Erik Montnemery
11fd9d9525
Avoid duplicated database queries when fetching statistics ( #52433 )
2021-07-02 15:40:54 +02:00
Erik Montnemery
0476c7f9ee
Normalize temperature statistics to °C ( #52297 )
...
* Normalize temperature statistics to °C
* Fix tests
* Support temperature conversion to and from K, improve tests
* Fix test
* Add tests, pylint
2021-06-30 14:17:58 +02:00
PeteBa
42c4317628
Avoid drift in recorder purge cut-off ( #52135 )
2021-06-25 11:29:38 -10:00
Paulus Schoutsen
805ef3f90b
Allow fetching multiple statistics ( #51996 )
2021-06-18 21:03:13 +02:00
Erik Montnemery
39c94e8daa
Fix flaky statistics tests ( #51214 )
...
* Fix flaky statistics tests
* Tweak
2021-05-28 22:37:17 +02:00
Erik Montnemery
b339d73109
Weight sensor average statistics by state durations ( #51150 )
...
* Weight sensor average statistics by state durations
* Fix test
2021-05-28 13:16:52 +02:00
PeteBa
aa9b99713c
Add purge_entities service call to recorder ( #48069 )
2021-05-22 10:30:05 -05:00
Erik Montnemery
e16a8063a5
Compile statistics for energy sensors ( #50829 )
...
* Compile statistics for energy sensors
* Update tests
* Rename abs_value to state
* Tweak
* Recreate statistics table
* Pylint
* Try to fix test
* Fix statistics for multiple energy sensors
* Fix energy statistics when last_reset is not set
2021-05-20 13:05:15 +02:00
J. Nick Koston
e7f7e61e88
Ensure a wal checkpoint is scheduled nightly ( #50746 )
2021-05-17 16:27:51 -05:00
J. Nick Koston
72288710ca
Increase the sqlite cache size from ~2MiB to 8MiB ( #50747 )
2021-05-17 19:42:12 +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
J. Nick Koston
bf2d40adfe
Migrate from pytz to python-dateutil ( #49643 )
...
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-05-07 22:46:26 -07:00
J. Nick Koston
1c8d9ca68b
Check exception causes for matching strings during recorder migration ( #49999 )
2021-05-02 20:57:42 -07:00
Paulus Schoutsen
1bd9826684
Handle different entity_id formats ( #49969 )
2021-05-01 20:30:28 -07:00
J. Nick Koston
b27e9e376d
Use StaticPool for recorder and NullPool for all other threads with sqlite3 ( #49693 )
2021-04-26 19:20:31 -10:00