Prefix all xiaomi_aqara events (#17354)

This commit is contained in:
Sebastian Muszynski 2018-11-19 20:55:08 +01:00 committed by GitHub
parent f86083cf52
commit 14ad7428ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -209,7 +209,7 @@ class XiaomiMotionSensor(XiaomiBinarySensor):
else: else:
self._should_poll = True self._should_poll = True
if self.entity_id is not None: if self.entity_id is not None:
self._hass.bus.fire('motion', { self._hass.bus.fire('xiaomi_aqara.motion', {
'entity_id': self.entity_id 'entity_id': self.entity_id
}) })
@ -417,7 +417,7 @@ class XiaomiButton(XiaomiBinarySensor):
_LOGGER.warning("Unsupported click_type detected: %s", value) _LOGGER.warning("Unsupported click_type detected: %s", value)
return False return False
self._hass.bus.fire('click', { self._hass.bus.fire('xiaomi_aqara.click', {
'entity_id': self.entity_id, 'entity_id': self.entity_id,
'click_type': click_type 'click_type': click_type
}) })
@ -453,14 +453,14 @@ class XiaomiCube(XiaomiBinarySensor):
def parse_data(self, data, raw_data): def parse_data(self, data, raw_data):
"""Parse data sent by gateway.""" """Parse data sent by gateway."""
if self._data_key in data: if self._data_key in data:
self._hass.bus.fire('cube_action', { self._hass.bus.fire('xiaomi_aqara.cube_action', {
'entity_id': self.entity_id, 'entity_id': self.entity_id,
'action_type': data[self._data_key] 'action_type': data[self._data_key]
}) })
self._last_action = data[self._data_key] self._last_action = data[self._data_key]
if 'rotate' in data: if 'rotate' in data:
self._hass.bus.fire('cube_action', { self._hass.bus.fire('xiaomi_aqara.cube_action', {
'entity_id': self.entity_id, 'entity_id': self.entity_id,
'action_type': 'rotate', 'action_type': 'rotate',
'action_value': float(data['rotate'].replace(",", ".")) 'action_value': float(data['rotate'].replace(",", "."))