mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 02:37:08 +00:00
fix bug in event handling and add cast for watersensor
This commit is contained in:
parent
d0b1619946
commit
d326d187d1
@ -288,15 +288,19 @@ def setup_hmdevice_discovery_helper(hmdevicetype, discovery_info,
|
|||||||
|
|
||||||
def _hm_event_handler(hass, device, caller, attribute, value):
|
def _hm_event_handler(hass, device, caller, attribute, value):
|
||||||
"""Handle all pyhomematic device events."""
|
"""Handle all pyhomematic device events."""
|
||||||
channel = device.split(":")[1]
|
try:
|
||||||
|
channel = int(device.split(":")[1])
|
||||||
address = device.split(":")[0]
|
address = device.split(":")[0]
|
||||||
hmdevice = HOMEMATIC.devices.get(address)
|
hmdevice = HOMEMATIC.devices.get(address)
|
||||||
|
except (TypeError, ValueError):
|
||||||
|
_LOGGER.error("Event handling channel convert error!")
|
||||||
|
return
|
||||||
|
|
||||||
# is not a event?
|
# is not a event?
|
||||||
if attribute not in hmdevice.EVENTNODE:
|
if attribute not in hmdevice.EVENTNODE:
|
||||||
return
|
return
|
||||||
|
|
||||||
_LOGGER.debug("Event %s for %s channel %s", attribute,
|
_LOGGER.debug("Event %s for %s channel %i", attribute,
|
||||||
hmdevice.NAME, channel)
|
hmdevice.NAME, channel)
|
||||||
|
|
||||||
# a keypress event
|
# a keypress event
|
||||||
|
@ -17,7 +17,8 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
DEPENDENCIES = ['homematic']
|
DEPENDENCIES = ['homematic']
|
||||||
|
|
||||||
HM_STATE_HA_CAST = {
|
HM_STATE_HA_CAST = {
|
||||||
"RotaryHandleSensor": {0: "closed", 1: "tilted", 2: "open"}
|
"RotaryHandleSensor": {0: "closed", 1: "tilted", 2: "open"},
|
||||||
|
"WaterSensor": {0: "dry", 1: "wet", 2: "water"}
|
||||||
}
|
}
|
||||||
|
|
||||||
HM_UNIT_HA_CAST = {
|
HM_UNIT_HA_CAST = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user