#Need Help Automation: Lights on at sunset and off at specific time in ONE Automation

1 messages · Page 1 of 1 (latest)

vale elm
#

Hey, I'm getting desperate and can't find a solution.

I'm trying to automate a lamp as follows.

  • Switch on at sunset -15 minutes
  • Switch off at 23:15
  • it should be only one automation

No problem with two different automations, no problem with two fixed times or 2x sun event. But how do I manage this in combination?

tame reef
#

Create the event. Create both triggers, ensuring you add a trigger ID to each one. Add each action (one ON, one OFF) using the correct Trigger ID for each action.

vale elm
#

Thanks for your answers...
After searching some times i found something like that and hope it will work... 😉

`
trigger:

  • platform: sun
    event: sunset
  • platform: time
    at: "23:15:00"
    action:
  • service: switch.turn_{{ 'on' if trigger.platform == 'sun' else 'off' }}
    entity_id: switch.XXX
    mode: single
    `