Deprecate Shelly state attributes (#140791)

This commit is contained in:
Simone Chemelli 2025-03-18 16:29:21 +01:00 committed by GitHub
parent 4176776d70
commit a170e32852
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 0 deletions

View File

@ -130,6 +130,7 @@ SENSORS: dict[tuple[str, str], BlockBinarySensorDescription] = {
device_class=BinarySensorDeviceClass.GAS, device_class=BinarySensorDeviceClass.GAS,
translation_key="gas", translation_key="gas",
value=lambda value: value in ["mild", "heavy"], value=lambda value: value in ["mild", "heavy"],
# Deprecated, remove in 2025.10
extra_state_attributes=lambda block: {"detected": block.gas}, extra_state_attributes=lambda block: {"detected": block.gas},
), ),
("sensor", "smoke"): BlockBinarySensorDescription( ("sensor", "smoke"): BlockBinarySensorDescription(

View File

@ -358,6 +358,7 @@ SENSORS: dict[tuple[str, str], BlockSensorDescription] = {
translation_key="lamp_life", translation_key="lamp_life",
value=get_shelly_air_lamp_life, value=get_shelly_air_lamp_life,
suggested_display_precision=1, suggested_display_precision=1,
# Deprecated, remove in 2025.10
extra_state_attributes=lambda block: { extra_state_attributes=lambda block: {
"Operational hours": round(cast(int, block.totalWorkTime) / 3600, 1) "Operational hours": round(cast(int, block.totalWorkTime) / 3600, 1)
}, },
@ -378,6 +379,7 @@ SENSORS: dict[tuple[str, str], BlockSensorDescription] = {
options=["warmup", "normal", "fault"], options=["warmup", "normal", "fault"],
translation_key="operation", translation_key="operation",
value=lambda value: None if value == "unknown" else value, value=lambda value: None if value == "unknown" else value,
# Deprecated, remove in 2025.10
extra_state_attributes=lambda block: {"self_test": block.selfTest}, extra_state_attributes=lambda block: {"self_test": block.selfTest},
), ),
("valve", "valve"): BlockSensorDescription( ("valve", "valve"): BlockSensorDescription(