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
Erik Montnemery
a2e3978d53
Don't normalize units of long term statistics ( #79320 )
...
* Don't normalize units of long term statistics
* Update statistics.py
2022-10-03 21:42:44 +02:00
Erik Montnemery
2de273500e
Remove state_unit_of_measurement from metadata DB table ( #79370 )
...
* Remove state_unit_of_measurement from metadata DB table
* Adjust test
2022-10-01 18:55:00 +02:00
epenet
5389ff3253
Add new weight device class ( #79185 )
2022-09-28 12:13:49 +02:00
Erik Montnemery
9084beda32
Keep storing statistics for sensors which change device class ( #79155 )
2022-09-27 14:33:28 -04:00
epenet
12e4d18038
Add volume to SensorDeviceClass ( #77960 )
...
* Add volume to SensorDeviceClass
* Adjust recorder
* Adjust tests
* Adjust sensor UNIT_CONVERTERS
* Adjust recorder
* Update strings.json
2022-09-27 19:37:52 +02:00
epenet
7c448416e1
Add speed to SensorDeviceClass ( #77953 )
...
* Add speed to SensorDeviceClass
* Adjust recorder
* Adjust tests
* Adjust sensor UNIT_CONVERTERS
* Add tests
* Add websocket tests
* Update strings.json
2022-09-27 17:19:34 +01:00
epenet
bfcc18e5b8
Add distance to SensorDeviceClass ( #77951 )
...
* Add distance to SensorDeviceClass
* Adjust recorder
* Adjust tests
* Adjust recorder
* Update __init__.py
* Update test_websocket_api.py
* Update test_websocket_api.py
* Update test_websocket_api.py
* Update strings.json
* Fix tests
* Adjust docstring
2022-09-27 15:34:00 +01:00
Erik Montnemery
5bcef1c7ce
Indicate in statistics issues when units can be converted ( #79121 )
2022-09-27 13:51:38 +02:00
epenet
c1bc26b413
Finish migration of recorder to unit conversion ( #78985 )
2022-09-25 21:14:18 -04:00
epenet
ddf56baf7a
Move temperature utility to unit_conversion ( #78960 )
2022-09-22 18:31:50 +02:00
epenet
c8491c4404
Move volume utility to unit_conversion ( #78955 )
...
* Move volume utility to unit_conversion
* Split tests
2022-09-22 17:49:45 +02:00
epenet
523d8d246b
Move pressure utility to unit_conversion ( #78953 )
2022-09-22 16:44:09 +02:00
epenet
0767cdd935
Move energy and power utilites to unit_conversion ( #78950 )
...
* Move energy and power utilites to unit_conversion
* Move tests
2022-09-22 15:39:49 +02:00
epenet
6002377d4f
Convert UnitConverter protocol to a class ( #78934 )
...
* Convert UnitConverter protocl to a class
* Remove logic change
* Use TypeVar
* Remove NORMALIZED_UNIT from pressure
* Reduce size of PR
* Reduce some more
* Once more
* Once more
* Remove DEVICE_CLASS
2022-09-22 14:15:22 +02:00
epenet
713fb874a8
Add NORMALISED_UNIT to UnitConverter ( #78920 )
...
* Add NORMALISED_UNIT to UnitConverter
* Adjust statistics
* Rename
2022-09-22 08:50:08 +02:00
epenet
ca78b1a77d
Add new energy utility ( #78883 )
...
* Add new energy utility
* Adjust STATISTIC_UNIT_TO_VALID_UNITS
2022-09-21 19:40:40 +02:00
epenet
d7382aadfe
Add new power utility ( #78867 )
...
* Add power utility
* Fix tests
2022-09-21 14:48:38 +02:00
Erik Montnemery
dd20a7ea62
Display statistics in the source's unit ( #78031 )
2022-09-15 12:01:24 -04:00
epenet
7871a517a8
Import constants from root ( #78271 )
2022-09-12 18:53:05 +02:00
Erik Montnemery
008ac8d10d
Improve statistics metadata WS API ( #77209 )
2022-08-31 11:30:45 +02:00
Franck Nijhof
7adb0f0ef5
Custom component -> Custom integration ( #75404 )
2022-07-18 22:10:22 +02:00
J. Nick Koston
3737b58e85
Avoid fetching metadata multiple times during stat compile ( #70397 )
2022-04-22 00:25:42 -10:00
J. Nick Koston
89807f0d2d
Reduce the number of queries needed to compile statistics ( #69731 )
...
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-04-15 09:13:29 -07:00