Fixed bugs to allow HA to boot again

1) helpers/event should not import the sun component unless it is
requested. This prevents circular import.
2) fixed import typo in bootstrap
2) bootstrap cannot import event_decorators until it is needed because
this leads to a circular import.
This commit is contained in:
Ryan Kraus 2016-01-24 15:55:47 -05:00
parent 0f937cad74
commit 02e634c6a2
2 changed files with 3 additions and 2 deletions

View File

@ -24,7 +24,6 @@ import homeassistant.config as config_util
import homeassistant.loader as loader
import homeassistant.components as core_components
import homeassistant.components.group as group
from homeassistnat.helpers import event_decorators
from homeassistant.helpers.entity import Entity
from homeassistant.const import (
__version__, EVENT_COMPONENT_LOADED, CONF_LATITUDE, CONF_LONGITUDE,
@ -205,6 +204,7 @@ def from_config_dict(config, hass=None, config_dir=None, enable_log=True,
_setup_component(hass, domain, config)
# activate event decorators
from homeassistant.helpers import event_decorators
event_decorators.activate(hass)
return hass

View File

@ -7,7 +7,6 @@ import functools as ft
from ..util import dt as dt_util
from ..const import (
ATTR_NOW, EVENT_STATE_CHANGED, EVENT_TIME_CHANGED, MATCH_ALL)
from homeassistant.components import sun
def track_state_change(hass, entity_ids, action, from_state=None,
@ -101,6 +100,7 @@ def track_sunrise(hass, action, offset=None):
"""
Adds a listener that will fire a specified offset from sunrise daily.
"""
from homeassistant.components import sun
offset = offset or timedelta()
def next_rise():
@ -124,6 +124,7 @@ def track_sunset(hass, action, offset=None):
"""
Adds a listener that will fire a specified offset from sunset daily.
"""
from homeassistant.components import sun
offset = offset or timedelta()
def next_set():