Automation sunset lights

Hello guys

Can anyone help me a little:

- alias: 'Tænd lys i gangen når vi kommer hjem'
  trigger:
    platform: state
    entity_id: group.all_devices
    state: 'home'
  condition:
    condition: state
    entity_id: group.all_devices
    state: 'home'
  action:
    service: homeassistant.turn_on
    entity_id: group.gang

can i have 2 conditions
i want this automation only happen when it´s sunset and i get home`?

Change your trigger to sunset. Your condition should work fine but you need to change the trigger.

i dont think so, i want it to happen when i get home if sunset

Use both as triggers and as conditions. Event will trigger at sunset or whenever you get home. It’ll then check to make sure you’re home and it’s after sunset.

trigger:
  - platform: state
    entity_id: entity_id: group.all_devices
    state: 'home'
  - platform: sun
    event: sunset
condition:
conditions: and
  - condition: state
    entity_id: group.all_devices
    state: 'home'
  - condition: sun
    after: sunset 
action:
1 Like

Sorry, I didn’t read close enough and missed ‘get home’ - I just read it as ‘home’.

@ih8gates solution is what you are looking for.

Hey thanks

but i want i to only happen when i get home if sunset, how will that look like when?

That’s what this’ll do. If it’s sunset and you’re already home, it’ll come on. If you’re not home, it won’t. If you come home and it’s past sunset, it’ll come on.