Erik Montnemery
e3534eec87
Report orphaned statistics in statistic validation ( #57324 )
2021-10-20 15:57:22 +02:00
Erik Montnemery
9a26a8cfd8
Add support for daily and monthly statistics ( #57576 )
...
* 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 ( #57792 )
2021-10-17 20:15:48 +02:00
Erik Montnemery
ee98849360
Always include start point for statistics ( #57182 )
2021-10-12 10:39:36 -07:00
Erik Montnemery
0139bfa749
Detect if mysql and sqlite support row_number ( #57475 )
2021-10-11 21:17:18 -07:00
Erik Montnemery
be61009030
Correct SQL query generated by get_metadata_with_session ( #57225 )
...
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-10-07 13:23:23 -07:00
Erik Montnemery
6af1a835e6
Optimize statistics generation ( #56821 )
...
* Optimize statistics generation
* pylint
2021-09-30 17:14:36 +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
Marc Mueller
565a9fea6b
Import Callable from collections.abc (2) ( #56776 )
2021-09-29 14:06:51 +02:00
Erik Montnemery
552485bb05
Tweak list_statistic_ids ( #55845 )
...
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 ( #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
f0a4a89d21
Add comments to recorder statistics code ( #56545 )
...
* 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 ( #56492 )
2021-09-22 13:31:33 -07: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
7e70252de5
Handle statistics for sensor with changing state class ( #55316 )
2021-08-27 16:18:49 +02:00
Erik Montnemery
ffbd2d79c8
Generate statistics for all sensors with a supported state_class ( #54882 )
...
* 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 ( #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
Bram Kragten
e23750b2a4
Add device class `gas` and enable statistics for it ( #54110 )
...
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 ( #52755 )
2021-07-14 13:23:11 +02:00
Erik Montnemery
ddc788bf8e
Include future statistics in history/list_statistic_ids ( #52942 )
...
* Include future statistics in history/list_statistic_ids
* Improve tests
2021-07-14 11:54:55 +02: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
c5556a091e
Return empty when listing statistic_ids for unsupported statistic ( #52954 )
2021-07-13 10:35:55 +02:00
Erik Montnemery
11fd9d9525
Avoid duplicated database queries when fetching statistics ( #52433 )
2021-07-02 15:40:54 +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
16d2dcbfb2
Improve sensor statistics tests ( #52386 )
2021-07-02 09:51:47 +02:00
Erik Montnemery
d450cda385
Report target unit in statistics meta data ( #52341 )
2021-06-30 16:53:51 +02:00
Erik Montnemery
9d0c4c168e
Convert units when fetching statistics ( #52338 )
2021-06-30 14:53:42 +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
Erik Montnemery
0ca199d8d0
Add WS API for listing available statistic ids ( #51984 )
...
* Add WS API for listing available statistic ids
* Update homeassistant/components/history/__init__.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2021-06-18 21:32:30 +02:00
Paulus Schoutsen
805ef3f90b
Allow fetching multiple statistics ( #51996 )
2021-06-18 21:03:13 +02: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
Erik Montnemery
89dd3292ba
Initial draft of statistics ( #49852 )
2021-05-16 10:23:37 -07:00