From 37f959eb02cc83e423ded42252726cd2d2f88110 Mon Sep 17 00:00:00 2001 From: Adam Mills Date: Sun, 16 Apr 2017 18:45:40 -0400 Subject: [PATCH] Add debug logging to automation initial state (#7068) --- homeassistant/components/automation/__init__.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/automation/__init__.py b/homeassistant/components/automation/__init__.py index 66c7c763cc9..5c3d944aad4 100644 --- a/homeassistant/components/automation/__init__.py +++ b/homeassistant/components/automation/__init__.py @@ -263,15 +263,23 @@ class AutomationEntity(ToggleEntity): @asyncio.coroutine def async_added_to_hass(self) -> None: """Startup with initial state or previous state.""" - enable_automation = DEFAULT_INITIAL_STATE - if self._initial_state is not None: enable_automation = self._initial_state + _LOGGER.debug("Automation %s initial state %s from config " + "initial_state", self.entity_id, enable_automation) else: state = yield from async_get_last_state(self.hass, self.entity_id) if state: enable_automation = state.state == STATE_ON self._last_triggered = state.attributes.get('last_triggered') + _LOGGER.debug("Automation %s initial state %s from recorder " + "last state %s", self.entity_id, + enable_automation, state) + else: + enable_automation = DEFAULT_INITIAL_STATE + _LOGGER.debug("Automation %s initial state %s from default " + "initial state", self.entity_id, + enable_automation) if not enable_automation: return