Suset + time automation

Hi all!
i need some help for make it work a simple (i suppose!) automation!
i wanna to automate a turn on event on a entity.
The command should be performed:

  • at the sunset , but only if the time is >= to 19.00.
    it the sun goes down before the 19, the entity have to be turned on at 19.00.

can you please help me to obtain this in home assistant automation?
Regards,
S.

Have a trigger for each with matching conditions…

trigger:
  - platform: sun
    event: sunset
  - platform: time
    at: "19:00:00"
condition:
  - condition: time
    after: "19:00:00"
  - condition: sun
    after: sunset
action:
  - service: switch.turn_on
    target:
      entity_id: switch.example

But in this case, the entity will be tuned on only if the sunset is after the 19 or i have misunderstood?
i need for a turn on action:
when the sun goes down after 19, at the sunset;
when the sun goese down before 19, at 19.

That’s what you’ve been given. It triggers at sunset and again at 19:00, whichever way around they are; and only proceeds to the action if BOTH conditions are true.

In effect, it runs when the second of the two triggers happens.

1 Like

if can help, i have a sensor wich read the next sunset time.(next-sunset)
so i need something like these:
if next-sunrset is <= 19.00 then turn entity on at 19.00;
if next-sunset is >= 19.00 then turn entity on at next sunset

You’re not listening. @Didgeridrew’s solution already does what you want. The action will be run when the sun goes down, or 19:00, whichever is later.

Triggers are “OR” (any of them will trigger); conditions are “AND” (all must be true to proceed).

“Summer” sequence:

  • Trigger: 19:00
  • Are both conditions true? No: sun is still up, stop there.
  • Later: Trigger: sunset
  • Are both conditions true? Yes, sun is down and it’s after 19:00, proceed!

“Winter” sequence:

  • Trigger: Sunset
  • Are both conditions true? No: it’s before 19:00, stop there.
  • Later: Trigger: 19:00
  • Are both conditions true? Yes, sun is down and it’s after 19:00, proceed!

ok my fault!
i have not understood! i give it a try
Thanks!!