mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Fix impulse events, added error event for Homegear (#7349)
* Fix impulse event, added error event * Requested changes
This commit is contained in:
parent
8ba7e61ed6
commit
fafd0d4e4c
@ -42,9 +42,12 @@ ATTR_NAME = 'name'
|
|||||||
ATTR_ADDRESS = 'address'
|
ATTR_ADDRESS = 'address'
|
||||||
ATTR_VALUE = 'value'
|
ATTR_VALUE = 'value'
|
||||||
ATTR_PROXY = 'proxy'
|
ATTR_PROXY = 'proxy'
|
||||||
|
ATTR_ERRORCODE = 'error'
|
||||||
|
ATTR_MESSAGE = 'message'
|
||||||
|
|
||||||
EVENT_KEYPRESS = 'homematic.keypress'
|
EVENT_KEYPRESS = 'homematic.keypress'
|
||||||
EVENT_IMPULSE = 'homematic.impulse'
|
EVENT_IMPULSE = 'homematic.impulse'
|
||||||
|
EVENT_ERROR = 'homematic.error'
|
||||||
|
|
||||||
SERVICE_VIRTUALKEY = 'virtualkey'
|
SERVICE_VIRTUALKEY = 'virtualkey'
|
||||||
SERVICE_RECONNECT = 'reconnect'
|
SERVICE_RECONNECT = 'reconnect'
|
||||||
@ -447,6 +450,14 @@ def _system_callback_handler(hass, config, src, *args):
|
|||||||
ATTR_DISCOVER_DEVICES: found_devices
|
ATTR_DISCOVER_DEVICES: found_devices
|
||||||
}, config)
|
}, config)
|
||||||
|
|
||||||
|
elif src == 'error':
|
||||||
|
_LOGGER.debug("Error: %s", args)
|
||||||
|
(interface_id, errorcode, message) = args
|
||||||
|
hass.bus.fire(EVENT_ERROR, {
|
||||||
|
ATTR_ERRORCODE: errorcode,
|
||||||
|
ATTR_MESSAGE: message
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
def _get_devices(hass, discovery_type, keys, proxy):
|
def _get_devices(hass, discovery_type, keys, proxy):
|
||||||
"""Get the Homematic devices for given discovery_type."""
|
"""Get the Homematic devices for given discovery_type."""
|
||||||
@ -544,19 +555,19 @@ def _hm_event_handler(hass, proxy, device, caller, attribute, value):
|
|||||||
|
|
||||||
# keypress event
|
# keypress event
|
||||||
if attribute in HM_PRESS_EVENTS:
|
if attribute in HM_PRESS_EVENTS:
|
||||||
hass.add_job(hass.bus.async_fire(EVENT_KEYPRESS, {
|
hass.bus.fire(EVENT_KEYPRESS, {
|
||||||
ATTR_NAME: hmdevice.NAME,
|
ATTR_NAME: hmdevice.NAME,
|
||||||
ATTR_PARAM: attribute,
|
ATTR_PARAM: attribute,
|
||||||
ATTR_CHANNEL: channel
|
ATTR_CHANNEL: channel
|
||||||
}))
|
})
|
||||||
return
|
return
|
||||||
|
|
||||||
# impulse event
|
# impulse event
|
||||||
if attribute in HM_IMPULSE_EVENTS:
|
if attribute in HM_IMPULSE_EVENTS:
|
||||||
hass.add_job(hass.bus.async_fire(EVENT_KEYPRESS, {
|
hass.bus.fire(EVENT_IMPULSE, {
|
||||||
ATTR_NAME: hmdevice.NAME,
|
ATTR_NAME: hmdevice.NAME,
|
||||||
ATTR_CHANNEL: channel
|
ATTR_CHANNEL: channel
|
||||||
}))
|
})
|
||||||
return
|
return
|
||||||
|
|
||||||
_LOGGER.warning("Event is unknown and not forwarded")
|
_LOGGER.warning("Event is unknown and not forwarded")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user