Node-RED nodes for hubitat

I setup Node-red on a computer, maker API with some virtual devices, etc. It works but I miss something probably ridiculous...

I can inject numeric values (inject node) and the result is ok on my dashboard/device

I harvested some data from my modbus PLC (ok, I obtain the values - debug mode) and I want to inject them into HE. That's my problem. I obtain only msg.payload[X] where X is the payload position of my modbus area.

I probably forgot something about values, messages, conversion... where is my error ?

node-red temperature argument

I'm not completely sure, but it looks like the Arguments field in the Command Node might only accept values, not JSONata, so I'd suggest adding a Change Node before the command node, and setting msg.arguments to msg.payload[58], then remove the arguments from within the Command Node.

2 Likes

Correct

Same result :frowning:
It seems that I lose something here.

As you can see, the result of my modbus poll is a number (967 Watts, a number, taken from an array), I did convert it from the beginning, and removing the argument has no consequences.

Don't you need to set msg.arguments not payload? Also if msg.payload[0] does not work try jsonata/payload[0] maybe. It should though..

2 Likes

Correct

image

People get tired of my saying this, but READ THE ONLINE NODE HELP (caps for emphasis, not anger). It says exactly what are allowable inputs - there is no need to guess.

image

All that said, I just submitted an issue/request to consider renaming the input help to say "msg.arguments" instead of just "arguments" to remove ambiguity.

3 Likes

Holy Smokes! Node-RED is freaking amazing. I love it.
Now I'm already so far in there will be no getting me out of this deep hole :rofl:

Sigh. Now I have to read 3061 posts FFS...
:weary:

3 Likes

Pathetic I know, but its my first NR test flow and I'm pretty impressed, bewildered, amazed...

3 Likes

Oh the rabbit hole goes deeeeep.... you have been warned.

Suggest checking out the @putch's excellent stoptimer-varidelay node..

3 Likes

Yeah I figured and read there are ways to import useful nodes but didnt work out how yet. Just playing with the basics after watching all the standard videos. This is like my early Stringify days so it's a very, very welcome approach to creating rules. I should have jumped in earlier but stuck with RM until I really knew it and now feel it's time to get into this! It looks amazing I have to say. Very cool indeed.

2 Likes

I showed that in the video I created yesterday:

http://homebridge.hubitatcommunity.com/Hubitat_Node-Red/

Additionally, I created a Node-Red RaspberryPi image and there's an explanation on how the image was built, including how a dozen nodes were installed via the command line.

http://homebridge.hubitatcommunity.com/rpi

7 Likes

I also submitted a pull request for this change for the 4 nodes that have configurable input message parameters. Assuming I did it right (lol - I've screwed up easier PRs before...) maybe it will get merged for next release.

1 Like

@fblackburn

I think it would be very useful for new users of your Hubitat nodes if you could put a link to @csteele's video in your introductory post.

Thank you for considering this request!

What a community.
Incredible.
10/10.

2 Likes

If you decide you want to use resettable delays in turning off the light, I would suggest using this one:

Then you can reset the off timer based on additional motion like:

Note that with multiple motion triggers it can be tricky, depending on how the sensors react to continuous motion. If some stay "active" the whole time motion is present, and others don't, then you will need more logic to check if any=active before triggering the delayed off.

As yours appear to all be the same type (Xiaomi) you might not have to worry about that.

If you did, you would just daisy chain the motion sensors in the "off" path (making sure to DEselect send events in the node config) like this - basically the msg would never reach the stoptimer node if all nodes aren't = "inactive":

Some would say "that's a lot of nodes for something simple". My counter to that is I would rather explicitly see the msg flow than to bury the logic in a function node that makes the flow sheet "prettier" but hides the logic/flow control.

While I could easily do it this way, I don't find this useful in the long run:

2 Likes

I guess you could also take advantage of HE's Zone Motion Controller app to combine sensors.. and just expose the resulting virtual sensor to the maker api.

lots of ways to do things....

Which is one of the things that makes NR so great... I'm also using subflows to hide/centralize redundant sequences...

Absolutely!

I fully agree. My mistake was probably due that I previously used that kind of parameters with Hubitat MQTT app that asked for text instead of numbers. I had to extract data from the area and submit each of them to MQTT. Now I have the full area again (debug) but the result is as expected.

3 Likes

Ah, that makes sense, and not super obvious. Nice job figuring that out.

1 Like

To be honest I don't know what you talk about (hubconnect nodejs server) (and didn't search neither :sweat_smile: ) But if this feature is required by some of you, then I can think about it how to integrate it. (I will try to read about it, let's hope for some rain this weekend :laughing:)

Woups I total miss that thing. Yes I don't reuse the port option for the websocket connection URL. I'll fix it in the next release. Thanks

1 Like