Moderator: RevPiModIO

Topic Author
Posts: 14
Joined: 29 Aug 2020, 13:18

Node Red MQTT set not working...ish

12 Sep 2020, 23:56

Hey there!
Managed to setup Node Red and I'm getting the input events, but when I try to set an output via MQTT it turns on briefly then back off.
I've uploaded a video of the behavior here:

The Red Lamp (O_2) is connected directly to the input in the main loop of the program.
Screenshot 2020-09-13 005101.png
Screenshot 2020-09-13 005101.png (38.46 KiB) Viewed 651 times
The Green one (O_3) is supposed to be toggled by MQTT. It is marked as exported in PiCtory.
Screenshot 2020-09-13 004957.png
Screenshot 2020-09-13 004957.png (56.74 KiB) Viewed 651 times
What am I doing wrong?

Thanks in advance!
User avatar
Posts: 243
Joined: 20 Jan 2017, 08:44

Re: Node Red MQTT set not working...ish

13 Sep 2020, 08:36

Hi cataliz3er!

If you are using RevPiModIO in your python program, it takes the complete control of the process image! So it forces the io states to the process image, which are set in the program! If you use MQTT or other programs parallel to the python program to set outputs, your python program will override the outputs, which are set from outside of it.

In your example: The MQTT System set output O_3 and the python program will switch it back to the value which is defined in the Python program (false).

If you want to change that, just add “shared_procimg=True” to your RevPiModIO(...) object in your Python program. Then it will sync the outputs and your system will work!

python3-RevPiModIO - || Der RevPi ist das Beste, was passieren konnte!

Who is online

Users browsing this forum: No registered users and 1 guest