home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
70.47k stars 29.41k forks source link

Automation trigger conditions with `for` clause not working #1940

Closed partofthething closed 8 years ago

partofthething commented 8 years ago

Home Assistant release (hass --version): 0.18.2

Python release (python3 --version): Python 3.4.2

Component/platform: Automation

Description of problem: When I have a for clause in my state condition, the state condition is ignored completely. For example, in the automation rule below, this action runs even when group.a_lights is on and has been for a long time. If I take the for clause out, then the action only happens when group.a_lights is off. So it seems the for clause is somehow breaking this condition.

Expected: I would expect the automation rule to not trigger when the group.a_lights state is on.

Problem-relevant configuration.yaml entries and steps to reproduce:

automation:
- alias: Nightlight
  trigger:
    platform: state
    entity_id: sensor.aeotec_multisensor_6_burglar_2
    from: "0"
    to: "8"
  action:
    service: script.turn_on
    entity_id: script.nightlight
  condition:
   - platform: numeric_state
     entity_id: sun.sun
     value_template: '{{ state.attributes.elevation }}'
     below: -12
   - platform: state
     entity_id: group.a_lights
     state: 'off'
     for:
       hours: 0
       minutes: 0
       seconds: 30
balloob commented 8 years ago

All the condition stuff has been rewritten in the latest dev. So could you test it with the latest dev version and see if it still occurs ?

partofthething commented 8 years ago

I tried it on the dev branch and... it works! Ok well then I'll just stay here until the release. Thanks.

CCOSTAN commented 7 years ago

Any way to add support for for with numeric_state? Is there a reason it is only supported with state?