mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Add voltage, power factor and energy returned sensors to Shelly integration (#40681)
This commit is contained in:
parent
b4b056b75b
commit
d1c04750cd
@ -8,6 +8,7 @@ from homeassistant.const import (
|
|||||||
LIGHT_LUX,
|
LIGHT_LUX,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
POWER_WATT,
|
POWER_WATT,
|
||||||
|
VOLT,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .entity import (
|
from .entity import (
|
||||||
@ -53,6 +54,18 @@ SENSORS = {
|
|||||||
value=lambda value: round(value, 1),
|
value=lambda value: round(value, 1),
|
||||||
device_class=sensor.DEVICE_CLASS_POWER,
|
device_class=sensor.DEVICE_CLASS_POWER,
|
||||||
),
|
),
|
||||||
|
("emeter", "voltage"): BlockAttributeDescription(
|
||||||
|
name="Voltage",
|
||||||
|
unit=VOLT,
|
||||||
|
value=lambda value: round(value, 1),
|
||||||
|
device_class=sensor.DEVICE_CLASS_VOLTAGE,
|
||||||
|
),
|
||||||
|
("emeter", "powerFactor"): BlockAttributeDescription(
|
||||||
|
name="Power Factor",
|
||||||
|
unit=PERCENTAGE,
|
||||||
|
value=lambda value: round(value * 100, 1),
|
||||||
|
device_class=sensor.DEVICE_CLASS_POWER_FACTOR,
|
||||||
|
),
|
||||||
("relay", "power"): BlockAttributeDescription(
|
("relay", "power"): BlockAttributeDescription(
|
||||||
name="Power",
|
name="Power",
|
||||||
unit=POWER_WATT,
|
unit=POWER_WATT,
|
||||||
@ -77,6 +90,12 @@ SENSORS = {
|
|||||||
value=lambda value: round(value / 1000, 2),
|
value=lambda value: round(value / 1000, 2),
|
||||||
device_class=sensor.DEVICE_CLASS_ENERGY,
|
device_class=sensor.DEVICE_CLASS_ENERGY,
|
||||||
),
|
),
|
||||||
|
("emeter", "energyReturned"): BlockAttributeDescription(
|
||||||
|
name="Energy Returned",
|
||||||
|
unit=ENERGY_KILO_WATT_HOUR,
|
||||||
|
value=lambda value: round(value / 1000, 2),
|
||||||
|
device_class=sensor.DEVICE_CLASS_ENERGY,
|
||||||
|
),
|
||||||
("light", "energy"): BlockAttributeDescription(
|
("light", "energy"): BlockAttributeDescription(
|
||||||
name="Energy",
|
name="Energy",
|
||||||
unit=ENERGY_KILO_WATT_HOUR,
|
unit=ENERGY_KILO_WATT_HOUR,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user