Add operation sensor to Shelly Gas (#48462)

This commit is contained in:
Simone Chemelli 2021-03-31 18:46:39 +02:00 committed by GitHub
parent be71d626c8
commit bb7f64596c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 = {