Lights coming on at sunset when not triggered

Hello,

I have automation set up on my driveway lights to come on when motion is detected on a ring cam after sun set.

It all works fine apart from the fact that at sun set the light just come on. I either have to turn them off through the front end or motion is triggered and the three minute timer finished and they turn off. Happens every day regular as clockwork!

Here’s the YAML…

- id: '1595232918341'
  alias: Driveway Lights On From Gate Cam
  description: ''
  trigger:
  - entity_id: binary_sensor.gate_motion
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - condition: state
    entity_id: sun.sun
    state: below_horizon
  action:
  - brightness_pct: 100
    device_id: e837fde6d8264afdb70381305e9f8b16
    domain: light
    entity_id: light.007237065002915573c9
    type: turn_on
  - brightness_pct: 100
    device_id: cfea552226184a48bb36443d1aa103e8
    domain: light
    entity_id: light.00723706500291556ea0
    type: turn_on
  - brightness_pct: 100
    device_id: 023b6a7849d04dc580447a0ce14d0630
    domain: light
    entity_id: light.007237065002915570f5
    type: turn_on
  - brightness_pct: 100
    device_id: 26be7c48754b49419ae8f569f7375c57
    domain: light
    entity_id: light.085042564c11ae0f8168
    type: turn_on
  - brightness_pct: 100
    device_id: 9079a7c1a82540d792769706060f4115
    domain: light
    entity_id: light.00723706500291556eea
    type: turn_on
  - brightness_pct: 100
    device_id: 064b5e458db64bd588009901ff3cf297
    domain: light
    entity_id: light.085042564c11ae0f80d2
    type: turn_on
  mode: restart

Can anyone suggest how I can stop this from happening.

Are you 100% sure it’s that automation that triggers your lights?
Next time it happens, you can go to your automations and sort by “last triggered” to see if this specific automation was ran.

Good question. Here is the log from this evening…

Sun set

17:12:58 - 6 minutes ago

[Stable Light](http://192.168.1.114:8123/logbook#) turned on by Home Assistant Cloud

17:11:04 - 8 minutes ago

[Driveway Lamp 3](http://192.168.1.114:8123/logbook#) turned on by Home Assistant Cloud

17:11:03 - 8 minutes ago

[Driveway Lamp 2](http://192.168.1.114:8123/logbook#) turned on by Home Assistant Cloud

17:11:03 - 8 minutes ago

[Driveway Lamp 4](http://192.168.1.114:8123/logbook#) turned on by Home Assistant Cloud

17:11:03 - 8 minutes ago

[Driveway Lamp 1](http://192.168.1.114:8123/logbook#) turned on by Home Assistant Cloud

17:11:02 - 8 minutes ago

[Driveway Lamp 6](http://192.168.1.114:8123/logbook#) turned on by Home Assistant Cloud

17:11:02 - 8 minutes ago

[Gate light](http://192.168.1.114:8123/logbook#) turned on by Home Assistant Cloud

17:11:01 - 8 minutes ago

[Amazon Alexa](http://192.168.1.114:8123/logbook#) sent command Alexa.PowerController/TurnOn for Stable Light by Home Assistant Cloud

17:11:01 - 8 minutes ago

[Amazon Alexa](http://192.168.1.114:8123/logbook#) sent command Alexa.PowerController/TurnOn for Driveway Lamp 3 by Home Assistant Cloud

17:11:01 - 8 minutes ago

[Amazon Alexa](http://192.168.1.114:8123/logbook#) sent command Alexa.PowerController/TurnOn for Driveway Lamp 2 by Home Assistant Cloud

17:11:01 - 8 minutes ago

[Amazon Alexa](http://192.168.1.114:8123/logbook#) sent command Alexa.PowerController/TurnOn for Gate light by Home Assistant Cloud

17:11:01 - 8 minutes ago

[Amazon Alexa](http://192.168.1.114:8123/logbook#) sent command Alexa.PowerController/TurnOn for Driveway Lamp 4 by Home Assistant Cloud

17:11:00 - 8 minutes ago

[Amazon Alexa](http://192.168.1.114:8123/logbook#) sent command Alexa.PowerController/TurnOn for Driveway Lamp 1 by Home Assistant Cloud

17:11:00 - 8 minutes ago

[Amazon Alexa](http://192.168.1.114:8123/logbook#) sent command Alexa.PowerController/TurnOn for Driveway Lamp 6 by Home Assistant Cloud

17:11:00 - 8 minutes ago

So it looks like the command is being issued by Alexa.PowerController a couple of minutes before sun set.

Checked on the Alexa app and it seems I had left a test routine running.

Thanks for the tip.