mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Log warning if number entities set _attr_unit_of_measurement (#74987)
This commit is contained in:
parent
01ca7f657c
commit
924dce1b86
@ -192,9 +192,10 @@ class NumberEntity(Entity):
|
||||
entity_description: NumberEntityDescription
|
||||
_attr_max_value: None
|
||||
_attr_min_value: None
|
||||
_attr_mode: NumberMode = NumberMode.AUTO
|
||||
_attr_state: None = None
|
||||
_attr_step: None
|
||||
_attr_mode: NumberMode = NumberMode.AUTO
|
||||
_attr_unit_of_measurement: None # Subclasses of NumberEntity should not set this
|
||||
_attr_value: None
|
||||
_attr_native_max_value: float
|
||||
_attr_native_min_value: float
|
||||
@ -369,6 +370,7 @@ class NumberEntity(Entity):
|
||||
return self._number_option_unit_of_measurement
|
||||
|
||||
if hasattr(self, "_attr_unit_of_measurement"):
|
||||
self._report_deprecated_number_entity()
|
||||
return self._attr_unit_of_measurement
|
||||
if (
|
||||
hasattr(self, "entity_description")
|
||||
|
@ -521,7 +521,7 @@ class TimerDurationMinutes(ZHANumberConfigurationEntity, id_suffix="timer_durati
|
||||
_attr_icon: str = ICONS[14]
|
||||
_attr_native_min_value: float = 0x00
|
||||
_attr_native_max_value: float = 0x257
|
||||
_attr_unit_of_measurement: str | None = UNITS[72]
|
||||
_attr_native_unit_of_measurement: str | None = UNITS[72]
|
||||
_zcl_attribute: str = "timer_duration"
|
||||
|
||||
|
||||
@ -533,5 +533,5 @@ class FilterLifeTime(ZHANumberConfigurationEntity, id_suffix="filter_life_time")
|
||||
_attr_icon: str = ICONS[14]
|
||||
_attr_native_min_value: float = 0x00
|
||||
_attr_native_max_value: float = 0xFFFFFFFF
|
||||
_attr_unit_of_measurement: str | None = UNITS[72]
|
||||
_attr_native_unit_of_measurement: str | None = UNITS[72]
|
||||
_zcl_attribute: str = "filter_life_time"
|
||||
|
Loading…
x
Reference in New Issue
Block a user