mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
bugfix: set_state updated state if not changed
This commit is contained in:
parent
6ce393856a
commit
7c15e24d09
@ -379,8 +379,6 @@ class StateMachine(object):
|
|||||||
|
|
||||||
attributes = attributes or {}
|
attributes = attributes or {}
|
||||||
|
|
||||||
state = State(new_state, attributes)
|
|
||||||
|
|
||||||
with self.lock:
|
with self.lock:
|
||||||
# Change state and fire listeners
|
# Change state and fire listeners
|
||||||
try:
|
try:
|
||||||
@ -388,7 +386,7 @@ class StateMachine(object):
|
|||||||
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# If state did not exist yet
|
# If state did not exist yet
|
||||||
pass
|
self.states[entity_id] = State(new_state, attributes)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if old_state.state != new_state or \
|
if old_state.state != new_state or \
|
||||||
@ -399,7 +397,7 @@ class StateMachine(object):
|
|||||||
'old_state': old_state,
|
'old_state': old_state,
|
||||||
'new_state': 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):
|
def get_state(self, entity_id):
|
||||||
""" Returns a dict (state, last_changed, attributes) describing
|
""" Returns a dict (state, last_changed, attributes) describing
|
||||||
|
Loading…
x
Reference in New Issue
Block a user