From 3492545ec11b6cddc696ec037d553a4afdac5f48 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 20 May 2017 22:34:53 -0700 Subject: [PATCH] Update state automation to work with new and deleted state changes --- homeassistant/components/automation/state.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/automation/state.py b/homeassistant/components/automation/state.py index 9c12a37f9b8..90a8f2adce4 100644 --- a/homeassistant/components/automation/state.py +++ b/homeassistant/components/automation/state.py @@ -80,7 +80,8 @@ def async_trigger(hass, config, action): return # If only state attributes changed, ignore this event - if from_s.last_changed == to_s.last_changed: + if (from_s is not None and to_s is not None and + from_s.last_changed == to_s.last_changed): return @callback