Does sunset event only work At the moment of sunset or beyond?

Yes, I did mention that NTP could be a hurdle. According to the docs, the polling interval is 60+ seconds (enough of a window to carry out a test). If on Ubuntu, you can simply pause time-syncing, advance the clock to perform the test, then resume time-syncing.

timedatectl set-ntp false
timedatectl set-time 16:30:00
 <perform Home Assistant testing>
timedatectl set-ntp true

This allows you to test the automation as-is, without modifying the trigger’s conditions.

Ok still no go. This is what I using for testing:

trigger:
platform: time
at: ‘20:23:00’
action:
service: light.turn_on
entity_id: switch.leviton_dzs151lz_switch_switch

No errors, but I just picked the service (light turn_on) and not really sure how to test it to make sure it is not the problem.

Ok let me make up an # and see if the editor will work…

be sure you have the right entity_id and also when you post code see the instructions at the top of the page. We need to see your spacing and indenting - critical for YAML!

Why are you putting conditions in that are exactly as per your triggers? That is not required

They are needed and you don’t seem understand what I am doing in the automation

It did not like my unique ID
" Error loading /config/configuration.yaml: while parsing a block collection in “/config/automations.yaml”, line 1, column 1 expected <block end>, but found ‘?’ in “/config/automations.yaml”, line 3, column 1"

Line 3 is just trigger.

- id: '9205477723305'

trigger:
   platform: time
   at: '20:23:00'
action:
   service: light.turn_on
   entity_id: switch.leviton_dzs151lz_switch_switch

Sorry, just re-read it. You want to ‘or’ and ‘and’ your triggers… the light comes on for which ever trigger occurs last. Different.

Your indenting is way off

as to having the right entity_id:

My switch shows up in 2 places. One under zwave and then under switches- where you have manual control from the UI. I am using the one that gives me manual control . Is that wrong?

How should it be? Getting no errors…

Well I want the lights to come on when sun is below 25 as long as it’s after 4pm. So either will trigger the automation but then it needs to check the sun is below 25 and it’s after 4pm. You can’t do ‘or’ on triggers - any trigger will trigger it so the only way to do it is by repeating the triggers as conditions and making sure both are true.

Otherwise in winter my lights come on at 3pm - not what I want when no one is in that room, and in summer, I don’t need them coming on at 4 - 5:30 is a better time…

I moved trigger and action over to the right one space. Still doesn;t like the id:

Error loading /config/configuration.yaml: while parsing a block collection in “/config/automations.yaml”, line 1, column 1 expected <block end>, but found ‘<block mapping start>’ in “/config/automations.yaml”, line 3, column 2

- id: '9205477723305'

 trigger:
   platform: time
   at: '20:23:00'
 action:
   service: light.turn_on
   entity_id: switch.leviton_dzs151lz_switch_switch
- id: '9205477723305' 
  alias: MISSING FOR YOU
  trigger: 
  - platform: time
    at: '20:23:00' 
  action: 
  - service: light.turn_on 
    entity_id: switch.leviton_dzs151lz_switch_switch

you need an alias

Thank you for telling me that as I never saw anything about that being a requirement. Ok just made one up and config ok again. Let me see what happens…

Which is effectively doing an ‘or’ and ‘and’ together. The first trigger (sun elevation) wont work if its not after 4pm, likewise the 4pm (time trigger) wont work if the sun is too high. Both triggers must be in the true state when either is fired. (as you said

, but this IS essentially creating an ‘or’ in your triggers)

Personally I use motion and interior light level as I don’t want to waste power having lights on for no reason. My lights only come on with motion, but only if the room is dark enough to need it, later at night they will come on irrelevant of light level so to ensure they re-trigger on motion even if the light is on which would otherwise make the automation think its too bright to require the light being switched on.

Actually, it will trigger if either trigger is ‘triggered’ but the conditions both have to be met for the action to be executed.
EITHER trigger must be triggered for the conditions to be checked and then as long as the conditions are met the action is executed.

I don’t have any motion sensors. I just worked out 4pm and 25 degrees worked best for me.

Ok it is still not working but I am getting somewhere as now the editor is working for the first time.

I might see the problem
under action type >Call service
under service > light.turn_on
under service data > {}
Where is entity_id:??? I don;t see it in the automations config, but it’s there in the main editor?

that IS creating a setup where the triggers are ‘or’ AND ‘and’ together. I can’t think of the correct logic term for it right now, but its essentially just AND with 2 triggers… (that’s the OR part)

fair enough

try adding “entity_id”:“name of light” in service data - that’s actually the way I have it in my example above. It should work as you have it though.

Actually here is one of mine that turns a switch on…

  action:
  - service: switch.turn_on
    data:
      entity_id: switch.sonoff12914

So you could mimic that in the yaml and reload it and check again…

so

- id: '9205477723305' 
  alias: MISSING FOR YOU
  trigger: 
  - platform: time
    at: '20:23:00' 
  action: 
  - service: light.turn_on 
    data:
      entity_id: switch.leviton_dzs151lz_switch_switch