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
Franck Nijhof
cd3819abec
Add state attribute translations for Sensor ( #89896 )
2023-03-17 20:32:52 -04:00
J. Nick Koston
f6f3565796
Reduce latency to find stats metadata ( #89824 )
2023-03-16 19:00:02 -10:00
Franck Nijhof
f9919bb7cf
Add pre-defined entity name translations ( #89792 )
2023-03-16 21:10:20 +01:00
Franck Nijhof
f32b7859b8
Restructure translations for entity components ( #89702 )
2023-03-16 12:16:08 +01:00
J. Nick Koston
a6d6807dd0
Add typing to statistics results ( #89118 )
2023-03-14 09:06:56 -10:00
Jan Bouwhuis
8968ed1c47
Fix check on non numeric custom sensor device classes ( #89052 )
...
* Custom device classes are not numeric
* Update homeassistant/components/sensor/__init__.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Add test
* Update homeassistant/components/sensor/__init__.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
---------
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-03-02 14:20:26 -05:00
Erik Montnemery
fca5cc6ea3
Add number + sensor device class volume storage ( #88312 )
...
* Add number + sensor device class volume storage
* Fix typo
* Format code
* Update device automations
2023-03-01 11:22:57 +01:00
Erik Montnemery
69ce6980d6
Add number + sensor device class energy storage ( #88310 )
...
* Add number + sensor device class energy storage
* Format code
* Update device automations
2023-02-28 19:35:43 +01:00
Erik Montnemery
390daf1723
Sort unit lists sent to frontend ( #88898 )
2023-02-28 16:12:49 +01:00
Erik Montnemery
fe8f3602ff
Fix sensor unit conversion bug ( #88825 )
...
* Fix sensor unit conversion bug
* Ensure the correct unit is stored in the entity registry
2023-02-27 11:46:55 +01:00
avee87
1519a78567
Fix log message in recorder on total_increasing reset ( #88710 )
2023-02-25 12:05:24 +01:00
epenet
488d78571e
Add missing device class triggers ( #88316 )
...
* Add constant tests for sensor device classes
* Add missing strings
* Adjust tests
* Add missing conditions
* Add missing trigger
* Cleanup
2023-02-20 08:30:51 +01:00
Erik Montnemery
f0b7343993
Change state class of weight sensors from total to measurement ( #88314 )
2023-02-18 13:26:53 +01:00
epenet
dfdd279add
Fix incorrect condition for atmospheric_pressure ( #88320 )
2023-02-17 14:00:32 +01:00
Gertjan
66ba0cb1d3
Fixed float number validation in sensor component ( #88074 )
2023-02-15 15:53:44 +01:00
epenet
ccf44d58cc
Expose DEVICE_CLASS_STATE_CLASSES sensor constant ( #88172 )
2023-02-15 14:48:27 +01:00
Erik Montnemery
8f2a764a43
Adjust suggested_display_precision according to unit conversion ( #87614 )
2023-02-13 13:55:12 +01:00
Erik Montnemery
3f910b49ae
Fix sensor unit conversion ( #87978 )
2023-02-13 10:08:07 +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
Erik Montnemery
2d2ff19949
Round value in state_with_unit template function ( #87619 )
2023-02-09 12:54:59 +01:00
Erik Montnemery
23fa500406
Sort manifests 9 ( #87030 )
2023-02-08 20:22:30 +01:00
Marc Mueller
ea4e2ab4aa
Add Self typing (4) [mypy 1.0] ( #87601 )
2023-02-06 22:30:22 -06: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
Erik Montnemery
bcc1aa03b4
Move sensor rounding to frontend ( #87330 )
...
* Move sensor rounding to frontend
* Update integrations
* Add comment
2023-02-04 14:54:36 -05:00
Franck Nijhof
bf482eee24
Extend state class sensor warnings with expected values ( #87294 )
2023-02-04 11:49:24 +01:00
Erik Montnemery
4d4fb2477d
Optionally update sensor units when unit system is changed ( #83851 )
2023-02-03 16:30:50 +01: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
Jan Bouwhuis
d8bba6747e
Address late review on readability sensor code ( #87111 )
...
* Improve readability _numeric_state_expected
* Update homeassistant/components/sensor/__init__.py
2023-02-02 20:22:33 +01:00
epenet
cc469ab9a9
Add unit conversion to Power sensors ( #87136 )
...
* Add missing PowerConverter to UNIT_CONVERTERS
* Adjust tests
2023-02-02 10:27:12 +01:00
GitHub Action
0f80932709
[ci skip] Translation update
2023-02-02 00:25:01 +00:00
Jan Bouwhuis
2e16b7e2df
Add numeric_state_expected property to Sensor class ( #87013 )
...
* Add is_numeric property to Sensor class
* Follw up comment
* Update homeassistant/components/sensor/__init__.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Update homeassistant/components/sensor/__init__.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Tests and corrections
* Simplify converion check
* Correct custom device class handling
* Update homeassistant/components/sensor/__init__.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* rename to numeric_state_expected
* Replace with new const
* Adjust docstr
* Update homeassistant/components/sensor/__init__.py
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
* Move to const
* Correct logic
* Do not use bool
* Adjust docstr must be numeric
* remote state from docstr
* protect numeric_state_expected
* Use try_parse_enum for custom class check
* Remove redundant type hints
---------
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2023-02-01 18:45:13 +01:00
epenet
1225c5e97d
Add enum util ( #87082 )
...
* Add enum helper
* docstring
* Move to util
* Add use case
2023-02-01 15:00:27 +01:00
Franck Nijhof
4dba9c09fc
Only report invalid numeric value for sensors once ( #87010 )
2023-01-31 12:44:18 +01:00
Franck Nijhof
1edd00c51f
Allow any state class when using the precipitation device class ( #86977 )
2023-01-30 22:43:23 +01:00
Erik Montnemery
d4489faa68
Drop minus sign on negative zero ( #86939 )
...
* Drop minus sign on negative zero
* Add tests
2023-01-30 08:31:27 -05:00
Franck Nijhof
7ed9967245
Fix state classes for duration device class ( #86727 )
2023-01-26 17:26:52 +01:00
Joakim Plate
1b97a51b5e
Print expected device class units in error log ( #86125 )
2023-01-25 20:45:50 +01:00
SgtBatten
0ccab19d2c
Add Mega Joule as valid unit of energy ( #86055 )
...
* Add Mega joule
* Reorder valid energy types
Alphabetical
* Add Mega Joule
* Add Mega Joule as valid energy unit
* Add Mega Joule
* Add Mega Joule as a Unit of Measurement to Energy
* Update tests
* Update tests
* Update number docstring
Co-authored-by: Roving Ronin <108674933+Roving-Ronin@users.noreply.github.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-01-25 14:13:42 +01:00
Erik Montnemery
f327a247a0
Allow a temperature sensor to be in K ( #86073 )
2023-01-25 11:47:52 +01:00
Erik Montnemery
086a6460ef
Allow customizing sensor state precision ( #86074 )
...
* Allow customizing sensor precision
* Don't convert integer strings to floats
* Tweak converting sensor state to number
* Drop default rounding to 2 decimals
* Adjust test
* Tweak rounding, improve test coverage
* Don't convert to a number if not necessary
* Raise if native_precision is set and state is not numeric
* Address review comments
* Address comments, simplify
* Don't call property twice
* Make exception more helpful
2023-01-25 08:55:46 +01:00
GitHub Action
d1ecc418bb
[ci skip] Translation update
2023-01-19 00:25:04 +00:00
Erik Montnemery
14a32cd63b
Allow converting units of additional sensor device classes ( #86072 )
2023-01-17 09:35:53 +01:00
epenet
83591704b5
Adjust sensor validation warning ( #86017 )
2023-01-16 15:48:00 +01:00
Franck Nijhof
0a367359f4
Add sensor state class validation for device classes ( #84402 )
...
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-01-16 14:31:24 +01:00
epenet
3179101fbc
Warn if numeric sensors have an invalid value ( #85863 )
...
Co-authored-by: mib1185 <mail@mib85.de>
2023-01-16 11:00:07 +01:00
GitHub Action
77f9548e51
[ci skip] Translation update
2023-01-15 00:25:52 +00:00