Add missing voltage sensor in Shelly integration (#56773)

* Disable voltage sensor by default

* Add voltage sensor for Shelly 2/2.5

* Enable emeter voltage by default
pull/56806/head
Maciej Bieniek 2021-09-29 13:22:42 +02:00 committed by GitHub
parent 52e9f76f94
commit d3df6f26f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -83,6 +83,14 @@ SENSORS: Final = {
device_class=sensor.DEVICE_CLASS_POWER,
state_class=sensor.STATE_CLASS_MEASUREMENT,
),
("device", "voltage"): BlockAttributeDescription(
name="Voltage",
unit=ELECTRIC_POTENTIAL_VOLT,
value=lambda value: round(value, 1),
device_class=sensor.DEVICE_CLASS_VOLTAGE,
state_class=sensor.STATE_CLASS_MEASUREMENT,
default_enabled=False,
),
("emeter", "voltage"): BlockAttributeDescription(
name="Voltage",
unit=ELECTRIC_POTENTIAL_VOLT,
@ -247,6 +255,7 @@ RPC_SENSORS: Final = {
value=lambda status, _: round(float(status["voltage"]), 1),
device_class=sensor.DEVICE_CLASS_VOLTAGE,
state_class=sensor.STATE_CLASS_MEASUREMENT,
default_enabled=False,
),
"energy": RpcAttributeDescription(
key="switch",