I can’t explain why, but my HA keeps on partially ignoring autmation conditions …
Maybe you could give me a hint.
My idea is: when i did NOT turn on lights by hand, they should turn on and off, as i walk by.
When i did, they should stay on, until i turn them off by hand again. SO motion is ignored then.
And auto-on/off should only happen in the evening.
So my first code (after a lot of improving) was:
- alias: lights on evening
trigger:
- platform: state
entity_id: binary_sensor.tradfri_motionsensor
to: 'on'
condition:
- condition: state
entity_id: light.1
state: 'off'
- condition: state
entity_id: light.2
state: 'off'
- condition: state
entity_id: light.3
state: 'off'
- condition: time
after: '19:00:00'
before: '00:01:00'
action:
- service: light.turn_on
entity_id: light.group_2
- delay: 00:00:45
- service: light.turn_off
entity_id: light.group_2
And this works (mostly) pretty well.
Just from time to time the light goes off, even i turned it on by hand, but it’s like 1 of 30 cases.
It’s ok for me.
Now i wanted to have the same in the morning. So i tried to put another condition “or” with the time in the morning inside this automation, but it did not work at all.
For this i copied the whole automation and just changed the time.
This is the new (second) code:
- alias: lights on morning
trigger:
- platform: state
entity_id: binary_sensor.tradfri_motionsensor
to: 'on'
condition:
- condition: state
entity_id: light.1
state: 'off'
- condition: state
entity_id: light.2
state: 'off'
- condition: state
entity_id: light.3
state: 'off'
- condition: time
after: '04:30:00'
before: '07:15:00'
action:
- service: light.turn_on
entity_id: light.group_2
- delay: 00:00:45
- service: light.turn_off
entity_id: light.group_2
And now comes the real strange thing:
It does NOT work!
The light is turned off every time i walk by, doesn’t matter if i turn it on by hand or not.
But it’s exactly copy of the first rule, this works and still it seems like HA is ignoring the “if light 1/2/3 is off” condition.
Is it my code, which is wrong?
PS:
light.group_2 is the group, where light 1/2/3 a re in.
I cannot change all the 3 lights to one group, because wh en i tell google to turn on lights, it turns on all 3 lights separatly, and not the group, so the condition is always met.