digital output with Node-red?

Comments & issues
Post Reply
Daydriver
Fresh meat
Posts: 3
Joined: Wed Aug 25, 2021 8:59 am
Contact:

digital output with Node-red?

Post 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.
User avatar
mparadis
Site Admin
Posts: 959
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: digital output with Node-red?

Post 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.
Daydriver
Fresh meat
Posts: 3
Joined: Wed Aug 25, 2021 8:59 am
Contact:

Re: digital output with Node-red?

Post by Daydriver »

Thanks that worked great. I just used an inject node to test it then used an HTTP endpoint. :D
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests