Node-RED nodes for hubitat

Out of curiosity, have you tried this using the built-in range node? Or is that what you used for the scaling operation? I had assumed you using a function node ....

1 Like

@fblackburn
Correct. Clicking Configure webhook fixes issue.
NR along with HE has static IP..
Didnt think to turn on active debug.. have now done so
Definitely fixes some network magic!!

If it happens again, ill definitely test with full re-deploy first to test!

1 Like

I have been using a function as I also format the command into the format required by the controller.

Even if I had used the range node going from 100 -> 255 -> 100 works, but going 255->100->255 does not work correctly for all values in the 0-255 range.

Had some node red weirdness the other day. I was setting up a virtual button via maker api and the device node, but the node would simply not register button pushes. After a bit of random fiddling with the device on HE and the node it decided to work.

Also I've noticed that if I take my pi offline and reconnect later, sometimes some of the command nodes need to be 'relinked' to HE maker api before they would function properly.

What do you mean by 'relinked' ? It's hard to debug without knowing specific steps you have done. But I know it's hard to remember all steps when things don't work !! :laughing:

You can look at the NR log, it should have more info

The command node is really basic node. I mean, it's only a request to HE. Another test would be to go to HE Maker API page and click on url to be sure everything is ok
Screenshot from 2020-10-23 16-37-10

YEP!

The strange thing is that the command/device nodes are correctly populated with the maker api and device parameters yet do not seem to connect to the virtual device after the node red pi is powered back on.

Essentially I have to redo the node in order for it to work. I must stress that this only happens randomly with some nodes yet others will be ok!

I'll keep better track of it the next time this happens and report back.

1 Like

Hi NR Gurus :slight_smile:

I'm using a simple motion lighting routine which works ok, but would like to improve it....

The countdown timer starts if any sensor turns "inactive", which is fine, but I'd prefer to check if ALL the sensors are "inactive" instead, to make it better.

Any simple way to do this? I played with a boolean but couldn't work out how to achieve the result I want.

Put extra device node + switch node for each device you want to check in a chain/serially. Then if any of them are wrong mode the flow chain stops.

2 Likes

Ah ok. But I'd need 3 sets right? Because I have 3 sensors in this room. So 3 rows including all 3 sensors in each, because any one of them can go inactive and then I need to check all the others are also inactive, right? Seems a bit messy. In another room I have 4 sensors.

One row with all the sensors. Feeding into the one row would be a device node for each of the sensors to kick it off.

Who cares if it is messy? You don't pay by the node # or square inch of screen real estate. Wrap it in a subflow if it isn't visually to your liking.

Here is an example from my home/away presence logic (5 devices):

3 Likes

Ok yeah, good point. Thanks @JasonJoel.

All that said, you could probably do boolean logic for it too. Or maybe some other set of 3rd party nodes. I'm not saying that isn't possible - I just don't know offhand.

If I can do it with built-in nodes, I almost do it that way and move on. The other benefit that method has is that you can visually see EXACTLY what the flow does - no diving into node properties or function code. To me that is huge, but it depends on how good you are at figuring things out 6 months later, or how many other people other than yourself need to understand the flow.

2 Likes

Fair enough. I'll start with your approach and then maybe still try to learn how to use a Boolean too. Cheers.

or the ultimate boolean route is

and you keep adding sensors to the Motion to bool

[{"id":"1fd9fab.1df3405","type":"hubitat device","z":"9688652a.2c0f68","name":"MBath: Mirror Motion","server":"f17566a9.c052b8","deviceId":"2074","attribute":"motion","sendEvent":true,"x":140,"y":360,"wires":[["647b2033.4a62f"]]},{"id":"79340c6d.54ca54","type":"hubitat device","z":"9688652a.2c0f68","name":"MBath: Shower Motion","server":"f17566a9.c052b8","deviceId":"1138","attribute":"motion","sendEvent":true,"x":140,"y":440,"wires":[["647b2033.4a62f"]]},{"id":"9c9bf667.4ca548","type":"BooleanLogicUltimate","z":"9688652a.2c0f68","name":"","filtertrue":"both","persist":true,"sInitializeWith":"WaitForPayload","triggertopic":"trigger","outputtriggeredby":"all","inputCount":2,"topic":"result","x":520,"y":400,"wires":[[],["8ee27c2d.b71a9"],[]]},{"id":"647b2033.4a62f","type":"change","z":"9688652a.2c0f68","name":"Motion to Bool","rules":[{"t":"set","p":"payload","pt":"msg","to":"msg.payload.value = \"active\" ? true : false","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":400,"wires":[["9c9bf667.4ca548"]]},{"id":"f17566a9.c052b8","type":"hubitat config","z":"","name":"","usetls":false,"host":"192.168.1.50","port":"80","appId":"3424","nodeRedServer":"http://192.168.1.50:1880","webhookPath":"/hubitat/webhook","autoRefresh":true,"useWebsocket":false}]

1 Like

Yup, that looks pretty straight forward too. :+1:

1 Like

I actually use both methods. My early flows have no Boolean, now if it is 2 inputs, no Boolean, more than that or complex logic, Boolean.

1 Like

So you just do something like this for the change node (I didn't look at your exported flow):
msg.payload = expression, expression >> payload.value = "present" ? true : false

EDIT: Never mind I see it in your exported flow. Yours is for motion (which was the question, after all). My example was presence.

I think I stole that method from you:)

One thing I should mention is the Ultimate Boolean doesn't save the states (regardless if you have the "remember" checkbox checked or not) if you are running Node-RED in a container.

At least it doesn't in any of my container based installs.

It does save it as expected in my normal ubuntu installs, though.

I KNEW there was a reason I decided not to use it... Just couldn't remember why until I went and looked.

I don't know about that, but it also passes multiple true, false in a row which you have to account for.

1 Like