Commit graph

20 commits

Author SHA1 Message Date
Erik Montnemery
3a78f1fce6
Force STATE_CLASS_TOTAL_INCREASING to reset to 0 ()
* Force STATE_CLASS_TOTAL_INCREASING to reset to 0

* Tweak

* Correct detection of new cycle

* Fix typing
2021-08-17 23:05:31 +02:00
Erik Montnemery
029873a088
Add support for total and total_increasing sensor state classes ()
* Add support for amount and meter sensor state classes

* Ignore last_reset for STATE_CLASS_METER sensors

* Update tests

* Rename STATE_CLASS_METER to STATE_CLASS_AMOUNT_INCREASING

* Rename STATE_CLASS_AMOUNT to STATE_CLASS_TOTAL

* Fix typo

* Log warning if last_reset set together with state_class measurement

* Fix warning message
2021-08-13 12:35:23 +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
Paulus Schoutsen
f71980a634
Create stats for all sensors that have % unit and are measurement () 2021-07-27 21:56:34 +02:00
Erik Montnemery
ddc788bf8e
Include future statistics in history/list_statistic_ids ()
* 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 ()
* Enable basic type checking for recorder

* Tweak
2021-07-13 21:21:45 +02:00
Erik Montnemery
24ae05b734
Drop statistic_id and source columns from statistics table ()
* 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 () 2021-07-02 09:51:47 +02:00
Erik Montnemery
57fbb1c3d9
Fix sensor statistics collection with empty states () 2021-07-01 14:53:03 +02:00
Erik Montnemery
0476c7f9ee
Normalize temperature statistics to °C ()
* 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
Erik Montnemery
0ab999738b
Add statistics meta data table ()
* Add statistics meta data table

* Tweak meta data generation
2021-06-30 13:32:17 +02:00
Erik Montnemery
cca5964ac0
Normalize pressure statistics to Pa () 2021-06-29 23:30:13 +02:00
Erik Montnemery
6131ed09f0
Compile statistics for power sensors () 2021-06-29 14:48:08 +02:00
Erik Montnemery
c785db4ffa
Normalize energy statistics to kWh () 2021-06-29 12:20:10 +02:00
Erik Montnemery
a374e24843
Add monetary sensor device class ()
* Add total_cost sensor device class

* Change to DEVICE_CLASS_MONETARY
2021-06-23 15:32:25 +02:00
Erik Montnemery
b339d73109
Weight sensor average statistics by state durations ()
* Weight sensor average statistics by state durations

* Fix test
2021-05-28 13:16:52 +02:00
Erik Montnemery
6f26687aa7
Compile statistics for battery, humidity and pressure sensors () 2021-05-21 10:48:11 +02:00
Daniel Hjelseth Høyer
fd2e640c74
Use sensor constants in recorder ()
Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>
2021-05-20 18:23:00 +02:00
Erik Montnemery
e16a8063a5
Compile statistics for energy sensors ()
* 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 () 2021-05-16 10:23:37 -07:00