G Johansson
9546bf1dee
Use shorthand attribute for native value in statistics ( #129355 )
2024-10-28 22:43:09 +01:00
G Johansson
73f2d972e4
Use shorthand attribute for available in statistics ( #129354 )
2024-10-28 21:01:34 +01:00
G Johansson
7d699c6c35
Fix calculation of attributes in statistics ( #128475 )
...
* Fix calculation of attributes in statistics
* Cleanup
* Mods
* Fix device class
* Typing
* Mod uom calc
* Fix UoM
* Fix docstrings
* state class docstring
2024-10-28 19:45:47 +01:00
unfug-at-github
50ccce7387
React to state report events to increase sample size of statistics ( #129211 )
...
* react to state reported events to increase sample size
* added test case for timinig and minor corrections
2024-10-28 14:41:48 +01:00
unfug-at-github
c5ed148c52
Fix race condition in statistics that created spikes ( #129066 )
...
* fixed race condition and added test case for updates before db load
* removed duplicated code
* improved comments, removed superfluous errors / assertions
* allow both possible outcomes of race condition
* use approx for float comparison
* Update tests/components/statistics/test_sensor.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* force new state before database load in race condition test
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-10-26 09:23:47 +02:00
unfug-at-github
9ec4881d8d
Have statistics functions return a meaningful, non-none result even if only one value is available ( #127305 )
...
* have statistics functions return a meaningful, non-none result even if only one value is available
* improved code coverage
2024-10-23 16:02:46 +02:00
G Johansson
80582a128a
Fix preview available in statistics ( #127349 )
2024-10-03 22:27:01 +02:00
G Johansson
2ff88e7baf
Add preview to statistics ( #122590 )
2024-09-27 21:09:42 +02:00
dougiteixeira
4437c4a204
Link the Statistics helper entity to the source entity device ( #120705 )
2024-06-28 12:22:24 +02:00
G Johansson
3d5d4f8ddb
Add config flow to statistics ( #120496 )
2024-06-26 16:06:35 +02:00
Marc Mueller
3559755aed
Add import aliases for PLATFORM_SCHEMA ( #120445 )
2024-06-25 19:16:19 +02:00
J. Nick Koston
c8e6292cb7
Refactor statistics to avoid creating tasks ( #116743 )
2024-05-05 16:39:45 -04:00
Sid
3799d20d43
Enable Ruff B905 ( #114197 )
2024-04-14 00:14:26 -05:00
Sid
0d66d298ec
Enable Ruff RET504 ( #114528 )
...
* Enable Ruff RET504
* fix test
* Use noqa instead of cast
* fix sonos RET504
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-04-06 11:07:37 +02:00
Marc Mueller
0f03079065
Update import for EventStateChangedData [i-z] ( #114900 )
2024-04-04 11:48:29 -10:00
Joost Lekkerkerker
6bb4e7d62c
Bump ruff to 0.3.4 ( #112690 )
...
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
Marc Mueller
84c44c1835
Replace EventType with Event [l-s] ( #112741 )
2024-03-08 19:37:18 +01:00
Marc Mueller
cb8c14496c
Use more f-strings [ruff] ( #112695 )
2024-03-08 18:44:42 +01:00
Marc Mueller
930a396712
Add empty line after module docstring [s] ( #112704 )
2024-03-08 14:33:51 +01:00
Brenan Kelley
458c5ae657
Add statistics keep_last_sample option ( #88655 )
...
* introduce preserve last value option
* improve comments
* add unit test
* skip scheduling purge on a preserved value
* do not schedule sensor update if preserving last value
* fix unit test to use new mock time pattern
pattern introduced in https://github.com/home-assistant/core/pull/93499
* rename preserve_last_val to keep_last_sample
* add keep_last_sample config validation
2024-02-27 13:17:05 +01:00
Joost Lekkerkerker
730d805876
Enable SIM114 ruff rule ( #111125 )
2024-02-23 13:21:59 +01:00
enzo2
35be5957c3
Add circular mean to statistics integration ( #98930 )
...
* Add circular mean
Add support for circular mean for sensors in units of degrees, e.g. direction data.
* Update test_sensor.py
* Update sensor.py
* Remove whitespace
* Revert to degC
* Fix: shift atan2 output to positive degrees
* Add new dedicated test
* Simplify test
2023-10-07 13:51:27 +02:00
Erik Montnemery
d1afcd773f
Revert "Cache entity properties that are never expected to change in the base class" ( #100422 )
...
Revert "Cache entity properties that are never expected to change in the base class (#95315 )"
This reverts commit 042776ebb8
.
2023-09-15 11:25:24 +02:00
J. Nick Koston
042776ebb8
Cache entity properties that are never expected to change in the base class ( #95315 )
2023-09-14 17:48:48 -05:00
Marc Mueller
8c870a5683
Use EventType for state changed [m-z] ( #97118 )
2023-07-24 08:07:07 +02:00
epenet
0e1c76f81f
Improve sensor type hints in integrations ( #90031 )
...
* Improve sensor type hints in integrations
* Improve
2023-03-21 11:39:42 +01: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
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
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
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
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