Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix trigger state with multible entities #10857

Merged
merged 17 commits into from
Nov 30, 2017
Prev Previous commit
Next Next commit
fix name
  • Loading branch information
pvizeli authored Nov 29, 2017
commit 97408a4c2a92cea3e2e6c74abcd051ad56529397
8 changes: 4 additions & 4 deletions homeassistant/components/automation/numeric_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def async_trigger(hass, config, action):
time_delta = config.get(CONF_FOR)
value_template = config.get(CONF_VALUE_TEMPLATE)
unsub_track_same = {}
entity_triggered = set()
entities_triggered = set()

if value_template is not None:
value_template.hass = hass
Expand Down Expand Up @@ -79,16 +79,16 @@ def call_action():

matching = check_numeric_state(entity, from_s, to_s)

if matching entity not in entity_triggered:
if matching and entity not in entities_triggered:
if time_delta:
unsub_track_same[entity] = async_track_same_state(
hass, time_delta, call_action, entity_ids=entity_id,
async_check_same_func=check_numeric_state)
else:
call_action()
entity_triggered.add(entity)
entities_triggered.add(entity)

entity_triggered.discard(entity)
entities_triggered.discard(entity)

unsub = async_track_state_change(
hass, entity_id, state_automation_listener)
Expand Down