I have an aqara contact-sensor in my door-lock and a milight rgb-bulb that I would like to react to the door status. But I can’t figure out how to change the bulb to green when unlocked and red when the door is locked.
binary_sensor.0x00158d0004215383_contact - Door sensor
light.kok_fonsterlampa_milight - lightbulb
Thanks, but when I try I get: "Message malformed: invalid template (TemplateSyntaxError: expected token ‘end of print statement’, got ‘=’) for dictionary value @ data[‘action’][0][‘data_template’]
"
Thanks, but I can’t get it to work. The binary sensor is a Aqara door/window sensor configured as a lock. The automation gets triggered every time I lock/unlock but the lightbulb does not change color. I am unsure if it is the the state of the lock that is wrong (I also tried “locked” instead of “on” ). How can I check the actual states that a binary sensors have ?
Can I somehow test to send the color-change command directly to the bulb to check if that is the problem ?
I know this is a little off topic, but I have noticed something strange. Normally when I lock the door I trigger the Lock-entity called “Main Door” to “Locked/Unlocked” and that one always react correctly, the “Main Door” status triggers the automation " [Change Bulb Color on MaindoorStatus] -> has been triggered by state of binary_sensor.0x00158d0004215383_contact"
But after a while the automation triggers directly from the binary sensor, not the lock entity.
“[Change Bulb Color on MaindoorStatus] -> has been triggered by state of binary_sensor.0x00158d0004215383_contact” without the lock entity changing. The lock entity always shows the correct status.
Yes it is a Aqara battery powered zigbee sensor. But in all the false-triggers I have noticed it always turns to red after a while which is “on” if I understand correctly. Also I cant see that the lock gets any random triggers when looking at the history.