I have a simple automation to turn off a light when the sun is above the horizon. It works fine but the automation to turn it on used the same number of degrees above the horizon and was conflicting with it. I added a condition based on if the time of day was morning or evening to each of the automatons. This fixed the issue, but seem clunky. So… not leaving well enough alone I added the following condition which seems like it should work but doesn’t. What is wrong with it?
Agree. But what I’m trying to do is turn the lights off after the sun has risen above 4 degrees. That works. It’s when I add the condition that the automation doesn’t seem to work. Here’s all of the code.
alias: Turn Lights Off When Sun Comes Up a Bit
description: ''
trigger:
- platform: numeric_state
entity_id: sun.sun
value_template: '{{state.attributes.elevation}}'
above: '4'
below: '6'
condition:
- condition: state
entity_id: sun.sun
state: 'true'
attribute: rising
action:
- type: turn_off
device_id: deviceIDxxxxxxxxxxxxxxxxx
entity_id: light.centralite_4257050_rzhac_7ea52d0b_on_off
domain: light
- type: turn_off
device_id: deviceidxxxxxxxxxxxxxxxxxx
entity_id: light.hallway_main_lights
domain: light
- scene: scene.living_room_all_off
mode: single