Erik Montnemery
c87415023c
Correct cleanup of sensor statistics repairs ( #127826 )
2024-10-08 09:39:21 +02:00
Erik Montnemery
6d65d6bcf6
Don't create statistics issues when sensor is unavailable or unknown ( #127226 )
2024-10-01 22:08:48 +02:00
Erik Montnemery
495faf5033
Improve statistics issue title ( #126851 )
2024-09-27 18:32:20 +02:00
Erik Montnemery
771575cfc5
Make statistics validation create issue registry issues ( #122595 )
...
* Make statistics validation create issue registry issues
* Disable creating issue about outdated MariaDB version in tests
* Use call_soon_threadsafe instead of run_callback_threadsafe
* Update tests
* Fix flapping test
* Disable creating issue about outdated SQLite version in tests
* Implement agreed changes
* Add translation strings for issue titles
* Update test
2024-09-25 11:11:11 +02:00
epenet
a58b1ca6e4
Use HassKey in sensor ( #126336 )
2024-09-21 11:36:03 +02:00
J. Nick Koston
902d76da36
Small cleanup to normalize states ( #124614 )
...
- Remove duplicate state_unit lookup
- Use undefined instead of object
2024-08-27 11:17:34 +02:00
J. Nick Koston
242aae514e
Small cleanups to list_statistic_ids ( #124451 )
2024-08-25 18:32:32 +02:00
Sid
3142f52a79
Add Ruff refurb rules ( #121701 )
2024-07-10 21:47:40 +02:00
J. Nick Koston
9082dc2a79
Reduce recorder overhead when entity filter is empty ( #119631 )
2024-06-14 08:43:51 +02:00
Sid
3799d20d43
Enable Ruff B905 ( #114197 )
2024-04-14 00:14:26 -05:00
Marc Mueller
2decf6c023
Use dict instead of MutableMapping [recorder] ( #115318 )
2024-04-09 15:08:31 -10:00
Marc Mueller
930a396712
Add empty line after module docstring [s] ( #112704 )
2024-03-08 14:33:51 +01:00
Marc Mueller
545b888034
Update ruff to 0.2.1 ( #109796 )
...
* Update ruff to 0.2.1
* Rename config sections
* Update remapped error codes
* Add ignores
2024-02-06 15:41:34 +01:00
J. Nick Koston
3db0331378
Avoid converting to same units when compiling stats ( #109531 )
2024-02-04 15:21:05 +01:00
Joakim Plate
eefc6cd50a
Correct flow rate conversion review after merge ( #109501 )
2024-02-04 15:01:06 +01:00
J. Nick Koston
7d9935d24b
Reduce overhead to convert history to float states ( #109526 )
2024-02-04 11:37:14 +01:00
J. Nick Koston
50edc334de
Refactor sensor recorder _get_sensor_states to check for state class first ( #107046 )
...
The state class check is cheap and the entity filter check is much
more expensive, so do the state class check first
2024-01-07 22:36:03 -05:00
Marc Mueller
a70ec64408
Update mypy to 1.7.0 ( #103800 )
2023-11-11 23:31:04 +01:00
J. Nick Koston
c6ed022cce
Fix compiling missing statistics losing rows ( #101616 )
2023-10-08 19:43:00 +02:00
Erik Montnemery
659d437cac
Use loader.async_suggest_report_issue in sensor ( #101389 )
2023-10-05 20:07:56 +02:00
Erik Montnemery
df73850f56
Move definition of attributes excluded from history to entity classes ( #100430 )
...
* Move definition of attributes excluded from history to entity classes
* Revert change which should be in a follow-up PR
* Fix sun unrecorded attributes
* Fix input_select unrecorded attributes
2023-09-21 15:02:47 +02:00
Erik Montnemery
51576b7214
Improve typing of entity.entity_sources ( #99407 )
...
* Improve typing of entity.entity_sources
* Calculate entity info source when generating WS response
* Adjust typing
* Update tests
2023-09-12 20:41:26 +02:00
Erik Montnemery
e1f0b44ba4
Use math.isfinite instead of explicitly checking for both nan and inf ( #98103 )
2023-08-09 14:13:57 +02:00
J. Nick Koston
3f9d5a0192
Use the converter factory in sensor.recorder._normalize_states ( #95785 )
...
We have a factory to create converters now which avoids
the overhead of calling convert to create the converter
every time
2023-07-03 14:20:23 -04:00
J. Nick Koston
bb4c03ce3c
Avoid returning statistics columns that the metadata knows are impossible ( #92095 )
2023-04-30 20:46:26 +02:00
J. Nick Koston
88ad97f112
Fix generating statistics for time periods smaller than we can measure ( #90069 )
...
If the time period for the mean/time weighted average was smaller
than we can measure (less than one microsecond), generating
statistics would fail with a divide by zero error. This is likely
only happens if the database schema precision is incorrect.
2023-03-21 21:12:45 -04:00
J. Nick Koston
5ffb233004
Avoid database executor job to fetch statistic metadata on cache hit ( #89960 )
...
* Avoid database executor job to fetch statistic metadata on cache hit
Since we will almost always have a cache hit fetching
statistic meta data we can avoid an executor job
* Avoid database executor job to fetch statistic metadata on cache hit
Since we will almost always have a cache hit fetching
statistic meta data we can avoid an executor job
* Avoid database executor job to fetch statistic metadata on cache hit
Since we will almost always have a cache hit fetching
statistic meta data we can avoid an executor job
* remove exception catch since the threading.excepthook will actually catch this in production
* fix a few missed ones
* threadsafe
* Update homeassistant/components/recorder/table_managers/statistics_meta.py
* coverage and optimistic caching
2023-03-19 22:01:16 -04:00
J. Nick Koston
f6f3565796
Reduce latency to find stats metadata ( #89824 )
2023-03-16 19:00:02 -10:00
J. Nick Koston
a6d6807dd0
Add typing to statistics results ( #89118 )
2023-03-14 09:06:56 -10:00
avee87
1519a78567
Fix log message in recorder on total_increasing reset ( #88710 )
2023-02-25 12:05:24 +01:00
J. Nick Koston
b054296c42
Speed up selecting which statistics to compile ( #87938 )
2023-02-12 18:15:27 +01:00
J. Nick Koston
85649ec589
Reduce overhead to see if an entity is recorded ( #87912 )
...
A significant chunk of list_statistic_ids was checking if the entity
was recorded because it had to get the recorder instance over and
over
2023-02-11 23:21:16 -05:00
J. Nick Koston
c35661947a
Optimize fetching statistics by avoiding timestamp conversions ( #87845 )
...
* Optimize fetching statistics by avoiding timestamp conversions
* remove accidential unrelated change
* fix test
* recreate so we handle timezone changes
2023-02-10 11:26:46 -05:00
epenet
810367b757
Fix can not
typo ( #87254 )
2023-02-03 11:37:16 +01:00
Erik Montnemery
91668f8599
Use SensorStateClass enum in sensor ( #87066 )
...
* Use SensorStateClass enum in sensor
* Apply suggestions from code review
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Update homeassistant/components/sensor/recorder.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
---------
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-03 10:49:41 +01:00
Erik Montnemery
b0d4b73874
Add unitless unit converter ( #85694 )
...
* Add unitless unit converter
* Adjust type hints
* Adjust tests
* Rename to UnitlessRatioConverter
2023-01-12 09:20:00 +01:00
Franck Nijhof
cf5fca0464
Code styling tweaks to core entity components ( #85460 )
2023-01-08 13:40:08 -10: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
epenet
96c442349f
Introduce unit enums for sound pressure ( #83450 )
...
* Introduce unit enums for sound pressure
* Adjust based on architecture comment
* Adjust
2022-12-08 20:06:02 +01:00
epenet
90438edc17
Introduce unit enums for irradiance ( #83414 )
2022-12-08 18:41:38 +01:00
Franck Nijhof
ce00f093d6
Add enum device_class and state options property to sensor entities ( #82489 )
2022-12-02 09:11:15 +01:00
Erik Montnemery
607a0e7697
Reduce size of get_statistics_during_period WS API response ( #82131 )
2022-11-16 17:36:30 +01:00
Erik Montnemery
3d3349240f
Don't trigger statistics issues when sensor units are equivalent ( #80099 )
2022-10-25 09:50:01 +02:00
Erik Montnemery
577f7904b5
Minor improvements of recorder typing ( #80165 )
...
* Minor improvements of recorder typing
* Only allow specifying statistic_ids as lists
2022-10-12 14:59:10 +02:00
Erik Montnemery
a391b8dd9d
Support correcting sensor volume unit ( #80081 )
2022-10-11 13:51:28 +02:00
Erik Montnemery
c52b900bfe
Minor cleanup of sensor statistics ( #80082 )
2022-10-11 12:24:52 +02:00
Erik Montnemery
69d935b7bd
Teach long term statistics that unit 'rpm' is same as 'RPM' ( #80012 )
...
* Teach long term statistics that unit 'rpm' is same as 'RPM'
* Add tests
2022-10-11 10:32:01 +02:00
Erik Montnemery
aa5575ba65
Only validate sensors in sensor.recorder.validate_statistics ( #79749 )
2022-10-06 21:17:46 +02:00
Erik Montnemery
0a59d37e62
Correct how unit used for statistics is determined ( #79725 )
2022-10-06 14:01:54 -04:00
Erik Montnemery
e93deaa8aa
Simplify long term statistics by always supporting unit conversion ( #79557 )
2022-10-03 21:50:05 -04:00