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
GitHub Action
dffc913f9e
[ci skip] Translation update
2023-01-14 00:22:57 +00:00
Erik Montnemery
305fb86d50
Add WS command sensor/device_class_convertible_units ( #85213 )
...
* Add WS command sensor/device_class_units
* Rename new command to device_class_convertible_units
2023-01-12 09:31:06 +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
epenet
9eb06fd59d
Simplify sensor state validation ( #85513 )
2023-01-10 11:52:29 +01:00
Erik Montnemery
54168c9bdb
Allow converting units of energy sensors ( #85497 )
2023-01-09 12:26:35 +01:00
Franck Nijhof
cf5fca0464
Code styling tweaks to core entity components ( #85460 )
2023-01-08 13:40:08 -10:00
Erik Montnemery
c1075ebb8c
Allow SensorDeviceClass.POWER_FACTOR unit None ( #85181 )
2023-01-05 11:03:37 +01:00
Erik Montnemery
8a0fb21988
Clarify SensorDeviceClass.PRECIPITATION docstring ( #85045 )
2023-01-03 11:30:03 +01:00
Franck Nijhof
6ecf2e8c71
Move sensor constants and define public names from this module ( #84973 )
2023-01-02 16:00:50 +01:00
GitHub Action
d12857c68c
[ci skip] Translation update
2022-12-31 00:22:33 +00:00
Franck Nijhof
f8fa676ac8
Do not validate device classes when entity state is unknown ( #84860 )
2022-12-30 13:07:49 -05:00
SukramJ
005bc8994d
Add mA to SensorDeviceClass.CURRENT units ( #84492 )
...
fixes undefined
2022-12-30 13:55:14 +01:00
Jan Bouwhuis
b2388b74d9
Add mV as a unit for voltage and enable conversions ( #84805 )
...
fixes undefined
2022-12-30 12:51:05 +01:00
epenet
6261994fcf
Enable unit conversion for DATA_SIZE ( #84699 )
2022-12-29 09:58:15 +01:00
epenet
46e02ebaff
Enable unit conversion for DATA_RATE ( #84698 )
2022-12-28 21:49:00 +01:00
GitHub Action
cc27986cac
[ci skip] Translation update
2022-12-28 00:22:40 +00:00
epenet
4c8e3aa7c4
Remove lumen from Illuminance units ( #84386 )
2022-12-27 14:25:47 +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
Franck Nijhof
c832982d94
Add sensor unit of measurement validation for device classes ( #84366 )
2022-12-21 16:14:11 +01:00
epenet
9a488cf250
Use unit enums in energy and sensor ( #84343 )
2022-12-21 10:49:51 +01:00
epenet
f4c13645d2
Add support for CCF volume unit ( #84029 )
2022-12-19 14:57:04 +01:00
GitHub Action
cfa08c5229
[ci skip] Translation update
2022-12-15 00:24:38 +00:00
GitHub Action
b9753a9f92
[ci skip] Translation update
2022-12-13 00:27:47 +00:00
GitHub Action
f19a1147fe
[ci skip] Translation update
2022-12-11 00:26:24 +00:00
SukramJ
e53758c1bb
Add missing CONF_SPEED to sensor device_trigger SCHEMA ( #83679 )
...
* Update device_trigger.py
* add missing CONF_IS_SPEED to device_condition
2022-12-09 21:18:47 -05:00
GitHub Action
1e0345a377
[ci skip] Translation update
2022-12-10 00:21:35 +00:00
epenet
b172abaeeb
Add new atmospheric pressure device class ( #83455 )
...
* Add new atmospheric pressure device class
* Translations
* Automatic conversion
* Convert all pressure units
2022-12-09 08:02:53 +01:00
GitHub Action
f25017313a
[ci skip] Translation update
2022-12-09 00:24:29 +00: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