mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 06:17:07 +00:00
Add device id to deconz_event (#43552)
This commit is contained in:
parent
a4f7b7d784
commit
ffe0c1cd58
@ -1,7 +1,7 @@
|
|||||||
"""Representation of a deCONZ remote."""
|
"""Representation of a deCONZ remote."""
|
||||||
from pydeconz.sensor import Switch
|
from pydeconz.sensor import Switch
|
||||||
|
|
||||||
from homeassistant.const import CONF_EVENT, CONF_ID, CONF_UNIQUE_ID
|
from homeassistant.const import CONF_DEVICE_ID, CONF_EVENT, CONF_ID, CONF_UNIQUE_ID
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.util import slugify
|
from homeassistant.util import slugify
|
||||||
@ -94,6 +94,9 @@ class DeconzEvent(DeconzBase):
|
|||||||
CONF_EVENT: self._device.state,
|
CONF_EVENT: self._device.state,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.device_id:
|
||||||
|
data[CONF_DEVICE_ID] = self.device_id
|
||||||
|
|
||||||
if self._device.gesture is not None:
|
if self._device.gesture is not None:
|
||||||
data[CONF_GESTURE] = self._device.gesture
|
data[CONF_GESTURE] = self._device.gesture
|
||||||
|
|
||||||
|
@ -77,6 +77,7 @@ async def test_deconz_events(hass):
|
|||||||
"id": "switch_1",
|
"id": "switch_1",
|
||||||
"unique_id": "00:00:00:00:00:00:00:01",
|
"unique_id": "00:00:00:00:00:00:00:01",
|
||||||
"event": 2000,
|
"event": 2000,
|
||||||
|
"device_id": gateway.events[0].device_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
gateway.api.sensors["3"].update({"state": {"buttonevent": 2000}})
|
gateway.api.sensors["3"].update({"state": {"buttonevent": 2000}})
|
||||||
@ -88,6 +89,7 @@ async def test_deconz_events(hass):
|
|||||||
"unique_id": "00:00:00:00:00:00:00:03",
|
"unique_id": "00:00:00:00:00:00:00:03",
|
||||||
"event": 2000,
|
"event": 2000,
|
||||||
"gesture": 1,
|
"gesture": 1,
|
||||||
|
"device_id": gateway.events[2].device_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
gateway.api.sensors["4"].update({"state": {"gesture": 0}})
|
gateway.api.sensors["4"].update({"state": {"gesture": 0}})
|
||||||
@ -99,6 +101,7 @@ async def test_deconz_events(hass):
|
|||||||
"unique_id": "00:00:00:00:00:00:00:04",
|
"unique_id": "00:00:00:00:00:00:00:04",
|
||||||
"event": 1000,
|
"event": 1000,
|
||||||
"gesture": 0,
|
"gesture": 0,
|
||||||
|
"device_id": gateway.events[3].device_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
gateway.api.sensors["5"].update(
|
gateway.api.sensors["5"].update(
|
||||||
@ -113,6 +116,7 @@ async def test_deconz_events(hass):
|
|||||||
"event": 6002,
|
"event": 6002,
|
||||||
"angle": 110,
|
"angle": 110,
|
||||||
"xy": [0.5982, 0.3897],
|
"xy": [0.5982, 0.3897],
|
||||||
|
"device_id": gateway.events[4].device_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
await hass.config_entries.async_unload(config_entry.entry_id)
|
await hass.config_entries.async_unload(config_entry.entry_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user