Fix a config bug in Automation

This commit is contained in:
Paulus Schoutsen 2015-03-14 19:13:03 -07:00
parent 633d0453be
commit 948a5c97ec
2 changed files with 4 additions and 5 deletions

View File

@ -101,7 +101,8 @@ automation 2:
time_seconds: 0 time_seconds: 0
execute_service: notify.notify execute_service: notify.notify
service_data: {"message":"It's 4, time for beer!"} service_data:
message: It's 4, time for beer!
sensor: sensor:
platform: systemmonitor platform: systemmonitor

View File

@ -5,11 +5,10 @@ homeassistant.components.automation
Allows to setup simple automation rules via the config file. Allows to setup simple automation rules via the config file.
""" """
import logging import logging
import json
from homeassistant.loader import get_component from homeassistant.loader import get_component
from homeassistant.helpers import config_per_platform from homeassistant.helpers import config_per_platform
from homeassistant.util import convert, split_entity_id from homeassistant.util import split_entity_id
from homeassistant.const import ATTR_ENTITY_ID from homeassistant.const import ATTR_ENTITY_ID
DOMAIN = "automation" DOMAIN = "automation"
@ -54,8 +53,7 @@ def _get_action(hass, config):
if CONF_SERVICE in config: if CONF_SERVICE in config:
domain, service = split_entity_id(config[CONF_SERVICE]) domain, service = split_entity_id(config[CONF_SERVICE])
service_data = convert( service_data = config.get(CONF_SERVICE_DATA, {})
config.get(CONF_SERVICE_DATA), json.loads, {})
if not isinstance(service_data, dict): if not isinstance(service_data, dict):
_LOGGER.error( _LOGGER.error(