Page 1 of 1

digital output with Node-red?

Posted: Thu Oct 14, 2021 12:35 pm
by Daydriver
I feel a little silly asking because I think I must be missin something simple but I can't seem to trigger the digital output nodes in node red. The way they are wired to the connect nodes seems to not allow any sort of trigger to enter the node.

Re: digital output with Node-red?

Posted: Thu Oct 14, 2021 1:43 pm
by mparadis
The Phidgets node-red package is written as a very loose wrapper of our JavaScript libraries, so any incoming message must be formatted in a very specific way:

- The topic of the message must exactly match the name of a method in our JavaScript API
- the payload of the message must be a json object, where the name of each member in the object must match a parameter of the method you're trying to call

So, in order to turn on a digital output, you'd need to make a message like this:

Code: Select all

Topic: setState
Payload: {
"state": true
}
You may need to use function blocks to conform upstream data into this format.

Re: digital output with Node-red?

Posted: Wed Oct 20, 2021 3:43 pm
by Daydriver
Thanks that worked great. I just used an inject node to test it then used an HTTP endpoint. :D