deCONZ - Add power attribute for consumption sensors (#25512)
* Add power attribute for consumption sensors * Bump dependency to v62pull/25540/head
parent
3672a5f881
commit
da53e0a836
|
@ -4,7 +4,7 @@
|
|||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/components/deconz",
|
||||
"requirements": [
|
||||
"pydeconz==60"
|
||||
"pydeconz==62"
|
||||
],
|
||||
"ssdp": {
|
||||
"manufacturer": [
|
||||
|
|
|
@ -12,6 +12,7 @@ from .deconz_device import DeconzDevice
|
|||
from .gateway import get_gateway_from_config_entry
|
||||
|
||||
ATTR_CURRENT = 'current'
|
||||
ATTR_POWER = 'power'
|
||||
ATTR_DAYLIGHT = 'daylight'
|
||||
ATTR_EVENT_ID = 'event_id'
|
||||
|
||||
|
@ -104,6 +105,9 @@ class DeconzSensor(DeconzDevice):
|
|||
attr[ATTR_CURRENT] = self._device.current
|
||||
attr[ATTR_VOLTAGE] = self._device.voltage
|
||||
|
||||
if self.unit_of_measurement == 'kWh':
|
||||
attr[ATTR_POWER] = self._device.power
|
||||
|
||||
if self._device.SENSOR_CLASS == 'daylight':
|
||||
attr[ATTR_DAYLIGHT] = self._device.daylight
|
||||
|
||||
|
|
|
@ -1096,7 +1096,7 @@ pydaikin==1.6.1
|
|||
pydanfossair==0.1.0
|
||||
|
||||
# homeassistant.components.deconz
|
||||
pydeconz==60
|
||||
pydeconz==62
|
||||
|
||||
# homeassistant.components.delijn
|
||||
pydelijn==0.5.1
|
||||
|
|
|
@ -251,7 +251,7 @@ pyMetno==0.4.6
|
|||
pyblackbird==0.5
|
||||
|
||||
# homeassistant.components.deconz
|
||||
pydeconz==60
|
||||
pydeconz==62
|
||||
|
||||
# homeassistant.components.zwave
|
||||
pydispatcher==2.0.5
|
||||
|
|
|
@ -63,6 +63,13 @@ SENSOR = {
|
|||
"type": "ZHAPower",
|
||||
"state": {"current": 2, "power": 6, "voltage": 3},
|
||||
"config": {"reachable": True}
|
||||
},
|
||||
"8": {
|
||||
"id": "Sensor 8 id",
|
||||
"name": "Sensor 8 name",
|
||||
"type": "ZHAConsumption",
|
||||
"state": {"consumption": 2, "power": 6},
|
||||
"config": {"reachable": True}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,7 +137,7 @@ async def test_sensors(hass):
|
|||
assert "sensor.sensor_3_name_battery_level" not in gateway.deconz_ids
|
||||
assert "sensor.sensor_4_name" not in gateway.deconz_ids
|
||||
assert "sensor.sensor_4_name_battery_level" in gateway.deconz_ids
|
||||
assert len(hass.states.async_all()) == 5
|
||||
assert len(hass.states.async_all()) == 6
|
||||
|
||||
gateway.api.sensors['1'].async_update({'state': {'on': False}})
|
||||
gateway.api.sensors['4'].async_update({'config': {'battery': 75}})
|
||||
|
|
Loading…
Reference in New Issue