Automations does nothing

Hi

I’ve tried on and off for half a year getting automations to work. Updated to the latest docker image yesterday, but still no luck. I have tried using the web interface to make automations and I have made them manually in yaml.
It looks like the automations are triggered, but nothing happens.

If I press the trigger button lights will turn on.

My automations.yaml

Try this:

   action:
      service: light.turn_on
      entity_id: group.tvrom

Please note that it’s easier for the rest of us if you post your automation as text, wrapped in code formatting :wink:

Are there any errors in your Home Assistant log file when the automation fires?

Try after_offset: instead of just offset:

Here is mine which uses an LDR to check the light level and the sunset. I also have multiple lights, 1 uses 433Mhz RF and the others using Sonoff basics hence the group.lights and switch.light

  alias: Lights on Sunset
  trigger:
   platform: numeric_state
   entity_id: sensor.conservatory_ldr
   below: 750
  condition:
   - condition: state
     entity_id: group.family
     state: "home"
   - condition: sun
     after: 'sunset'
     after_offset: '-01:30:00'
   - condition: time
     before: '22:00'
  action:
  - service: homeassistant.turn_on
    entity_id: group.lights
  - service: homeassistant.turn_on
    entity_id: switch.lights

I would also check your “group.all_devices” state, mine is “home” not ‘home’ (double quotes)

@EspenT don’t use after_offset. That is for conditions. offset is correct in a trigger:

As @Dielee said, check group.all_devices. Chances are that it is not ‘home’.

You have a condition that ALL devices have to be ‘home’. Any device that is ‘not turned on’ but on the network, will register as ‘not home’. You can see the states in the <> page (dev-state). I would simplify this to a few devices.

Sun is above horizon here now, so I made a new simpler automation. That does not work either.

- alias: Turn off lights after sunrise
  trigger:
    platform: sun
    event: sunrise
    offset: "02:00:00"
  action:
    service: homeassistant.turn_off
    entity_id: group.tvrom

Also tried this

- alias: Turn off lights after sunrise
  trigger:
    platform: sun
    event: sunrise
    offset: "02:00:00"
  action:
    service: light.turn_off
    entity_id: light.tvrom

Both of them seem to trigger. but does not turn off lights

what is ‘tvrom’? Is it an actual group or just a light?

It is a group with lights and a samsung tv.

then you cannot call ‘light.turn_on’

Have you tried just turning on one light?

Sunrise occurs around 3-4PM in your timezone? That doesn’t seem right.

I’m guessing you are showing the logs from a different time of day?

Just as an FYI, your trigger will ONLY OCCUR 2 hours after sunrise. It will not continuously occur throughout the day. So you need to verify that it’s occurring at the correct time of day, not a random time in the day.

Nah… sunrise does not occur then. I was thinking a restart of the server after sunrise would retrigger automations that should have happened at sunrise.

Nope. My guess is that your automation works. Just press the button in the UI, should ignore the trigger and perform the action based on the condition (which you aren’t using).

Ok. Thanks for the help. I will leave the automations active for a couple of days and see.