Commit Graph

3110 Commits (80ee5834180cfed9fbacd5726466a4271e1909b4)

Author SHA1 Message Date
Paulus Schoutsen eba1d7d16a
Guard for bad last reset (#57344) 2021-10-08 10:48:52 -07:00
Erik Montnemery 69875cbd11
Improve sensor statistics validation (#56892) 2021-10-04 09:47:44 -07:00
GitHub Action f42c2f5170 [ci skip] Translation update 2021-10-02 12:59:05 +00:00
Erik Montnemery 6af1a835e6
Optimize statistics generation (#56821)
* Optimize statistics generation

* pylint
2021-09-30 17:14:36 +02:00
Erik Montnemery 6954614e62
Warn if total_increasing sensor has negative states (#56564) 2021-09-30 07:49:16 -07:00
Erik Montnemery 8c3fc95fb8
Fallback to state machine in statistics (#56785) 2021-09-29 14:57:16 -07:00
Erik Montnemery 40ecf22bac
Remove automatic splitting of net meters from statistics (#56772) 2021-09-29 17:20:17 +02:00
Marc Mueller 364767ff22
Import Callable from collections.abc (4) (#56778) 2021-09-29 16:15:36 +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 58f465f271
Don't reset meter when last_reset is set to None (#56609) 2021-09-27 12:17:09 +02:00
Erik Montnemery 7452998081
Convert last_reset timestamps to UTC (#56561)
* Convert last_reset timestamps to UTC

* Add test

* Apply suggestion from code review
2021-09-24 09:16:50 +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 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 d5a8f1af1d
Revert "Suppress last_reset deprecation warning for energy cost sensor (#56037)" (#56042)
This reverts commit e990ef249d.
2021-09-10 11:27:47 +02:00
Oxan van Leeuwen 970a7f9662
Fix compounds in sensor device class comments (#55900) 2021-09-10 09:46:21 +02:00
Erik Montnemery e990ef249d
Suppress last_reset deprecation warning for energy cost sensor (#56037) 2021-09-10 08:59:23 +02:00
Erik Montnemery 89281a273c
Correct confusing log message in sensor statistics (#56016) 2021-09-09 23:26:29 -07:00
Erik Montnemery 80fd330479
Add sum_decrease and sum_increase statistics (#55850) 2021-09-08 23:35:53 -07:00
GitHub Action 675426dc25 [ci skip] Translation update 2021-09-09 00:11:32 +00:00
Erik Montnemery 232943c93d
Add significant change support to AQI type sensors (#55833) 2021-09-08 12:47:48 -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 9f1e503784
Do not allow `inf` or `nan` sensor states in statistics (#55943) 2021-09-08 08:05:16 -07:00
Ville Skyttä 0684f8bddf
Add date device class (#55887)
* Add date device class

https://github.com/home-assistant/architecture/discussions/610

* Add date device class to sensors device classes list
2021-09-07 16:46:12 +02:00
Erik Montnemery b99a22cd4d
Re-add state_class total to sensor (#55103)
* Re-add state_class total to sensor

* Make energy cost sensor enforce state_class total_increasing

* Bump deprecation of last_reset for state_class measurement

* Correct rebase mistakes
2021-09-06 18:28:58 +02:00
Erik Montnemery 38d42de2c0
Handle negative numbers in sensor long term statistics (#55708)
* Handle negative numbers in sensor long term statistics

* Use negative states in tests
2021-09-04 10:47:42 +02:00
GitHub Action 19dcb19d07 [ci skip] Translation update 2021-09-04 00:13:17 +00:00
Erik Montnemery 93c086d830
Correct sum statistics when only last_reset has changed (#55498)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-08-31 21:30:52 -07:00
Erik Montnemery 5d1a193eca
Improve log for sum statistics (#55502) 2021-08-31 19:15:22 +02:00
Erik Montnemery f9225bad5f
Make new cycles for sensor sum statistics start with 0 as zero-point (#55473) 2021-08-31 10:45:17 +02:00
GitHub Action 368cac7e5d [ci skip] Translation update 2021-08-31 00:17:01 +00:00
Erik Montnemery 722aa0895e
Improve statistics error messages when sensor's unit is changing (#55436)
* Improve error messages when sensor's unit is changing

* Improve test coverage
2021-08-30 12:51:46 +02:00
GitHub Action 291a2d6258 [ci skip] Translation update 2021-08-29 00:11:57 +00:00
Erik Montnemery 7e70252de5
Handle statistics for sensor with changing state class (#55316) 2021-08-27 16:18:49 +02:00
Matthias Alphart cd0ae66d58
Add CONF_STATE_CLASS to `sensor/__init__.py` (#54106)
* add CONF_STATE_CLASS to const.py

* move to `sensor/__init__.py`

* move to sensor/const.py

* Revert "move to sensor/const.py"

This reverts commit 604d0d066b.

* move it to `sensor/const.py` but import it from `sensor/__init__.py`

* add Modbus
2021-08-27 05:54:50 +02:00
Erik Montnemery 0a07ff4d23
Warn if a sensor with state_class_total has a decreasing value twice (#55251) 2021-08-26 14:27:14 +02:00
GitHub Action 3d7bfa8357 [ci skip] Translation update 2021-08-26 00:13:27 +00:00
Erik Montnemery 7f80781f9b
Prevent setting _attr_unit_of_measurement in subclasses of SensorEntity (#55211) 2021-08-25 15:44:35 +02:00
Marc Mueller 1224d68d05
Remove redundant str cast - sensor value conversion (#55204) 2021-08-25 15:01:17 +02:00
Erik Montnemery bb42eb1176
Warn if a sensor with state_class_total has a decreasing value (#55197) 2021-08-25 13:01:55 +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
GitHub Action b4238443c8 [ci skip] Translation update 2021-08-25 00:14:22 +00:00
Erik Montnemery fa9f91325c
Allow small dip in total_increasing sensor without detecting a reset (#55153) 2021-08-24 17:23:55 +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
GitHub Action ff14a11254 [ci skip] Translation update 2021-08-24 01:55:24 +00:00
Jc2k 2dd4de060b
Add device class for volatile organic compounds (#55050) 2021-08-23 11:14:43 +02:00
Erik Montnemery 2fa07777cd
Warn if unit_of_measurement is set on instances of SensorEntityDescription (#54867)
* Add class BaseEntityDescription without unit_of_measurement

* Refactor according to review comments

* Tweak

* Fix offending integrations

* Fix offending integrations
2021-08-20 15:54:57 +02:00
GitHub Action fc6d45a63b [ci skip] Translation update 2021-08-20 00:16:03 +00:00
Erik Montnemery 4903c1fbfd
Minor cleanup of SensorEntity (#54624) 2021-08-19 12:53:47 +02:00