mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Use SensorDeviceClass.ENUM
and add state attributes translations in Shelly integration (#89660)
This commit is contained in:
parent
54ad8b8ee9
commit
dea29f539f
@ -91,6 +91,7 @@ SENSORS: Final = {
|
|||||||
key="sensor|gas",
|
key="sensor|gas",
|
||||||
name="Gas",
|
name="Gas",
|
||||||
device_class=BinarySensorDeviceClass.GAS,
|
device_class=BinarySensorDeviceClass.GAS,
|
||||||
|
translation_key="gas",
|
||||||
value=lambda value: value in ["mild", "heavy"],
|
value=lambda value: value in ["mild", "heavy"],
|
||||||
extra_state_attributes=lambda block: {"detected": block.gas},
|
extra_state_attributes=lambda block: {"detected": block.gas},
|
||||||
),
|
),
|
||||||
|
@ -295,6 +295,9 @@ SENSORS: Final = {
|
|||||||
("sensor", "sensorOp"): BlockSensorDescription(
|
("sensor", "sensorOp"): BlockSensorDescription(
|
||||||
key="sensor|sensorOp",
|
key="sensor|sensorOp",
|
||||||
name="Operation",
|
name="Operation",
|
||||||
|
device_class=SensorDeviceClass.ENUM,
|
||||||
|
options=["unknown", "warmup", "normal", "fault"],
|
||||||
|
translation_key="operation",
|
||||||
icon="mdi:cog-transfer",
|
icon="mdi:cog-transfer",
|
||||||
value=lambda value: value,
|
value=lambda value: value,
|
||||||
extra_state_attributes=lambda block: {"self_test": block.selfTest},
|
extra_state_attributes=lambda block: {"self_test": block.selfTest},
|
||||||
|
@ -81,5 +81,42 @@
|
|||||||
"passive": "Passive"
|
"passive": "Passive"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"entity": {
|
||||||
|
"binary_sensor": {
|
||||||
|
"gas": {
|
||||||
|
"state_attributes": {
|
||||||
|
"detected": {
|
||||||
|
"state": {
|
||||||
|
"unknown": "Unknown",
|
||||||
|
"none": "None",
|
||||||
|
"mild": "Mild",
|
||||||
|
"heavy": "Heavy",
|
||||||
|
"test": "Test"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sensor": {
|
||||||
|
"operation": {
|
||||||
|
"state": {
|
||||||
|
"unknown": "Unknown",
|
||||||
|
"warmup": "Warm-up",
|
||||||
|
"normal": "normal",
|
||||||
|
"fault": "Fault"
|
||||||
|
},
|
||||||
|
"state_attributes": {
|
||||||
|
"self_test": {
|
||||||
|
"state": {
|
||||||
|
"not_completed": "Not completed",
|
||||||
|
"completed": "Completed",
|
||||||
|
"running": "Running",
|
||||||
|
"pending": "Pending"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user