I have one automation that seems to trigger and meet its conditions EVERY time I restart HA. But I have an almost identical one that doesn’t. Can anyone offer a suggestion as to why this might be? Interestingly it does not happen when I reload, Groups or Automations.
This one always triggers and always meets the conditions
- alias: Hall light on at dusk
trigger:
- platform: numeric_state
entity_id: sun.sun
value_template: '{{ state.attributes.elevation }}'
below: 5.0
condition :
- condition: numeric_state
entity_id: sun.sun
value_template: '{{ state.attributes.elevation }}'
below: 5.0
- condition: time
before: "23:00:00"
action:
# delay a random amount of time between 1 and 2 minutes
- delay: '00:01:{{ (range(0, 59)|random|int) }}'
- service: homeassistant.turn_on
entity_id: switch.hall_light
This one doesn’t:
- alias: Dining room light on at dusk if someone is home
trigger:
- platform: template
value_template: '{{states.group.family_presence.state == "home"}}'
- platform: numeric_state
entity_id: sun.sun
value_template: '{{ state.attributes.elevation }}'
below: 5.0
condition:
condition: and
conditions:
- condition: state
entity_id: group.family_presence
state: "home"
- condition: numeric_state
entity_id: sun.sun
value_template: '{{ state.attributes.elevation }}'
below: 5.0
- condition: time
before: "23:00:00"
- condition: time
after: "12:00:00"
action:
service: homeassistant.turn_on
entity_id: switch.dining_room_light
I also have this:
- alias: check lights at startup
trigger:
platform: homeassistant
event: start
action:
entity_id: automation.hall_light_on_at_dusk
- service: automation.trigger
entity_id: automation.dining_room_light_on_at_dusk
- service: automation.trigger