MQTT Infinite Loop - Suggestions
Posted: Friday 08 July 2016 11:08
Hi,
Sorry for the long post, but needed to explain my setup in a bit of detail.
This is the setup I have been playing with for the last few days: I have a Beagleboard Black connected to an Arduino with a RF433 transceiver (a Kickstarter device back in the day called Ninjablocks) - that can receive data from 433MHz sensors and can also trigger actuators. Both, received data and data to be transmitted is written to and read from it's serial console (/dev/ttyO1). I have a Node-Red flow that reads data from the serial console, and sends it to MQTT in the required Domoticz format ; Domoticz reads it from here and updates the appropriate virtual devices (via 'domoticz/in'). In the other direction, anything on 'domoticz/out' gets read by the Node-red flow, and similarly gets written to the Ninjablock's serial console (if an RF433 actuator, discarded if not), and Ninjablocks does the needful.
Everything works as expected.. well almost.. For sensors, there are no issues. When it comes to actuators, it goes into a never ending loop. Example, say I press a virtual device 'Doorbell' in Domoticz. This triggers the domoticz/out, ends up in the Ninja's serial console as described above, the RF433 on the Ninja transmits the code and actuates the doorbell. The transmission itself however gets recorded as another signal, gets passed back to domoticz/in, then to domoticz/out, and ends up in the ninjablocks again. This goes on forever, and the doorbell keeps ringing!
I can see the problem here, but have run out of ideas to solve it. One thing I have tried is pass an 'svalue='ninja', so I can recognise it in the Node-red flow and filter it out just like I filter out sensors. However, looks like Domoticz drops this svalue and replaces it with a 'svalue = 0' when sending it through 'domoticz/out'.
Anyone else have any other ideas I could try - in Domoticz or in Node-Red ??
Many thanks,
Himanshu
Sorry for the long post, but needed to explain my setup in a bit of detail.
This is the setup I have been playing with for the last few days: I have a Beagleboard Black connected to an Arduino with a RF433 transceiver (a Kickstarter device back in the day called Ninjablocks) - that can receive data from 433MHz sensors and can also trigger actuators. Both, received data and data to be transmitted is written to and read from it's serial console (/dev/ttyO1). I have a Node-Red flow that reads data from the serial console, and sends it to MQTT in the required Domoticz format ; Domoticz reads it from here and updates the appropriate virtual devices (via 'domoticz/in'). In the other direction, anything on 'domoticz/out' gets read by the Node-red flow, and similarly gets written to the Ninjablock's serial console (if an RF433 actuator, discarded if not), and Ninjablocks does the needful.
Everything works as expected.. well almost.. For sensors, there are no issues. When it comes to actuators, it goes into a never ending loop. Example, say I press a virtual device 'Doorbell' in Domoticz. This triggers the domoticz/out, ends up in the Ninja's serial console as described above, the RF433 on the Ninja transmits the code and actuates the doorbell. The transmission itself however gets recorded as another signal, gets passed back to domoticz/in, then to domoticz/out, and ends up in the ninjablocks again. This goes on forever, and the doorbell keeps ringing!
I can see the problem here, but have run out of ideas to solve it. One thing I have tried is pass an 'svalue='ninja', so I can recognise it in the Node-red flow and filter it out just like I filter out sensors. However, looks like Domoticz drops this svalue and replaces it with a 'svalue = 0' when sending it through 'domoticz/out'.
Anyone else have any other ideas I could try - in Domoticz or in Node-Red ??
Many thanks,
Himanshu