The LOGO! is publishing on Logo_Pub topic on MQTT and subscribed to Logo_Sub
Q1 is published on changes and M1 is set to writable
This means that I can still control the light with the physical push buttons even if HA is down.
What I'm trying to achieve
I’m trying to add a light entity in HA with these properties:
The on/off state of the light entity is updated according to the actual on/off state of the physical light, by listening on changes of the Q1 value on the Logo_Pub topic.
Toggling the light should push a message on the Logo_Sub topic with a message telling the LOGO! to change the state of M1.
So far, I can achieve point 2 with this mqtt light:
With that, when I click the “on” or “off” part of the light, the payload_on/off is correctly send to MQTT, the LOGO! reads it and the physical light turns on/off.
The problem is the feedback. The light is always on the “unknown” state and I can’t figure out why it does not read the values published by the LOGO!.
However, this sensor is working, receiving value 1 or 0 depending on the state of Q1:
So both values are published on an array when they are both changed (here, Q1 turned on and Q2 turned off), but the message contains only Q1 if Q2 hasn’t changed.
The logotime value is published every 10 seconds and unfortunately this cannot be silenced.
So when there are no changes in neither Q1 or Q2, the message is:
I have used the same network input as output with some loopback mechanism, but you could use a different network output than input. For me it was the “| tojson” that was the final key in making it work.