So I searched and found this thread that explains how to do a condition that limit the action to between sunset and sunrise. However, I can’t get it to work The automation fires even in the middle of the day!
This is what I have:
- id: '1577892099604'
alias: Extérieur - Ouverture de la porte patio la nuit
description: ''
trigger:
- entity_id: binary_sensor.porte_arriere
platform: state
to: 'on'
condition:
condition: and
conditions:
- condition: state
entity_id: light.lumierecours
state: 'off'
- condition: or
conditions:
- condition: sun
after: sunset
after_offset: 0:30:00
- condition: sun
before: sunrise
before_offset: 0:30:00
action:
- entity_id: light.lumierecours
service: light.turn_on
- entity_id: timer.porte_cours
service: timer.start
Do you see anything wrong compared to what was posted in that thread? I want the outside light to turn on if it’s off (so it doesn’t fire the timer and turned it off when it expires if the light was already on) and only from 30 minutes after sunset and 30 minutes before sunrise.
I think @Burningstone is right. But if it does not fix your problem you can also try it with a Times of the Day Binary Sensor You can replace your “or” condition with a simple if condition (value of sensor is true) to check if its time for your lights to go on.
The +0:30:00 for sunset is what I want. When the sun sets, it’s still relatively well lit outside so I want the light to turn on half an hour after sunset.