cooljimy84
(James Crook)
1
So i can’t believe this is the first time this has got me, but my automation didn’t fire as my light led_uplighter was marked as unavailable.
- alias: 'Turn LEDUpLighter on when the sun get dim and someone is in the frontroom'
initial_state: 'on'
trigger:
- platform: numeric_state
entity_id: sun.sun
value_template: '{{ state.attributes.elevation }}'
below: 2.0
- platform: numeric_state
entity_id: sensor.esp4_ldr
above: 65
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
- condition: state
entity_id: input_boolean.frontroom_occupancy
state: 'on'
- condition: numeric_state
entity_id: sensor.esp1_ldr
above: 140
- condition: state
entity_id: light.led_uplighter
state: 'off'
- condition: time
after: '06:30:00'
before: '22:00:00'
So can i say the state of the uplighter is “off” or “unavailable” ? that way it will still trigger if the light is off the wifi.
lolouk44
(lolouk44)
2
you could say state is not on?
- condition: template
value_template: "{{ not is_state('light.led_uplighter', 'on') }}"
@lolouk44 's solution is more foolproof for your scenario I think, but for future reference you can nest the OR like this…
- alias: 'Turn LEDUpLighter on when the sun get dim and someone is in the frontroom'
initial_state: 'on'
trigger:
- platform: numeric_state
entity_id: sun.sun
value_template: '{{ state.attributes.elevation }}'
below: 2.0
- platform: numeric_state
entity_id: sensor.esp4_ldr
above: 65
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.guest_mode
state: 'off'
- condition: state
entity_id: input_boolean.frontroom_occupancy
state: 'on'
- condition: numeric_state
entity_id: sensor.esp1_ldr
above: 140
- condition: or
conditions:
- condition: state
entity_id: light.led_uplighter
state: 'off'
- condition: state
entity_id: light.led_uplighter
state: 'unavailable'
- condition: time
after: '06:30:00'
before: '22:00:00'
1 Like
cooljimy84
(James Crook)
4
Perfect !, But yes saying not on would be better.
It’s editing in nano, it makes my eyes hurt for trying to line everything up right.