Node-RED nodes for hubitat

As someone who staunchly avoids using a Function Node whenever possible, I would probably use a Template Node in your case. This is mine that says what contact sensor has been open for more than 5 minutes:

image

Your line 1 would be: Garage Door is unlocked by {{payload.value}}.

Then, under Property, you would send on the message under whatever you want. It could be msg.payload or anything else. It's Msg.text in my example.

2 Likes

Hadn't learned about that one yet. Very interesting.
let me check this out. ... I'll have some questions for sure.

You can even add time to it like I did in this Template Node:

image

2 Likes

I'm super close on this now, thanks @stephen_nutt.
Any way of showing the format on this message correclty?

image

image

Does payload.value have an ampersand in it? Is it "Mom & Dad" by chance? I am guessing that is causing issues with code.

I know it causes heartache in MS Access in field names and field values so I usually go with something like "Mom n Dad" instead.

got it! I can do that! Easy fix

Did a search and couldn't find "template", what's the node name ?
Thx

You all realize that ultimately every node is basically a TypeScript function in the end, right?

I completely don’t understand the fright or aversion of using the base level of nodes as long as you have even a basic handle of js

I found it in the function category. It must be standard as I don't think I loaded it.

I know nothing about js.

but
You guys help me understand.

There is no fright and only a little aversion to using a Function Node. To me, the point of Node Red was to allow people like me w/ no knowledge of JSON to be able to do all of the things that Node Red can do graphically in a browser. So, if I have to resort to a Function Node, then I am defeating the purpose of Node Red.

I don't know what you mean by a TypeScript function so that tells you my level of knowledge of the programming language. I understand that every node type has a function node at its core in the same way that every car has a combustion engine at it's core but I don't want to build an engine to make the car go. I just want to push the Accelerator Node (pedal).

If there is a node that can do the job, I don't understand why you would write a Function Node. It's the same in Hubitat. I don't write my own Groovy Apps or Drivers because there is almost always one that someone else has already created.

But that's the great thing about all of this. People like @JasonJoel and @morningz have the knowledge and can probably push Node Red to do things I can't nor ever will but at this point, I have rarely not been able to find a node palette to do what I want. HOWVER, I am looking for someone who has created a Node Palette for the Eufy Doorbell. :smile:

For the record, I do have Function Nodes in my flows but they are flows that I "borrowed" from others. :smile: :smile: :smile: :smile:

1 Like

What's the best/easiest way to get webhooks into Node-RED running on a Pi (for example from IFTTT). Anyone got good experience using the Webhook Relay service? I see they provide 150 messages free per month. I'm looking for more for free :grinning: Any other services you know of that do the same?

As another approach, I set up Telegram, well at least from IFTTT -> Telegram, but I can't seem to install any of the various node-RED Telegram nodes to complete the chain. Not sure why but they just won't load and I can't fathom any errors in the log.

In a similar concept to Telegram, I just have IFTTT write to a file in Dropbox. The NR PC is running the dropbox client (not the node) - so it synchronizes the file and NR monitors that directory locally.

Looks like the new version supports setting of HSM!! Thanks @fblackburn!

I watched the great video by @csteele - thank you. I’m still trying to grasp the concepts.

I finally had some time to play with this tonight, got node-red and Hubitat contrives updated and got stuck. How would I, for instance, capture presence states of a number of people (a, b, and c) and do a switch to do things like - if a leaves and b and c are already gone, set HSM and mode to Away. If either a, b or c enter, turn off HSM and set mode to Home. Would I use the change element to capture state of a, b and c on initialization? How would I handle the logic of if either a, b or c; arrive do x or if everyone leaves do y. I have this in rule machine today but I’m struggling to grasp how to translate it into node-red. Any pointers/examples would be appreciated.

Thanks!

You're sure taking an interesting path.. :smiley:

You don't happen to have a MORE complicated initial Rule to try? :smiley:

BUT... the solution is to slice it into 'modules'

Get Presence working. Extend it to provide outputs for your Combinations.
Get HSM In and Out.. so you know how to set a message to include what HSM needs.

THEN start to join them into the complicated functionality. Inject and debug are your best friends.

ALSO.. I'd suggest you start a new Topic with Node-Red as the TAG. This way it becomes a kind of 'tutorial' to the next person that comes along... vs interleaving your needs with all the other messages. :slight_smile:

1 Like

And also decide if it's really worth moving the rule from HE to NR. What's the point/benefit? From my several days on this, I think some things are much simpler in HE to be honest. For motion lighting I'm definitely seeing a speed increase. And I do see the ease of editing/copying etc with NR. But for many rule configurations, HE seems much easier to set up due to its "vertical integration".

Holy Moly, I got it working with Telegram.
It's really fast too. Schweeet!

A ?simple? way to do this (taken from a much earlier post in this thread apologies to the original author for my laziness) is to assign a numeric value to each presence state either -1 for "left" and 1 for "arrived" and keep a running total in a global variable. something like this:

The above is hastily thrown together but hopefully you get the idea. The gray nodes are just NOOP nodes.. for display purposes only.

Also you would need to initialize your global to 3 as a ground state when everyone is home (or use 0 and adjust tests accordingly) and probably should enable the local file storage context which can persist global variables across reboots.

https://nodered.org/docs/user-guide/context

1 Like

I would just daisy chain the presence devices and check them all each time I get an event.

If all you want to know is any home / all away that is pretty straight forward in node-red (subjectively / in my opinion). Absolutely no need to store variables or do counters.

2 Likes

that's a good idea.. even easier.. maybe! :thinking:

Something kind of like this:

  • If you get a not present event, the top swim lane checks every person to see if they are all away, if it gets to the end of the chain then everyone is away and I do away logic - set HSM away, change mode, turn off lights, whatever. Since it is just checking the cached value in node-red, there is no extra load on the Hubitat hub in doing this.

  • If you get a present event, you know at least one person is home, so can just go straight to your "is home" logic - turn off HSM, change mode, whatever.

4 Likes