Commit Graph

491 Commits (75fce1f03686c2c714dd409125e6a14cbc2675b2)

Author SHA1 Message Date
Erik Montnemery e830032b33
Remove deprecated temperature conversion of non temperature sensors (#69069) 2022-04-04 20:02:40 +02:00
Erik Montnemery 87100c2517
Drop deprecated support for unit_of_measurement from sensor (#69061) 2022-04-01 08:22:19 -07:00
Erik Montnemery 9471e4d77c
Don't override temperature unit for sensors (#68910) 2022-03-30 10:15:00 -07:00
Erik Montnemery 91f6e58e9a
Allow customizing unit for temperature and pressure sensors (#64366)
* Allow customizing unit for temperature and pressure sensors

* pylint

* Adjust google_wifi tests

* Address review comments and add tests

* Improve rounding when scaling

* Tweak rounding

* Further tweak rounding

* Allow setting entity options with config/entity_registry/update

* Address review comments

* Tweak tests

* Load custom unit when sensor is added

* Override async_internal_added_to_hass

* Adjust tests after rebase

* Apply suggestions from code review

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* Address review comments

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-03-30 15:43:04 +02:00
Erik Montnemery 61cc8e32f3
Include has_mean + has_sum in statistics metadata WS response (#68546)
* 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
Erik Montnemery b5c5da96ac
Add WS API to adjust incorrect energy statistics (#65147)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-03-22 15:18:30 -07:00
Erik Montnemery cf4033b1bc
Simplify time zone setting in tests (#68330)
* Simplify timezone setting in tests

* Fix typo

* Adjust caldav tests

* Adjust input_datetime tests

* Adjust time_date tests

* Adjust tod tests

* Adjust helper tests

* Adjust recorder tests

* Adjust risco tests

* Adjust aemet tests

* Adjust flux tests

* Adjust forecast_solar tests

* Revert unnecessary change in forecast_solar test

* Adjust climacell tests

* Adjust google tests

* Adjust sensor tests

* Adjust sonarr tests

* Adjust template tests

* Adjust zodiac tests

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-03-20 10:25:15 +01:00
Erik Montnemery 009b31941a
Support restoring SensorEntity native_value (#66068) 2022-02-08 14:00:26 -08:00
Franck Nijhof e242796394
Remove deprecated format for date(time) sensors (#65734) 2022-02-04 23:42:29 -08:00
Erik Montnemery 13abac101b
Drop legacy support for sensor sum statistics (#63884) 2022-01-11 13:59:08 +01:00
Erik Montnemery 3083f059cc
Drop last_reset attribute for non 'total' sensors (#63880)
* Drop last_reset attribute for non 'total' sensors

* Adjust MQTT tests

* Add exception for utility_meter

* Rewrite exception for utility_meter

* Add comment in utility_meter

* Tweak comment
2022-01-11 13:58:35 +01:00
Erik Montnemery 8e8e49d3e7
Add sensor device classes for apparent and reactive power (#62010) 2021-12-23 10:29:38 +01:00
Erik Montnemery 6151bbe5c8
Improve debug log when warning about a dip in total_increasing sensor (#62501) 2021-12-21 17:22:40 +01:00
Erik Montnemery 684c380ce2
Use SensorDeviceClass enum in sensor device automations (#62480) 2021-12-21 14:07:01 +01:00
Ville Skyttä ea58432721
Use DeviceAutomationType in tests/components/[s-z]* (#62450) 2021-12-21 11:56:00 +01:00
Robert Hillis 07532c3153
Use enums in sensor tests (#62152) 2021-12-17 11:07:18 +01:00
Erik Montnemery aa36dde148
Correct rest sensor configured to generate timestamps (#61429) 2021-12-10 09:59:27 -08:00
Erik Montnemery 49a27e12ad
Add support to entity registry for overriding device_class (#59985) 2021-11-22 08:38:06 -08:00
Franck Nijhof 69b7495324
Sensor: Handle local->UTC conversion and reject timezoneless timestamps (#59971) 2021-11-22 17:04:06 +01:00
Franck Nijhof 01efe1eba2
Add datetime object as valid StateType (#52671)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-11-18 14:11:44 +01:00
epenet a3885f4fda
Add frequency device class for sensor (#59700)
Co-authored-by: Hedda <rockerc.harley@gmail.com>
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-11-15 14:33:50 +01:00
Erik Montnemery d1ee041997
Test sensor unit conversion (#59546) 2021-11-11 10:36:53 -08: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 558c2556f1
Report all unrecorded sensors in statistics tool (#58092) 2021-10-20 15:58:28 +02:00
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
Erik Montnemery a5603c0076
Improve warning prints for sensor statistics (#57605) 2021-10-13 08:15:04 -07:00
Erik Montnemery ee98849360
Always include start point for statistics (#57182) 2021-10-12 10:39:36 -07:00
Erik Montnemery ffeb73a4f6
Add statistics tests for sensor with changing device class (#57317) 2021-10-12 09:09:32 -07:00
Erik Montnemery 0139bfa749
Detect if mysql and sqlite support row_number (#57475) 2021-10-11 21:17:18 -07:00
Erik Montnemery 69875cbd11
Improve sensor statistics validation (#56892) 2021-10-04 09:47:44 -07: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
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 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 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 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
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
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
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
Erik Montnemery 7e70252de5
Handle statistics for sensor with changing state class (#55316) 2021-08-27 16:18:49 +02:00