1
0
mirror of https://github.com/home-assistant/core.git synced 2025-05-30 02:37:04 +00:00

63 Commits

Author SHA1 Message Date
Marc Mueller
53110f8cb7
Update pylint to 2.13.2 () 2022-03-27 16:08:24 +02:00
Marc Mueller
911b159281
Cleanup after pylint update () 2022-03-26 00:34:12 +01:00
J. Nick Koston
3777fa52f0
Ensure recorder statistics process registry updates in the db executor () 2022-03-24 09:48:09 -10:00
Erik Montnemery
61cc8e32f3
Include has_mean + has_sum in statistics metadata WS response ()
* Include has_mean + has_sum in statistics metadata WS response

* Don't include has_mean/has_sum in history/list_statistic_ids

* Adjust tests

* Do include has_mean/has_sum in history/list_statistic_ids
2022-03-24 10:12:01 +01:00
J. Nick Koston
8c10963bc0
Small cleanups for recorder () 2022-03-23 12:12:37 -10:00
Erik Montnemery
b5c5da96ac
Add WS API to adjust incorrect energy statistics ()
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-03-22 15:18:30 -07:00
Pawel
bcb8c7ec3c
Add API endpoint get_statistics_metadata ()
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-03-21 21:14:47 -07:00
Marc Mueller
cb736eaeaf
Add type ignore error codes [recorder] () 2022-02-18 10:37:38 +01:00
Erik Montnemery
910b1f1ec8
Speed up deletion of duplicated statistics () 2022-02-07 09:11:52 -08:00
Erik Montnemery
ac7662c82d
Remove limit of amount of duplicated statistics () 2022-02-04 14:49:45 +01:00
Franck Nijhof
7a2b699371
Update codespell to 2.1.0 () 2022-01-21 22:05:24 +01:00
Erik Montnemery
2f8e65a9b0
Store deleted duplicated statistics in .storage () 2021-12-22 14:27:56 +01:00
Erik Montnemery
48b3d6e1c0
Save original + duplicate pairs when deleting duplicated statistics () 2021-12-21 15:24:36 +01:00
Erik Montnemery
cab2a74b5f
Don't pollute config dir with deleted duplicated statistics () 2021-12-21 14:27:35 +01:00
Erik Montnemery
bceeaec2f8
Remove duplicated statistics rows ()
* 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
dc5888ab4a
Correct recorder.statistics.get_last_statistics () 2021-12-10 10:09:29 -08:00
Erik Montnemery
4a5238efa5
Add support for calculating daily and monthly fossil energy consumption () 2021-11-22 09:10:54 -08:00
Erik Montnemery
bcd9f3c05f
Correct end time for monthly statistics summary ()
* Correct end time for monthly statistics summary

* Add tests
2021-11-12 15:01:40 +01:00
Erik Montnemery
65b1f0d9eb
Minor refactor of energy validator () 2021-11-10 22:38:15 -08:00
Marc Mueller
84618fa831
Use assignment expressions 30 () 2021-10-30 16:33:42 +02:00
Erik Montnemery
ac5e32d648
Corrections for external statistics () 2021-10-26 14:05:45 +02:00
Erik Montnemery
f594bc353b
Add support for external statistics ()
* 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
e3534eec87
Report orphaned statistics in statistic validation () 2021-10-20 15:57:22 +02:00
Erik Montnemery
9a26a8cfd8
Add support for daily and monthly statistics ()
* Add support for daily and monthly statistics

* Remove debug code

* Format code

* Don't use dateutil package

* Remove 2 TODOs

* Remove TODO

* Add comments
2021-10-19 08:29:23 +02:00
Marc Mueller
aa7dc78a1e
Use assignment expressions 11 () 2021-10-17 20:15:48 +02:00
Erik Montnemery
ee98849360
Always include start point for statistics () 2021-10-12 10:39:36 -07:00
Erik Montnemery
0139bfa749
Detect if mysql and sqlite support row_number () 2021-10-11 21:17:18 -07:00
Erik Montnemery
be61009030
Correct SQL query generated by get_metadata_with_session ()
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-10-07 13:23:23 -07:00
Erik Montnemery
6af1a835e6
Optimize statistics generation ()
* Optimize statistics generation

* pylint
2021-09-30 17:14:36 +02:00
Erik Montnemery
a966714032
Minor cleanup of recorder statistics code () 2021-09-29 11:42:39 -07:00
Erik Montnemery
40ecf22bac
Remove automatic splitting of net meters from statistics () 2021-09-29 17:20:17 +02:00
Marc Mueller
565a9fea6b
Import Callable from collections.abc (2) () 2021-09-29 14:06:51 +02:00
Erik Montnemery
552485bb05
Tweak list_statistic_ids ()
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-09-28 00:05:26 -07:00
Erik Montnemery
8ef123259e
Add WS API for updating unit_of_measurement in statistics metadata ()
* 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 ()
* 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
f0a4a89d21
Add comments to recorder statistics code ()
* Add comments to recorder statistics code

* Revert accidental change of list_statistic_ids
2021-09-23 13:14:45 +02:00
Erik Montnemery
92253f5192
Minor refactoring of periodic statistics () 2021-09-22 13:31:33 -07:00
Erik Montnemery
8c5efafdd8
Add 5-minute statistics for sensors ()
* 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 ()
* 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 ()
* 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 () 2021-09-08 23:35:53 -07:00
Erik Montnemery
27764e9985
Fix handling of imperial units in long term statistics () 2021-09-08 08:08:48 -07:00
Erik Montnemery
22e6ddf8df
Do not let one bad statistic spoil the bunch () 2021-09-08 07:55:40 -07:00
Erik Montnemery
7e70252de5
Handle statistics for sensor with changing state class () 2021-08-27 16:18:49 +02:00
Erik Montnemery
ffbd2d79c8
Generate statistics for all sensors with a supported state_class ()
* Generate statistics for all sensors

* Fix bugs, add tests

* Address review comments

* Cleanup warnings

* Simplify tests

* Simplify selection of statistics

* Fix tests
2021-08-25 13:00:35 +02:00
Erik Montnemery
8877f37da0
Fix statistics for sensors setting last_reset ()
* 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 () 2021-08-19 22:10:45 -07:00
Erik Montnemery
e1926caeb9
Remove STATE_CLASS_TOTAL and last_reset from sensor ()
* 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
Bram Kragten
e23750b2a4
Add device class gas and enable statistics for it ()
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-08-11 09:58:19 -07:00
Erik Montnemery
e541bcd54d
Update statistics meta data on entity_id change () 2021-07-14 13:23:11 +02:00