From bb7f64596cd361a24193dd3df90fc1d05e2aaf9c Mon Sep 17 00:00:00 2001 From: Simone Chemelli Date: Wed, 31 Mar 2021 18:46:39 +0200 Subject: [PATCH] Add operation sensor to Shelly Gas (#48462) --- homeassistant/components/shelly/sensor.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/shelly/sensor.py b/homeassistant/components/shelly/sensor.py index 9e24034bf83..b6d3bc2dbff 100644 --- a/homeassistant/components/shelly/sensor.py +++ b/homeassistant/components/shelly/sensor.py @@ -128,10 +128,7 @@ SENSORS = { ("sensor", "concentration"): BlockAttributeDescription( name="Gas Concentration", unit=CONCENTRATION_PARTS_PER_MILLION, - value=lambda value: value, icon="mdi:gauge", - # "sensorOp" is "normal" when the Shelly Gas is working properly and taking measurements. - available=lambda block: block.sensorOp == "normal", ), ("sensor", "extTemp"): BlockAttributeDescription( name="Temperature", @@ -170,6 +167,12 @@ SENSORS = { value=lambda value: round(value, 1), device_class=sensor.DEVICE_CLASS_VOLTAGE, ), + ("sensor", "sensorOp"): BlockAttributeDescription( + name="Operation", + icon="mdi:cog-transfer", + value=lambda value: value, + extra_state_attributes=lambda block: {"self_test": block.selfTest}, + ), } REST_SENSORS = {