I have 2 lights on one smart switch. The smart switch was simply set to toggle these lights. However sometimes I would get into the situation where one of the two lights would be on, then pressing the switch would turn one light off and the other on. Not the desired result. So I made a new automation with conditions to fix that.
The wierd thing is; When i click Run action in the HA Automation configurer it works as expected. (Either turning both lights on, or turn on the one light that was still off, or when both are on, turn both lights off.)
BUT wheb I use the physical switch one of the lights goes on for a split second and the turns off instantly. eventhough in HA it still shows as on.
I already tried to add a 2 sec. delay after the turn on or off command but no luck.
If anyone has a solution that would be greatly appreciated!
See the YAML below;
alias: Woon spot & filmlamp Toggle
description: ""
triggers:
- domain: mqtt
device_id: 687d7709e8bb470c3e3c63c66b34a03b
type: action
subtype: 1_single
trigger: device
conditions: []
actions:
- if:
- condition: or
conditions:
- condition: device
type: is_off
device_id: 2416ece2e369687493f15244af312990
entity_id: b78e97851e2c6e4166db564c7fd80dbf
domain: light
- condition: device
type: is_off
device_id: e48cfdf52c616e47a8bfb91ec298a1f8
entity_id: 27112c6ed2768d4702f57f8a0bc1be83
domain: light
- condition: and
conditions:
- condition: device
type: is_off
device_id: e48cfdf52c616e47a8bfb91ec298a1f8
entity_id: 27112c6ed2768d4702f57f8a0bc1be83
domain: light
- condition: device
type: is_off
device_id: 2416ece2e369687493f15244af312990
entity_id: b78e97851e2c6e4166db564c7fd80dbf
domain: light
then:
- action: light.turn_on
metadata: {}
data: {}
target:
entity_id:
- light.woon_spot
- light.filmlamp
- delay:
hours: 0
minutes: 0
seconds: 2
else:
- action: light.turn_off
metadata: {}
data: {}
target:
entity_id:
- light.woon_spot
- light.filmlamp
- delay:
hours: 0
minutes: 0
seconds: 2
mode: single
4 posts - 2 participants