Node Red and Zigbee on a RASPi with no network dependence. Possible?

I currently have all my logic in Node Red on a Raspi 3B+ . Using the Node Red Hubitat nodes it connects to 2 HE hubs that run my Zigbee devices, and others (like IotaWatt and my AV gear) over the LAN. Recently I have had issues with my router that meant a lot of rebooting etc and obviously during that time my automations all stopped because the brain of the system couldn't talk to the vital organs. I don't mind the other LAN devices dropping off so much but having the lighting etc stop was a pain.

So, that got me wondering if I could put a Zigbee USB stick in the Pi and directly run my Zigbee devices on that so that it was network independent. I started looking into it and Zigbee2MQTT seems to be the "go to" system, but unless I am misunderstanding it, even if it's all running on one Pi, because there is a broker/client link in there it still depends on the Network being up to run. Is that correct?

I have found node-red-contrib-zigbee (node) - Node-RED which looks like it is trying to do what I want, but that seems to be still in early development and throws an error when I try to load it.

Any other options anyone knows of to effectively make a self contained Zigbee hub on an Pi with Node Red?

I know that HE offers Zigbee and Logic on one hub with no network dependence , but I much, much prefer using Node Red for my rules and have so much time invested in that system, that I wouldn't go back to RM.

So you are asking how to get rid of Hubitat from your setup right?

Honestly this question may be best asked in the forums for whatever alternative platforms you are looking at instead of the one you are looking to move from.

2 Likes

I have been thinking about this more this morning and I have to ask if this is a network design issue more then where the processing is taking place. What i mean by that is if you have your Node-Red and Hubitat attached to the same layer 2 switch and on the same subnet, the only thing that should impact there connectivity to each other is that specific switch being restarted. This may be as simple as just adding a switch and connecting both devices to it. That doesn't eliminate that switch but should minimize the risk of your HA going down and require no changes to your HA Environment technically.

Can you create a picture as to what connectivity is between your Node-Red instance and the Hubitat hub?

1 Like

I think you were right in your 1st reply. He's looking to move all of his zigbee stuff to the rpi that node red is on. This may be a good thread for @aaiyar to jump in on

1 Like

If your Hubitat hubs and SBC are on the same LAN segment (mine are on the same switch, all three have static IPs), they should work with each other whether your WAN connection is up or not (or router is up or not). (reiterating what @mavrrick58 wrote above)

And FWIW, the zigbee2mqtt connection to node-red can be over the loopback address (127.0.0.1 or localhost) if they are both on the same SBC, so there is no need for LAN connectivity at all.

Here are the configuration nodes for my zigbee2mqtt node and mqtt node:

1 Like

It is a valid point, and yes I may end up getting rid of Hubitat if there is a better alternative for my needs, but I know there are a lot of Node Red and network experts on here and I have generally found this is a great forum for exactly this sort of question.

Also it's a bit Catch 22 as until I know what exactly I am moving too, I don't know where to ask the question.

Plus, I posted it in the Lounge which I thought was for general discussions, not just HE specific.

Thanks for that info, very useful. :+1:

So are you using zigbee2mqtt for your zigbee devices instead of HE or as well as? How well is it working?

1 Like

The hubitat really is the best most flexible device controller in a nice convenient package. I could not imagine not using it for me or my clients. For my use case it's reliable, cost effective and easily managed.

Having said that for my Home system I am now testing Home Assistant with the Node-RED and Mosquitto MQTT Broker addons + HE.. This has allowed me to take advantage of some of the cool features of both HA and Node-RED while still being able to keep all my devices under the HE umbrella. You might want to look at that configuration. I would recommend an RPi4 though with more memory. You can easily bridge devices to and from the Hubitat using HA as well.

Note: I am not planning to use HA for my clients though.. the potential for support issues exceeds my tolerance/willingness to handle level.

3 Likes

This. Only my non-compatible zigbee devices.

2 Likes

I agree up to a point and I do like a lot about Hubitat. It is Rule Machine that let's it down IMO.

Initially, when I got my first HE (C4) I built all my rules on RM, but when I started looking at Node Red and testing that I really much preferred that for creating logic. Maybe the graphic style of it suits me better, I don't know, but after using Node Red for a while, RM seemed very cumbersome and tedious to create/edit/copy rules by comparison. So I started migrating my rules over and now they are all on NR.

Also bizarrely, even though there was an extra "hop" involved, I found my rules (eg motion lighting) ran quicker when run on Node Red (using the excellent Hubitat Nodes and Maker API) calling back to zigbee devices on Hubitat, than when running directly on HE with RM.

So, now that I just use my Hubitats as Zigbee device Hubs controlled by Node Red, to me the next logical step would be to have the Zigbee devices directly on the same Raspi as Node Red as well. How practical that is and how reliable it would be compared to the same devices on HE, I don't know, that's what I'm just starting to look at. I have a spare Raspi set up with NR running and have just ordered a Zigbee USB stick so that I can test out the various options.

It can be very reliable. However, there are a lot of niceties in the Hubitat nodes for Node-RED that aren't there in the zigbee2mqtt nodes. Just be prepared to code around that.

1 Like

So try HA + NR - you can easily migrate your NR stuff. There are minor differences in the URLs used so you'd have to tweak your HE configs. Once that is done you can experiment with the USB stick when it comes in and still have the benefit of your existing HE connections.

I have tried HA in the past, but to be honest I don't see what I am gaining by adding that into the mix?

I am trying to minimize the number of different systems and am more than happy with Node Red being the "brains" of the operation. It runs all my rules and dashboards and controls my heating and ventilation directly via a relay board and temperature sensors attached directly to the Raspi. All I need on top of that a way to control my Zigbee devices. At the moment I use NR <-> Hubitat Nodes/Maker API. My proposal is to replace that with a Zigbee USB <-> NR either directly ideally or via zigbee2mqtt.

Where would HA fit into that an what advantage would it offer over either my existing solution or my proposed one?

I think the point of HA is to provide the niceties fo managing the zigbee devices directly.

HA is a platform that can provide the connectivity and allow you a local way in HA to run you Node Red Instance with all your flows as a addon to HA.

Just make sure you watch the cpu. I suspect that poor Pi3 cpu will be heavily taxed. I wouldn't atrempt this without a pi 4 with atleast 4 GB of memory and would probably do 8GB myself.

Honestly I wouldn't even do this on a pi. I would put it on a slightly old x86 cpu so to minimize the potential for lag or slowdowns. Do it with VMware or something similar so that you can virtualize it and move it between like hardware in case of failure for redundancy if i was going to go this far.

1 Like

I am using HA as an App Manager for the most part. I actually moved my Node-RED instance over when the Lutron button driver update caused my button-tap subflow to stop working. I had to do something quickly as my spouse approval factor was dropping precipitously. I originally set up an instance of HA to handle Lutron as a stop-gap measure and used the HA related nodes for my other RPi running NR. This seemed inefficient to have 2 separate HE companion servers so ended up installing the Node-RED addon in HA. Was able to get it working so migrated my existing NR setup over to the HA/NR server.

Was able to run the Mosquitto MQTT server using HA as well - this let me bypass the NR AEDES MQTT server which has less features. I use MQTT primarily for triggering "events" in NR like for storing data, handling modes etc.

To fair to the staff at HE they were very fast in releasing a legacy Lutron driver which kept the older behavior but I had already moved over at that point.

I would also say the downsides of HA are its complexity - things can go pear shaped quickly and if you are not technically inclined can be overwhelming, sometimes breaking updates, and the reliance on addon maintainers to keep their addons current with existing projects. Again no plans to use this for my clients but for my personal use and exploration it's fine.

Should mention - I have Lutron and Ring devices connected to HA and use those in NR to interact with my HE devices. Also have shutdown my old NR server which also was running HomeBridge. Playing around with the Apple Home connection as well.

I am definitely not going to go down the HA route. I can't remember the exact details now but I know I ended up being very frustrated with it. I still get cold sweats if I see a YAML file - indents, where, how many, how much arghhhhhhhhhh... :hot_face:

I will either stick with my current system, or if the experimentation with Node Red directly accessing Zigbee devices via a USB stick on the same Raspi works, maybe move over to that.

I will definitely be trying out @aaiyar 's way of making the zigbee2mqtt to Node Red link WAN/Router independent.

1 Like

To accomplish this you just need them on the same network subnet. You can do this even without a router or wan connection at all.

What do you have in between your node-red server and the hubitat. Is it just the router, a network switch, wifi, some mesh stuff some combination of both?

Firstly, a caveat is that i am a long way from being any sort of networking expert so my understanding and use of terminology may well vary from that of someone who knows what they are talking about!

My Raspberry Pi (running Node Red) is connected directly to one of the ports on my router. I have 2 Hubitat hubs (on different zigbee channels obviously) covering different areas of the house. One is connected through a four port switch that is hardwired back to another port on the router. The second HE is connected through a pair of TPLInk IP over mains devices, the "router" end of which is connected to another port on the router and the other end cabled to the HE.

Hope that makes sense.

PS all of the above are assigned static IPs by the Router.

Regardless of which way you go with HE, I'd suggest considering a more robust network architecture. I'm a big fan of fully managed networks and switches with dedicated ethernet cabling between devices, and no reliance on things like Powerline. Not that they don't work just fine for lots of folks and applications, I've just always found them to be more trouble than biting the bullet and running the cable It costs more (in some cases a lot more) but I think you might be glad you did in the long run.

1 Like