16relind Nodes

brydenver2

New member
Can you tell me on your node-red nodes for the 16 relay card, how do you dynamics set relay address for each relay? I set the msg.relay to say 4 and the msg.payload to true and it will not respond. If I set the input type of the node to msg.relay it then responds to relay 4 but payload does nothing. I can send a msg.stack, msg.relay and msg.payload but will only respond to the payload. Can you give me some insight?
 

alexburcea

Moderator
Staff member
Hi,
You must go to the node settings and set the relay number to zero so the node will look for for msg.relay to select the relay but you need also to set the payload. Please check the attached flow.
 

Attachments

  • 16_relays_example.txt
    2.8 KB · Views: 4

brydenver2

New member
Thanks Alex,
I updated NodeJS to 18 and Node-Red to 3.1.3 and it still does the same thing even if I set the msg.relay to 2 it still sends the command to relay 1. I did notice that if I set the payload to 2 or 3 then it triggers that relay on the board but then I have set the payload to 0 to turn it off. The other thing that is strange is if I trigger relay 3 using payload then it will not respond to any other commands until I send a payload of 0. This is a fresh install with nothing running.
 

brydenver2

New member
Yep, I imported your flow and the behavior is exactly the same. Its acting like if the node payload is set to msg.payload then that's all it accepts and ignores all other objects.
 

alexburcea

Moderator
Staff member
Let me do a fresh install of the last Node-RED and get back to you. It is strange that on my 3.0.2 all is working as expected
 

brydenver2

New member
What version of NodeJS are you running?

Also should this allow you to set multiple relay states or is it just only one on at a time? The Python script works just fine so it must be a NodeJS issue?
After changing up your flow I can select each relay in the node properties and that works properly but when I read the relay states for relay 1,2,3 ON I get a payload of 7 ??

1703789935997.png
 

Attachments

  • flows.txt
    5.8 KB · Views: 2
Last edited:

brydenver2

New member
I am still having one issue. On the Read Node when you set the relay to "0" and say with relay "10" ON it sends a payload of "512". If I set relay 2 and 3 to ON it send a payload of "6"? How does it calculate the payload? Is there a way to send an array for each relay?
 

alexburcea

Moderator
Staff member
I am not sure your answer is sarcastic or not but if it is here is an example of what i was referring to.
 

Attachments

  • bitmap_to_array.txt
    2 KB · Views: 3
Top