From 7c15e24d098e13ee6898a292f5182684b1a41411 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 22 Jan 2014 10:04:52 -0800 Subject: [PATCH] bugfix: set_state updated state if not changed --- homeassistant/__init__.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/homeassistant/__init__.py b/homeassistant/__init__.py index 8b15f8aab43..600bfa02db2 100644 --- a/homeassistant/__init__.py +++ b/homeassistant/__init__.py @@ -379,8 +379,6 @@ class StateMachine(object): attributes = attributes or {} - state = State(new_state, attributes) - with self.lock: # Change state and fire listeners try: @@ -388,7 +386,7 @@ class StateMachine(object): except KeyError: # If state did not exist yet - pass + self.states[entity_id] = State(new_state, attributes) else: if old_state.state != new_state or \ @@ -399,7 +397,7 @@ class StateMachine(object): 'old_state': old_state, 'new_state': state}) - self.states[entity_id] = State(new_state, attributes) + self.states[entity_id] = State(new_state, attributes) def get_state(self, entity_id): """ Returns a dict (state, last_changed, attributes) describing