Tags: mhemeryck/modbridge
Tags
Adds subscribe to topic for all writable coils Regular modbus coil mappings mention coils to be either read-only or read-write. For our purposes here, a mode of "write-only" is added to assure that we only use the coil for writing to from an incoming MQTT event. Otherwise, the following would happen: - MQTT event triggers coil update - coil update; gets polled - on poll, the coil pushes out another MQTT event, effectively undoing the previous change (or even worse, leading to some infinite loop behavior, depending on the topic and values used). Put in infinite loop to keep connection open; [SO](https://stackoverflow.com/questions/48872360/golang-mqtt-publish-and-subscribe) has a solution based on an OS signal.
PreviousNext