(Newbie problem!) Switch light on at sunset and off at 11PM (23:00)

This has got to be so trivial - but the light stubbornly remains off:

Using the Automations UI:

  1. Trigger set to sunset.
  2. Condition - Time set to before 23:00
  3. Action - switch light on.
    This renders in YAML to:
- id: '1592063073391'
  alias: Fireside Light On at Sunset
  description: ''
  trigger:
  - event: sunset
    platform: sun
  condition:
  - before: '23:00'
    condition: time
  action:
  - data:
      effect: colorjump
    entity_id: light.d8f15bb1d0be_192_168_1_19olo
    service: light.turn_on

(Iā€™ve set the bulb IP address as static in my router)
Iā€™d be grateful for some help, please?
Jim

Is the automation enabled (on). Check the developer tools / states menu.

Are you aware that this will only turn on at sunset? It will not turn on ANY other time? For some reason, I get the impression that you expect it to turn on anytime between sunset and 11pm.

1 Like

To add to what Petro saidā€¦

It also wonā€™t switch back off at 23:00 either. You will need either another automation to do that or some ā€œfancyā€ coding to get it done in one automation.

Just to keep it simple I would go the two automation route until you get more experience.

I was expecting the light to go on at sunset and turn off at 23:00.

I see now that I need another automation to turn off the light.

I may have been able to do some ā€œfancyā€ coding in ā€˜Cā€™ or Perl, but Iā€™m finding YAML particularly opaque!

Many thanks for the replies.
Jim

Right. thatā€™s because of the way the trigger in the automation works.

the automation ā€œlistensā€ for the trigger state to be satisfied then it runs the actions as long as the condition(s) is/are met. the trigger only happens at one instant in time. It doesnā€™t wait around for the conditions to be true to run the actions. If the conditions arenā€™t true at the instance the trigger becomes true then the actions wonā€™t be run.

It really isnā€™t bad at all once you get a bit of experience, especially if you have experience coding in other languages.

I assumed that the automation conditions would be periodically polled.
Jim

No they are only evaluated after a trigger event.