mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 03:37:07 +00:00
Fix issue with automation event data after YAML conversion.
No need to convert to dict using json.loads when PyYAML will do that automatically.
This commit is contained in:
parent
c3c07d621a
commit
bb858fdddc
@ -5,8 +5,6 @@ homeassistant.components.automation.event
|
|||||||
Offers event listening automation rules.
|
Offers event listening automation rules.
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
import json
|
|
||||||
from homeassistant.util import convert
|
|
||||||
|
|
||||||
CONF_EVENT_TYPE = "event_type"
|
CONF_EVENT_TYPE = "event_type"
|
||||||
CONF_EVENT_DATA = "event_data"
|
CONF_EVENT_DATA = "event_data"
|
||||||
@ -22,7 +20,7 @@ def register(hass, config, action):
|
|||||||
_LOGGER.error("Missing configuration key %s", CONF_EVENT_TYPE)
|
_LOGGER.error("Missing configuration key %s", CONF_EVENT_TYPE)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
event_data = convert(config.get(CONF_EVENT_DATA), json.loads, {})
|
event_data = config.get(CONF_EVENT_DATA, {})
|
||||||
|
|
||||||
def handle_event(event):
|
def handle_event(event):
|
||||||
""" Listens for events and calls the action when data matches. """
|
""" Listens for events and calls the action when data matches. """
|
||||||
|
Loading…
x
Reference in New Issue
Block a user