Node-RED nodes for hubitat

Thanks Jason, I really like that deadman switch idea :+1:

I do something similar, but http the maintenance page, and look at the status code.

What address do you use for that?

<hub-ip>:8081

1 Like

I'll post my flow when I get to my computer.

1 Like

There's a nice hub performance monitor flow from @btk

Flow

[{"id":"83cda3e7.c1d7f","type":"http request","z":"9eecab83.0e84c8","name":"","method":"GET","ret":"txt","paytoqs":false,"url":"http://192.168.2.3:8081/","tls":"","persist":false,"proxy":"","authType":"","x":290,"y":60,"wires":[["61f11909.de6518"]]},{"id":"84e1f3d7.498ae","type":"inject","z":"9eecab83.0e84c8","name":"Every 2 min","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"120","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":60,"wires":[["83cda3e7.c1d7f"]]},{"id":"b3dcb5ad.3926a8","type":"switch","z":"9eecab83.0e84c8","name":"","property":"statusCode","propertyType":"msg","rules":[{"t":"neq","v":"200","vt":"num"},{"t":"eq","v":"200","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":570,"y":60,"wires":[["3a70851b.9dcd8a"],["51eb762c.b57398"]]},{"id":"234bbb36.d3cc74","type":"pushover api","z":"9eecab83.0e84c8","keys":"2a52b42c.7e9f0c","title":"","name":"Push: Hub Offline","x":1130,"y":160,"wires":[]},{"id":"356381ee.2c6bae","type":"change","z":"9eecab83.0e84c8","name":"Set Text Message","rules":[{"t":"set","p":"payload","pt":"msg","to":"Hubitat is Offline!","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":790,"y":160,"wires":[["234bbb36.d3cc74"]]},{"id":"51eb762c.b57398","type":"change","z":"9eecab83.0e84c8","name":"STOP","rules":[{"t":"set","p":"payload","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":180,"wires":[["3a70851b.9dcd8a"]]},{"id":"3a70851b.9dcd8a","type":"stoptimer-varidelay","z":"9eecab83.0e84c8","duration":"5","durationType":"num","units":"Minute","payloadtype":"num","payloadval":"0","name":"","reporting":"last_minute_seconds","x":540,"y":160,"wires":[["356381ee.2c6bae","9e586716.aab128"],[],[]]},{"id":"61f11909.de6518","type":"rbe","z":"9eecab83.0e84c8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"statusCode","x":430,"y":60,"wires":[["b3dcb5ad.3926a8"]]},{"id":"2a52b42c.7e9f0c","type":"pushover-keys","z":"","name":""}]

2 Likes

I got that to work, thanks!

2 Likes

Good deal, glad to hear it.

I do it this way instead of just polling the HTTP interface because what I really want to know is if automations are happening, and working.

If the interface is dead but automations are still happening, I'm still pretty happy.

But if the interface is accessible, but I can't read or write from devices then I'm not happy.

So I think I actually toggling a device is a better representative test.

1 Like

Is there an easy way for Node Red to check this page in Hubitat and determine when the outcost changes to 3 (or above). I would then like to do something (reboot the device). I know how to reboot the device, but have no idea where to start for evaluating a figure on a random/changeable line on a webpage. Is it even possible? The above page is from http://HE-hub-ip/hub/zigbee/getChildAndRouteInfo

An idea - You can use the HTTP request node and parse the results either in a function node or by using a split node...

From there you can add a switch node to filter out the one you want... or do something else..

:slightly_smiling_face:

edit: for the http node return use "a UTF-8 string" instead of "a parsed Json object".. will avoid errors at the beginning.

Thanks very much for the flow. I have used that as a basis for my final solution which is now up an running.

I actually changed mine slightly by using the Zigbee route page (http://<hub_id>//hub/zigbee/getChildAndRouteInfo) as the target though rather than the maintenance page.

By using that I can detect if my Zigbee radio goes offline but the hub is still running, which has happened in the past. I think I read that if the hub gets overloaded the Zigbee radio is like the canary in the mine and dies first.

1 Like

I'm trying to get this flow to work but I'm not getting something to work correctly? I have two switches that I use. I would like to turn on the virtual switch with either switch, but would like both to be off before it turn off the virtual switch? I have try various nodes but still no luck. Thanks

I'd use an ultimate boolean with the Or output

Code
[{"id":"8f6d3519.3d8e78","type":"hubitat device","z":"52fd730a.4bc1bc","name":"Craig is Up","server":"f17566a9.c052b8","deviceId":"3002","attribute":"switch","sendEvent":true,"x":430,"y":1140,"wires":[["cd7c66fc.3b1508"]]},{"id":"a49aaee0.433ff","type":"hubitat device","z":"52fd730a.4bc1bc","name":"Guest Room: Active","server":"f17566a9.c052b8","deviceId":"3103","attribute":"switch","sendEvent":true,"x":450,"y":1200,"wires":[["cd7c66fc.3b1508"]]},{"id":"cd7c66fc.3b1508","type":"change","z":"52fd730a.4bc1bc","name":"Switch to Bool","rules":[{"t":"set","p":"payload","pt":"msg","to":"msg.payload.value = \"on\" ? true : false","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":1140,"wires":[["8d63e89a.69a378"]]},{"id":"8d63e89a.69a378","type":"BooleanLogicUltimate","z":"52fd730a.4bc1bc","name":"","filtertrue":"both","persist":true,"sInitializeWith":"false","triggertopic":"trigger","outputtriggeredby":"all","inputCount":2,"topic":"result","x":690,"y":1240,"wires":[[],["47534a0f.527534"],[]]},{"id":"47534a0f.527534","type":"switch","z":"52fd730a.4bc1bc","name":"Check True","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":880,"y":1240,"wires":[["84472e9d.6b8ad"],["cfea71dd.42062"]]},{"id":"84472e9d.6b8ad","type":"hubitat command","z":"52fd730a.4bc1bc","name":"Voice Off","server":"f17566a9.c052b8","deviceId":"2684","command":"on","commandArgs":"","x":1100,"y":1160,"wires":[[]]},{"id":"cfea71dd.42062","type":"hubitat command","z":"52fd730a.4bc1bc","name":"Voice Off","server":"f17566a9.c052b8","deviceId":"2684","command":"on","commandArgs":"","x":1100,"y":1240,"wires":[[]]},{"id":"f17566a9.c052b8","type":"hubitat config","z":"","name":"","usetls":false,"host":"192.168.2.3","port":"80","appId":"3424","nodeRedServer":"http://192.168.2.9:1880","webhookPath":"/hubitat/webhook","autoRefresh":true,"useWebsocket":false}]
1 Like

Lanna side and Lee side need to be connected to the switch for a start.

Then set switch for msg.payload and add 'on' and route to the on command.

I would then setup 2 other flows, one starting with Lee side off that checks if Lanna is off and one for Lanna off that checks if Lee is off. And then issue command accordingly

1 Like

@napalmcsr Thanks I was using another one of yours from the Node Red example with the ultimate boolean but without the check true switch. The check true switch was the missing piece thank you so much for sharing it now works. Hubitat has a wonderful community. @Shaneb thanks for the suggestion.

1 Like

That's basically how I would (and do) do it for a small number of conditions to check.

Is any one having issues with inconsistencies in STATEs between the Node Red server and the Hubitat hub?

I've been having issues where the node red server thinks a certain switch is in the "ON" state but in the HE hub it is actually "OFF" (it is also OFF in reality).

This issue has resulted in some motion lighting flows to not execute properly because in all of my flows I always have it check the current STATE of the switch before deciding to send the command. Hence if the STATE is wrong then the flow wouldnt run correctly.

Spec:
Hubitat C-5
INTEL NUC BXNUC10I5FNH1 (i5-10210U)
INTEL SSD
Micron 16GB Memory
Ubuntu 20.04 LTS
Docker v19.03.12
Node Red v1.1.3

The NUC itself only runs Ubuntu + Docker + Node Red and nothing else.

Also note both HE and NUC are connected directly to the router by CAT6 ethernet cable.

Any help would be greatly appreciated

I haven't been seeing that - at least not regularly enough to notice. I am using the nodes w/the default web hook updating method not web socket.

2 Likes

I am also using the default webhook updating method.