I have decentralized pool water control system, where a pyhton script executes on a headless Rpi to control water filling in my pool. Since I want to monitor water filling and also have the possibility to manually fill water from my HA (running on a separate Rpi), the actual I/O port controlling the water tap, is controlled by my HA over MQTT. I have mqtt_io running on my detached Rpi controlling various GPIO pins on the remote Rpi. By this I can montitor and control I/O on the detached Rpi from HA. This works great.
The detached python scripts implements the control loop measuring the water level, and once it detects low water it decides to start filling water. The script issues a POST request on the REST interface that updates corresponding HA entity, and this should result in a MQTT command that turns on the water tap. However, it seems like the POST request just updates the HA entity. No MQTT command is sent out to actually to control the switch on the remote Rpi.
I can clearly see this behaviour by manually turning on the water in HA. That operation immediatly sends a MQTT command that turns on the water. My python script monitors the status of the switch by a GET request, understands the water tap is on and immediatly decides to turn it off since the water level is high enough. Consequently, the switch on my lovelace card turns off within a couple of seconds. However, in this case no MQTT off command is sent to my remote Rpi. And by this the water tap is kept open…
So it looks a POST request targeting a MQTT entity does not trigger corresponding MQTT command. But the entity state is updated in HA. In my opinion, this looks like a bug or at least a very strange behaviour.
Edit: You might wonder why I have implemented the control loop in a separate python script. This is for historic reasons. I developed this as a standalone system. It includes some advanced filtering and security mechanisms, and I don’t want to reimplement this again in HA. Just use HA as a frontend for the script.