This flow can turn the Shelly 1 with Tasmota on or off and sets the user interface accordingly.
The flow works in 2 ways:
- It set the values using Homekit or Node-RED UI and send the mqtt commands.
- It listens to the
mqttcommands and set the switches in the Home app & Node-RED UI accordingly.
This way you can also control the light using a direct switch on the Shelly device and your user interface correctly shows on or off.
This flow has some custom javascript because that is my preferred way to handle the message (msg) flow. This flow also prevents to go in an infinite loop which seems to be a feature of homekit-service.