Commit graph

79 commits

Author SHA1 Message Date
epenet
0e1c76f81f
Improve sensor type hints in integrations (#90031)
* Improve sensor type hints in integrations

* Improve
2023-03-21 11:39:42 +01:00
Thomas Dietrich
ee8f746808
Change statistics component ownership (#88692) 2023-02-24 08:11:40 -05:00
epenet
ccf44d58cc
Expose DEVICE_CLASS_STATE_CLASSES sensor constant (#88172) 2023-02-15 14:48:27 +01:00
epenet
443d446cbf
Remove invalid pragma: no cover (#88173) 2023-02-15 14:39:12 +01:00
Thomas Dietrich
a0e0feb444
Statistics component fix device_class for incremental source sensors (#88096)
* Return None device_class for incremental source sensors

* Ignore linting error

* Fix ignore linting error

* Fix ignore linting error

* Fix ignore linting error

* Catch potential parsing error with enum
2023-02-15 10:22:09 +01:00
Erik Montnemery
23fa500406
Sort manifests 9 (#87030) 2023-02-08 20:22:30 +01:00
Franck Nijhof
939eef3b28
Remove translations from Core (#87543)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-02-06 15:06:43 +01:00
GitHub Action
dffc913f9e [ci skip] Translation update 2023-01-14 00:22:57 +00:00
Franck Nijhof
f39f3b612a
String formatting and max line length - Part 5 (#84501)
Co-authored-by: jjlawren <jjlawren@users.noreply.github.com>
2022-12-23 16:43:17 +01:00
GitHub Action
1e0345a377 [ci skip] Translation update 2022-12-10 00:21:35 +00:00
GitHub Action
1f3e5fb4fc [ci skip] Translation update 2022-12-07 00:24:08 +00:00
GitHub Action
197e71203b [ci skip] Translation update 2022-11-30 00:26:16 +00:00
GitHub Action
fe5246fb6f [ci skip] Translation update 2022-11-19 00:26:11 +00:00
Thomas Dietrich
ad8b882cb6
Switch statistics config to require either/both 'max_age' and 'sampling_size' (#80999)
* Remove default characteristic

* Remove default sampling_size

* Fix typo

* Fix typo
2022-11-17 10:31:06 +01:00
Thomas Dietrich
a0b0e4088c
Replace quantiles by percentile characteristic for statistics component (#81027)
* Remove quantiles characteristic

* Add percentile characteristic
2022-11-14 09:23:02 +01:00
GitHub Action
c7fc51cfa5 [ci skip] Translation update 2022-11-04 00:29:52 +00:00
GitHub Action
0bca9a614c [ci skip] Translation update 2022-11-01 00:33:48 +00:00
GitHub Action
1c7800c224 [ci skip] Translation update 2022-10-30 00:32:36 +00:00
GitHub Action
4b5de420ed [ci skip] Translation update 2022-10-29 00:24:41 +00:00
GitHub Action
f399385147 [ci skip] Translation update 2022-10-28 00:30:47 +00:00
GitHub Action
ce1b56e345 [ci skip] Translation update 2022-10-27 00:30:06 +00:00
GitHub Action
d0ff6582e6 [ci skip] Translation update 2022-10-26 00:29:57 +00:00
Thomas Dietrich
a98c304db6
Add deprecation warning for statistics integration default buffer_size (#69700)
* Add deprecation warning for buffer size

* Attend to comments

* Clarify deprecation info

* Move warnings to repairs issue_registry

* Apply slight wording changes, add compiled en strings file

* Format json
2022-10-25 20:50:52 +02:00
Thomas Dietrich
3346ddcd86
Add sum-differences characteristics to statistics component (#79439) 2022-10-25 16:46:47 +02:00
epenet
3a5b66fd60
Use percentage constant in components (#80173) 2022-10-12 15:02:47 +02:00
eyager1
6f8ba7ee2f
Add empty string to list of invalid states (#72590)
Add null state to list of invalid states
2022-05-31 00:32:52 +02:00
Thomas Dietrich
f2d6a06a6a
Add additional characteristics to the statistics integration (#62631)
* Improve config checking, add device_class timestamp

* Improve warning message
2022-05-04 15:57:56 +02:00
Thomas Dietrich
9fdec407e0
Provide statistics device_class based on source entity and characteristic (#69710) 2022-04-26 12:12:47 -10:00
Marc Mueller
97af164858
Prepare for upcoming mypy update (#70800) 2022-04-26 07:41:52 -07:00
J. Nick Koston
5c7c09726a
Cleanup recorder history typing (#69408) 2022-04-07 00:09:05 -10:00
Erik Montnemery
ae9c2df691
Return unsubscribe callback from start.async_at_start (#69083)
* Return unsubscribe callback from start.async_at_start

* Update calling code
2022-04-01 23:34:36 +02:00
J. Nick Koston
8cf6ac281e
Convert statistics to use history api for database access (#68411) 2022-04-01 08:49:21 -07:00
J. Nick Koston
b284eddc63
Fix statistics doing I/O in the event loop (#68315) 2022-03-18 00:49:11 -10:00
J. Nick Koston
9215702388
Separate attrs into another table (reduces database size) (#68224) 2022-03-18 00:23:13 -10:00
Thomas Dietrich
dc15c9ed75
Add SensorDeviceClass to statistics component, improve structures (#62629)
* Improve config checking, add device_class timestamp

* Move additional characteristics into separate branch

* Move deprecation warning for sampling_size default to other branch

* Add supports list description
2022-01-04 10:25:37 +01:00
Sebastian Lövdahl
53f4a3d8bc
Use Platform constants all over the place 3/3 (#62954) 2021-12-28 21:24:27 +01:00
Thomas Dietrich
0b8cf47613
Add secondary codeowner to statistics integration (#62622) 2021-12-22 10:22:57 -10:00
Thomas Dietrich
28af0b4092
Statistics component typing (#60997)
* Implement optional manually defined uniqueid

* Fix test case via mocked environment

* Add typing to statistics component

* Fix minor inconsistency

* Fix linter issues

* Execute hassfest

* Fix stricter mypy warnings

* Fix maxsplit warning

* Make binary value range explicit check

* Add basic typing to statistics tests

* Add empty config testcase

* Minor improvements

* Improve after comments

* Remove unnecessary test case

* Fix changed type

* Remove dict.get default
2021-12-20 14:53:51 +01:00
Robert Hillis
af631b90e5
Use enums in statistics tests (#62191) 2021-12-18 14:54:26 +01:00
Franck Nijhof
73c880b6c2
Fix typo in state_characteristic warning (#60990) 2021-12-04 07:52:42 -05:00
Thomas Dietrich
6d6e0dd8bf
Add unique_id to the statistics component (#59205)
* Implement optional manually defined uniqueid

* Fix test case via mocked environment
2021-12-04 09:50:47 +01:00
Paulus Schoutsen
2fe48702f3
Fix statistics registering at start callback (#60963) 2021-12-04 09:17:13 +01:00
Thomas Dietrich
bee3c9102c
Add binary characteristics, add deprecation warning for optional state_characteristic parameter (#60402)
* Add binary source sensor statistics

* Make state_characteristic a required parameter

* Move binary unitless testcase

* Add testcases for binary characteristics

* Revert charact. to optional with deprecation warning

* Correctly check for binary supported characteristic
2021-12-02 09:03:24 +01:00
Thomas Dietrich
4c0d90ed41
Remove unknown attribute instead of marking STATE_UNKNOWN (#60325) 2021-11-25 15:13:55 +01:00
Thomas Dietrich
fd8b43320d
Replace returned STATE_UNKNOWN by None (#60324) 2021-11-25 12:09:30 +01:00
Thomas Dietrich
b8f4b76194
Add additional statistics characteristics, remove attributes (#59867)
* Add additional statistics characterics, improve rounding

* Improve name of age_usage_ratio

* Replace difference by three relevant distances

* Refactor attributes, remove stats, add metadata

* Fix binary sensor testcase

* Fix sensor defaults testcase

* Fix and enhance all testcases

* Remove age coverage from attr when not configured

* Refactor so only the relevant characteristic value is calculated

* Rename unclear characteristics, add timebound average

* Fix coverage warning

* Remove explicit functions dict
2021-11-24 13:42:44 +01:00
Thomas Dietrich
0ab3b10aed
Allow selection of statistics state characteristic (#49960)
* Make statistics state characteristic selectable

* Move computation in helper function

* Add relevant config elements for clarity

* Rename variables for better readability

* Avoid reserved prefix ATTR_ for stats

* Fix NoneType base_unit error

* Add testcases for statistics characteristic

* Add testcases for state_class, unitless, and characteristics

* Add testcase coverage for no unit with binary

* Replace error catching by an exception

* Attend to review comments
2021-11-17 12:31:32 +01:00
Thomas Dietrich
90ee1f4783
Add available property to statistics component (#59203)
* Add available property to the statistics component

* Add test for statistics sensor availability

* Clean up availability check

* Improve statistics source sensor tests

* Revert variable rename

* Improve comments
2021-11-11 17:16:59 +01:00
Thomas Dietrich
9eaf8bd21b
Fix statistics precision handling (#59202)
* Fix statistics precision error when configured 0, fix #42547

* Add tests for statistics precision

* Apply precision=0 logic to float numbers only

* Implement contextlib way of exception handling
2021-11-08 23:26:00 +01:00
Thomas Dietrich
2924f4605b
Fix statistics startup error for None value states (#59199)
* Catch statistics startup error for None value states, fix #49254

* Add test for statistics None handling

* Update tests/components/statistics/test_sensor.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Switch test case logic to remove sensor last

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-11-08 23:25:19 +01:00