Node-RED nodes for hubitat

You should report it to @fblackburn - post the issue on Github. Easier for them to track.

Not here. I have 6 presence nodes, and they are all showing correct status. I just checked as the wife is at the store - it shows her as not present as expected.

Is it possible that your device changed states while node-red was down? Remember if there is a loss of communication between node-red and Hubitat, the nodes do not do anything to get back in sync... They stay as-is until the next event is received.

  1. Try rebooting Node-RED and see if the state becomes correct, If so, it likely is not a node issue at all, and it just missed the event for some reason.
  2. Verify that MakerAPI post events are making it to Node-RED correctly. AKA verify states change in node-red post reboot.

The only time the cache is rebuilt from scratch is:

  1. Reboot of node-red
  2. Reboot of Hubitat, but only if you have enabled the new systemStart rebuild option in the node-red config node:
3 Likes

Anyone have a few minutes to help me with a flow? I've been fighting with it for a few weeks now, and it's rather erratic behavior. I had some services break on my pi, which I fixed and things seem to be running better now, but this flow feels like it should work and it's not. So I need some input on it
The whole picture
When either motion sensor is triggered and the lights are off, then I need the lights at 100%
when the tv (ps4, roku, cable) is turned on with harmony then I need the lights to dim to 25% and stay there for the duration. Until the tv goes back off. Then return to 100%.
when the room is again inactive and the tv is off, then the lights should turn off.
Everything works except for the lights turning off. I'm sure it's how I have the flow written, but I've tried so many different things that I can't remember what I have and haven't done yet.
So I need someone to set me straight before I go nutz! :grin:

[{"id":"9e0d01e9.3439e","type":"comment","z":"b8d19009.18291","name":"Basement Living Room","info":"","x":100,"y":920,"wires":[]},{"id":"a64373c8.db324","type":"hubitat device","z":"b8d19009.18291","name":"PS4","server":"791ed0f2.6643c","deviceId":"924","attribute":"switch","sendEvent":true,"x":210,"y":1060,"wires":[["87856647.e65168"]]},{"id":"d6e89f2f.454ff","type":"hubitat device","z":"b8d19009.18291","name":"ROKU","server":"791ed0f2.6643c","deviceId":"923","attribute":"switch","sendEvent":true,"x":210,"y":980,"wires":[["87856647.e65168"]]},{"id":"72db4005.6e4dc","type":"hubitat device","z":"b8d19009.18291","name":"TV","server":"791ed0f2.6643c","deviceId":"921","attribute":"switch","sendEvent":true,"x":110,"y":1020,"wires":[["87856647.e65168"]]},{"id":"87856647.e65168","type":"switch","z":"b8d19009.18291","name":"PS","property":"payload.currentValue","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":350,"y":1020,"wires":[["b443e86f.5b8278","aa973cbf.e829a","29537609.59212a"]]},{"id":"aa973cbf.e829a","type":"hubitat command","z":"b8d19009.18291","name":"Basement Lamp E 25%","server":"791ed0f2.6643c","deviceId":"1494","command":"setLevel","commandArgs":"25","x":770,"y":1020,"wires":[[]]},{"id":"29537609.59212a","type":"hubitat command","z":"b8d19009.18291","name":"Basement Lamp W 25%","server":"791ed0f2.6643c","deviceId":"1492","command":"setLevel","commandArgs":"25","x":1010,"y":1020,"wires":[[]]},{"id":"b443e86f.5b8278","type":"hubitat command","z":"b8d19009.18291","name":"Basemen Lamo C 25%","server":"791ed0f2.6643c","deviceId":"1493","command":"setLevel","commandArgs":"25","x":530,"y":1020,"wires":[[]]},{"id":"782a2f71.671f7","type":"change","z":"b8d19009.18291","name":"save BPS4 status","rules":[{"t":"set","p":"BPS4_status","pt":"flow","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1850,"y":1220,"wires":[[]]},{"id":"5afc07ce.883828","type":"hubitat device","z":"b8d19009.18291","name":"PS4","server":"791ed0f2.6643c","deviceId":"924","attribute":"switch","sendEvent":true,"x":1690,"y":1220,"wires":[["782a2f71.671f7"]]},{"id":"5c2474d3.f4250c","type":"change","z":"b8d19009.18291","name":"save BROKU status","rules":[{"t":"set","p":"BROKU_status","pt":"flow","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1860,"y":1280,"wires":[[]]},{"id":"df0dec93.e7ec","type":"hubitat device","z":"b8d19009.18291","name":"ROKU","server":"791ed0f2.6643c","deviceId":"923","attribute":"switch","sendEvent":true,"x":1690,"y":1280,"wires":[["5c2474d3.f4250c"]]},{"id":"665caee.d42355","type":"change","z":"b8d19009.18291","name":"save BTV status","rules":[{"t":"set","p":"BTV_status","pt":"flow","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1840,"y":1340,"wires":[[]]},{"id":"b8894fa2.b28e6","type":"hubitat device","z":"b8d19009.18291","name":"BTV","server":"791ed0f2.6643c","deviceId":"921","attribute":"switch","sendEvent":true,"x":1690,"y":1340,"wires":[["665caee.d42355"]]},{"id":"c8d012e0.b1a69","type":"hubitat device","z":"b8d19009.18291","name":"BLCenter","server":"791ed0f2.6643c","deviceId":"1493","attribute":"switch","sendEvent":true,"x":2040,"y":1220,"wires":[["ace8333e.70ac7"]]},{"id":"ace8333e.70ac7","type":"change","z":"b8d19009.18291","name":"save BLCenter status","rules":[{"t":"set","p":"BLCenter_status","pt":"flow","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2220,"y":1220,"wires":[[]]},{"id":"7112f970.71a158","type":"hubitat device","z":"b8d19009.18291","name":"BLEast","server":"791ed0f2.6643c","deviceId":"1494","attribute":"switch","sendEvent":true,"x":2040,"y":1280,"wires":[["3235f02a.c7cc4"]]},{"id":"3235f02a.c7cc4","type":"change","z":"b8d19009.18291","name":"save BLEast status","rules":[{"t":"set","p":"BLEast_status","pt":"flow","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2210,"y":1280,"wires":[[]]},{"id":"98f7310a.e8bae","type":"hubitat device","z":"b8d19009.18291","name":"BLWest","server":"791ed0f2.6643c","deviceId":"1492","attribute":"switch","sendEvent":true,"x":2040,"y":1340,"wires":[["d440eb80.bc57b8"]]},{"id":"d440eb80.bc57b8","type":"change","z":"b8d19009.18291","name":"save BLWest status","rules":[{"t":"set","p":"BLWest_status","pt":"flow","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2210,"y":1340,"wires":[[]]},{"id":"3b86a67a.765dda","type":"stoptimer","z":"b8d19009.18291","duration":"3","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":860,"y":1180,"wires":[["f52bcdd8.d4837","eba4f7a8.170218","ca8e7615.285c78"],[]]},{"id":"6925c6fe.0e75e8","type":"hubitat device","z":"b8d19009.18291","name":"Basement Living Room Motion","server":"791ed0f2.6643c","deviceId":"200","attribute":"motion","sendEvent":true,"x":230,"y":1200,"wires":[["c11e0acf.a50f88"]]},{"id":"c11e0acf.a50f88","type":"switch","z":"b8d19009.18291","name":"MS","property":"payload.currentValue","propertyType":"msg","rules":[{"t":"eq","v":"active","vt":"str"},{"t":"eq","v":"inactive","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":570,"y":1180,"wires":[["e61586ac.a90e38"],["b1b0a9b.fb4e458"]]},{"id":"e61586ac.a90e38","type":"change","z":"b8d19009.18291","name":"stop the timer","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":1120,"wires":[["3b86a67a.765dda","63558ed6.21e74"]]},{"id":"bd597774.4ac548","type":"hubitat device","z":"b8d19009.18291","name":"ROKU","server":"791ed0f2.6643c","deviceId":"923","attribute":"switch","sendEvent":true,"x":1110,"y":1120,"wires":[["e71e66a9.b9a3d8"]]},{"id":"e71e66a9.b9a3d8","type":"switch","z":"b8d19009.18291","name":"Off","property":"payload.currentValue","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1230,"y":1120,"wires":[["8e476fa8.725f6"]]},{"id":"8e476fa8.725f6","type":"hubitat device","z":"b8d19009.18291","name":"TV","server":"791ed0f2.6643c","deviceId":"921","attribute":"switch","sendEvent":true,"x":1350,"y":1120,"wires":[["a48bc19c.016c6"]]},{"id":"a48bc19c.016c6","type":"switch","z":"b8d19009.18291","name":"Off","property":"payload.currentValue","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1470,"y":1120,"wires":[["417a6cc0.a938f4","de3f3199.a7d04","538653f3.5db4dc"]]},{"id":"a8069aac.63f628","type":"hubitat device","z":"b8d19009.18291","name":"Basement Steps Motion Lower","server":"791ed0f2.6643c","deviceId":"1428","attribute":"motion","sendEvent":true,"x":190,"y":1140,"wires":[["6925c6fe.0e75e8"]]},{"id":"63558ed6.21e74","type":"hubitat device","z":"b8d19009.18291","name":"PS4","server":"791ed0f2.6643c","deviceId":"924","attribute":"switch","sendEvent":true,"x":870,"y":1120,"wires":[["63bef40f.4f693c"]]},{"id":"63bef40f.4f693c","type":"switch","z":"b8d19009.18291","name":"Off","property":"payload.currentValue","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":990,"y":1120,"wires":[["bd597774.4ac548"]]},{"id":"ca8e7615.285c78","type":"hubitat command","z":"b8d19009.18291","name":"Basement Lamp E Off","server":"791ed0f2.6643c","deviceId":"1494","command":"off","commandArgs":"","x":1520,"y":1180,"wires":[[]]},{"id":"f52bcdd8.d4837","type":"hubitat command","z":"b8d19009.18291","name":"Basement Lamp W Off","server":"791ed0f2.6643c","deviceId":"1492","command":"off","commandArgs":"","x":1080,"y":1180,"wires":[[]]},{"id":"eba4f7a8.170218","type":"hubitat command","z":"b8d19009.18291","name":"Basemen Lamo C Off","server":"791ed0f2.6643c","deviceId":"1493","command":"off","commandArgs":"","x":1300,"y":1180,"wires":[[]]},{"id":"417a6cc0.a938f4","type":"hubitat command","z":"b8d19009.18291","name":"Basement Lamp E 100%","server":"791ed0f2.6643c","deviceId":"1494","command":"setLevel","commandArgs":"100","x":2150,"y":1120,"wires":[[]]},{"id":"538653f3.5db4dc","type":"hubitat command","z":"b8d19009.18291","name":"Basement Lamp W 100%","server":"791ed0f2.6643c","deviceId":"1492","command":"setLevel","commandArgs":"100","x":1670,"y":1120,"wires":[[]]},{"id":"de3f3199.a7d04","type":"hubitat command","z":"b8d19009.18291","name":"Basemen Lamo C 100%","server":"791ed0f2.6643c","deviceId":"1493","command":"setLevel","commandArgs":"100","x":1910,"y":1120,"wires":[[]]},{"id":"b1b0a9b.fb4e458","type":"switch","z":"b8d19009.18291","name":"PS4","property":"BPS4_status","propertyType":"flow","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":690,"y":1240,"wires":[["e54f2d0f.0ed"]]},{"id":"e54f2d0f.0ed","type":"switch","z":"b8d19009.18291","name":"ROKU","property":"BROKU_status","propertyType":"flow","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":810,"y":1240,"wires":[["3dd5340e.c8085c"]]},{"id":"3dd5340e.c8085c","type":"switch","z":"b8d19009.18291","name":"BTV","property":"BTV_status","propertyType":"flow","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":930,"y":1240,"wires":[["3b86a67a.765dda"]]},{"id":"791ed0f2.6643c","type":"hubitat config","z":"","name":"Hubitat","usetls":false,"host":"192.168.86.32","port":"80","appId":"3451","nodeRedServer":"http://192.168.86.51:1880","webhookPath":"/hubitat/webhook_","autoRefresh":true}]

I just had a quick look at your flow after importing into my server, and one thing I noticed straight away is that you seem to have "Send events" enabled on each one of your device nodes, even when you're just checking a value/status. Is that intentional, or an oversight? We usually only want that option ticked on the nodes whose events we want to trigger our flows. I believe that having that enabled on other nodes within the flow can lead to unexpected bahavior. I don't know if this is where your problem is, but it's the first thing I noticed while going through your flow.

I'll change it. Thank you for looking

@JasonJoel Thanks for the info. I took your advises and restarted my Node Red and Hubitat Hub and I think maybe that was the problem and didn't realize or think about sync. I also did as you suggested so If I did a reboot it would rebuild the cache. Again, thanks for the help.

3 Likes

Were you ever able to get this going in the HASSIO version of NodeRED or was the only solution to install NR on another device??

I'm experiencing the same thing you were where I can control devices and retrieve info on devices when deploying or a manual inject, but not getting anything on an event.

Yes I am running node-red in the HASSIO plugin. I can't remember just what solved my initial problem though.

How do the POST events from Hubitat make it to the node-red container (as opposed to going to the HA container for instance)? I would think that would have taken an extra config step?

I'm having the damnedest of times trying to get Hubitat + Home Assistant + Node Red all working together.

There seems to be two different approaches and both equally suck

I've gone from using NR stand-alone to using it in HA docker as an addon (and back to stand-alone). I have run it successfully in both scenarios. One thing (and I don't remember if it was during my initial stand-alone or when I switched to HA addon) was the that the NR version installed was < 1.x. This caused my all sort of problems where some messages would come, but then they'd die the as soon as they hit any other HE node. So for @mrobi can you double check the version of NR you are running?

As for @morningz can you be more specific as to what issue you are seeing.

Think hard!! LOL Did you setup MakerAPI with the HA port or the NR port?
I'm assuming it's got something to do with my webhook settings. I've tried with and without the login info for NR. I've tried both ports.

v1.0.5

Does this help ?? I do not expose this nodered to the outside world and have removed SSL and DuckDNS access - and maybe that last line 'leave back door open' I changed...

credential_secret: xxxxxxxx
dark_mode: false
http_node:
  username: ''
  password: ''
http_static:
  username: ''
  password: ''
ssl: false
certfile: fullchain.pem
keyfile: privkey.pem
require_ssl: false
system_packages: []
npm_packages: []
init_commands: []
log_level: info
port: 1880
leave_front_door_open: true

It's likely very vulnerable now and I should add some bits back into that config but I'm pretty sure it's protected on my Intranet. Change that last entry at your own risk.

Just to confirm my nodered is locally accessible on
http://192.168.1.150:1880
and that IP is the host NUC on which hassio is installed - it is not the docker container IP address 172.x.x.x

image

1 Like

I added the leave front door open to my config for testing.
I assume 33737 is your HA port.
I wonder if it's because I'm using the HA integration that's using MakerAPI already?
So I essentially have 1 instance going to http://HAIPADDY:8123 and another going to http://HAIPADDY:8123/hubitat/webhook/

You will need to create two separte Maker API applications and setup the 'URL to send device events to by POST' to be different in each one - one pointing to the HA Hubitat integration and one to the nodered one.

TBH that 33737 may relate to another integration .. I forget now.. it's probably this..

http://192.168.1.150:1880/hubitat/webhook

So I installed HA via the image method detailed here

I love the idea of the clickable floorplan of HA as well as the remote access through their Nabu Casa service. Plus once I get rolling it looks like it's relatively easy to pull in camera feeds into the dashboard as well. I'm super intrigued by the Telegram bot integration as well

My hope was to somehow leverage Node-RED to have this setup:

  • Hubitat to add/manage the 70 or so devices (because HE appears to be way easier to manage devices than HA)
  • MakerAPI / Node-RED / and the Hubitat palette from this thread to funnel/expose my devices to HA as entities

That second point seems to have two ways to do it:

  1. Custom app/drivers here on HE to leverage MQTT to bridge the two. Sorry, I wasn't a fan of the setup, a lot of it just didn't make sense: like for instance, do I need to worry about "homie" at all or not? It also seems to be way too chatty on the network for my personal taste. Ah well, that code may work for others, but not for me as in the end I'm trying to run stuff on the HE as little as possible (as it stands right now, I have MakerAPI installed and that's it).

  2. Trying to go the other way with this custom HA/Node-RED code that has nodes to create entities from other Node-RED nodes. I've actually got this kind of working as shown in the screen shot below as an example: I can actually control my blinds from either HE or HA. Issues with this route include: limited entity types (sensor, binary sensor and switch) and an annoying ghost event that fires closing of the blinds every time I restart HA, which to be honest hasn't been very often, but it has been annoying when I tinker with it.

I kind of got fed up with both those routes and thought I'd get my GoControl Z-Wave/Zigbee stick up and running to see about streamlining things. I've got it plugged into the Pi, HA sees it just fine and I have both the ZHA integration and Z-Wave integrations installed and working with a few devices paired to each radio. But: paired a Sengled dimmer to it, HA had no idea what that was. Paired a Zooz ZEN31 LED dimmer to it, no idea what it was (some custom editing of the Z-Wave config file fixed this, but that is not something I want to be doing on a consistent basis). This isn't the route to go if that is the pain of pairing devices to it.

I was actually trading Twitter messages from Rob at "The Hook Up" today as he was intrigued by a comment I made on his video today talking about blinds. we seem to have the common goal of using HE as the conduit for devices in NR and HA

Maybe I just can't decide what I want in the end, maybe I'm just overthinking things. But I do like to tinker around and I am a huge fan of the concept of MQTT, so I'm still hoping I can get my setup of HE > NR > HA all straightened out.

Here is that custom HA Node-RED palette in action that takes my three IKEA blinds paired to HE and turns them into entities for use in my Lovelace dashboard.

zq3bWsqU

And as you can see here I can see and can control them from either platform which is kind of neat

Thanks for reading!

Just for fun changed my port to 33737 and I'm getting somewhere. I'm now getting events which is something I wasn't getting before so thank you!

I'm still not getting mode change events though even though I have the location events switch turned on.

You do know that there is a HE --> HA integration as well, right? You didn't list that as an option, so thought I would double check...

You could just go HE --> HA and not mess with Node-RED at all.

I for sure want NR in the mix.. dragging and dropping nodes = better than writing YAML (yuck!)

OK... But if you use the linked integration everything shows up in HA with no yaml written at all... But whatever makes the most sense to you.

Just seems to me if you want all HE in HA, then that integration is EXACTLY what you want?

But if you want to do your logic in Node-RED, then yeah I guess it may make more sense to go to Node-RED first, instead of HE --> HA --> Node-RED --> HA ...