Node Red MQTT set not working...ish

Moderator: RevPiModIO

Post Reply
cataliz3er
Posts: 14
Joined: 29 Aug 2020, 13:18
Answers: 0

Node Red MQTT set not working...ish

Post by cataliz3er »

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:
https://www.youtube.com/watch?v=bfN-GiTGU00

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 2648 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 2648 times
What am I doing wrong?

Thanks in advance!
User avatar
RevPiModIO
KUNBUS
Posts: 322
Joined: 20 Jan 2017, 08:44
Answers: 0
Contact:

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

Post by RevPiModIO »

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!

Sven
python3-RevPiModIO - https://revpimodio.org/ || Der RevPi ist das Beste, was passieren konnte!
Post Reply