Hi,
I have some smart lights that have to be controlled by a detached switch. This Tasmota-switch doesn’t cut the power, but just sends a MQTT-message to HA when pressed, which presents itself as a binary sensor. I have written an automation that when the binary sensor changes, the light toggles. This way, I can use the button or Home Assistant itself to control the lights. The strange thing is that sometimes, after turning on the lights in the morning, they are on when I arrive back home. Looking into the logbook, for example yesterday, the Switch was already in “On” state since the morning (which in that case meant the lights were off), but was also turned on again later (although it already was on!). This triggered the automation.
What could cause this and how can I make sure this doesn’t happen? If this is the wrong way to do this and I should use other methods, let me know
This is the automation:
alias: Toggle keukenlamp
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.switchtasmotakeuken
from: null
condition: []
action:
- service: light.toggle
data: {}
target:
entity_id: light.keuken_wand
- service: light.toggle
data: {}
target:
device_id: f832c9e4c4d7952f9480f58f30670b2f
- service: light.toggle
data: {}
target:
entity_id: light.keuken_tafel
mode: single