Lignt not turning off at night

Hi All,

I appreciate this will be something silly I have done but.

I have an automation that will turn the light on when there is movement, set a certain colour depending on the time of day, then turn off if there is no movement after 1 minute.

this works fine during the day, but the light will not switch off at night!

I have checked, there has been no moment detected.

any ideas please?

- alias: 'light off'
  trigger:
platform: state
entity_id: binary_sensor.landing_pir
to: 'off'
for:
  minutes: 1
  action:
service: light.turn_off
entity_id: light.02150034807d3a7693fd

- alias: 'Landing Pir night'
  trigger:
platform: state
entity_id: binary_sensor.landing_pir
to: 'on'
  condition:
- condition: time
  after: '18:30:00'
  before: '05:59:59'
  action:
service: light.turn_on
data:
  brightness: 100
  rgb_color: [0, 0, 255]
  entity_id:
    - light.02150034807d3a7693fd

- alias: 'Landing Pir evening'
  trigger:
platform: state
entity_id: binary_sensor.landing_pir
to: 'on'
  condition:
- condition: time
  after: '18:00:00'
  before: '18:29:59'
  action:
service: light.turn_on
data:
  brightness: 150
  rgb_color: [255, 255, 255]
  entity_id:
    - light.02150034807d3a7693fd


- alias: 'Landing Pir day'
  trigger:
platform: state
entity_id: binary_sensor.landing_pir
to: 'on'
  condition:
- condition: time
  after: '06:00:00'
  before: '17:59:59'
  action:
service: light.turn_on
data:
  brightness: 150
  rgb_color: [255, 255, 255]
  entity_id:
    - light.02150034807d3a7693fd

is there a copy paste issue going on here? Your spacing seems all out of whack. Is this what it looks like inside your yaml file or was some of the formatting lost? I wouldn’t expect any of these automations to work with the format in this post.

I think its the copy and paste as it all works except turning off the light at night.

https://pastebin.com/Rq5Qh9Gq

Is the automation turned on from the states page?

So does the light ever turn off or it just doesn’t turn off at night?

it only doesnt turn off at night.

any yes all automations are active

Reading through your code, I suspect that what’s happening is this -

You’ve built too much intelligence into your smart home and the light is now sentient. With that, it has picked up an irrational fear of the dark and now won’t turn off at night, because it’s scared.

2 Likes

You mean the light is not meant to talk to me?

Have you checked the logbook or the home assistant logs? Your automations look correct. You may have something else going on here.

I rebooted this morning and all i have in the log is the following:

Update for sensor.met_office_wind_direction fails

9:01 PM components/metoffice/sensor.py (ERROR) - message first occured at 8:25 PM and shows up 2 times

Update for sensor.met_office_weather fails

9:01 PM components/metoffice/sensor.py (ERROR)

Error doing job: Task exception was never retrieved

8:30 PM helpers/entity_platform.py (ERROR) - message first occured at 8:01 PM and shows up 2 times

Update for sensor.met_office_wind_gust fails

7:50 PM components/metoffice/sensor.py (ERROR)

The light is coming on, but will not turn off when it is in its night setting…