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

As @brad5 is saying it may be a good idea to look at hardening your network design.

Generally speaking I wouldn't depend on anything other then ethernet for something i consider critical. Though the powerline adapter is decent for some basic stuff like general internet access it may have issues when certain things happen on the network. I haven't used power line adapters but MOCA adapters. In generall they worked good, but strange things happened across the entire network when they would act up.

Also if your router is a point of issue then just putting a switch that everything connects to in front of it will allow you reboot it without impacting all of your devices.

Ethernet is king when it comes to reliability.

1 Like

Even if you fixed the Node red/xxx problem. Your router will still need to be fix one day so here's your chance to do it right.

2 Likes

I agree totally with all the above comments about ethernet cables, but it is complicated by the fact that we are looking to move house, so i dont feel inclined to go to a lot of trouble to run cables for the next owner!

2 Likes

Short answer:

Node Red and Zigbee on a RASPi with no network dependence. Possible? "Yes, it is"

Long Answer:

My Zigbee USB stick arrived yesterday. It's a SONOFF Zigbee 3.0 USB Dongle Plus Stick Zigbee TI CC2652P+CP2102N Coordinator with Z-Stack 3.x.0 coordinator firmware already flashed to it. Cost GBP 15 on Ebay.

After a bit of "faffing about" with various settings, I got Zigbee2MQTT running on my test Raspberry Pi 3B+ and then added the node-red-contrib-zigbee2mqtt nodes to my Node Red setup. A bit more faffing and it was all up and running. Using @aaiyar 's example settings for MQTT and Zigbee2MQTT nodes in node red, it all works using localhost. You need no real knowledge of MQTT - using the node-red-contrib-zigbee2mqtt nodes it all happens under the hood - you just use the nodes to send or receive commands or data just like with the Hubitat nodes.

The Zigbee2MQTT itself has a front end webserver page where you can set everything up, add new devices, adjust individual device settings, set up groups, update firmware etc. There is also a map page that shows the Zigbee network graphically with the LQi of each link shown. I set up some simple logic flows in Node Red to test it. EG a Hue Dimmer button press to turn on or off an outlet. It runs superfast, and I pulled out the network cable to the Raspi and the control logic to turn things on and off still works, so that's that box ticked.

So it's looking pretty good so far. I've only put on a handful of devices but the system has recognised them all and is taking very little resources to run. The Average CPU Load according to RasPi check is currently 0% and it's using 30% of the 1G Main Memory.

Whether it's a better solution than Hubitat for Zigbee remains to be seen, as my 2 Hubitats have 91 devices between them and the test Raspi currently has 5 so it's not exactly a fair comparison. But it's now a self contained system like Hubitat with all logic and Zigbee devices running locally, but with the ability to have a complete system backup ready on an SD card (or better an SSD) to just plug into another Raspi should anything happen.

2 Likes

I would run the system off an SSD, not an SD. And backup to an SSD.

3 Likes

I'm planning to play with NR+zigbee2mqtt with no HA in the middle.
I installed mqtt and NR in a spare raspi.
Do you have any reference for next steps?
I can imagine they are:

  • install dongle on raspi
  • install zigbee2mqtt sw on raspi
  • connect installed dongle with the zigbee2@mqtt se
  • connect NR with zigbee2mqtt
    -...?

Step 3 happens as part of step 2 (you'll have to edit a single config file for zigbee2mqtt). For step 4 you have several choices. This is the one I use:

But there are other options like:

and

1 Like

Don't you also need an MQTT server as well, something for Zigbee2MQTT to post to, like Mosquitto or in Node-RED the Aedes Node?

This is why I am testing HA as an "app manager" with my home setup - was easily able to install it via an img file and then install and configure Node-RED, Mosquitto, and Zigbee2MQTT from the HA interface.

My "rules" (sequences) are still living in Node-RED and I use HE for most of my devices but HA now gives me additional capabilities like Ring. Note: I only used Zigbee2MQTT to test my Sonoff stick and verify a zigbee device was misbehaving. HE takes care of everything I need.

I get that HA can be complex and a pain so generally do NOT recommend incorporating. For my testing and home situation and tinkering it's been working out pretty well. As mentioned before - it's a solution I would still NOT provide to my clients though due to potential support issues.

1 Like

I would be interesting to see a write up of this as to how it all comes together. I am mainly interested in seeing how well the integration manages the zigbee devices. I mean this could lead to a kind of Node-Red based Home HA Hub.

This has been my setup for most of my zigbee devices (~80 in number) since February of 2020. It is very stable and resilient to routers or even the coordinator being unavailable for an extended period of time.

  1. This is the zigbee coordinator for my zigbee2mqtt network.
  2. I run zigbee2mqtt on bare metal Linux (first Ubuntu 18.04, now 20.04) on this SBC.
  3. NodeRED and Mosquitto are run on the same platform.
  4. I use node-red-contrib-zigbee2mqtt, linked to above, to bring the z2m devices into NodeRED.
  5. I bring my devices into Hubitat using node-red-contrib-hubitat and virtual device drivers. I've written the ones that I use, but there's no reason the built-in virtual drivers couldn't be used for most of my devices.
1 Like

My ultimate pie-in-the-sky super system goal would use an MQTT Broker as the central comm hub with various server types connected to it like Node-RED as a controller, Hubitat for devices and services, HA and others as necessary etc.

Since the HE to NR is so darn useful I've not really been getting into MQTT all that much yet. At home I am using HE + a companion server (RPi4 4GB) running Home Assistant w/NR (+HE Nodes), Zigbee2MQTT (for giggles and device testing), and Mosquitto MQTT.

For my larger clients it's HE + an RPi4 4GB companion server running NR ( + HE & Aedes nodes) & Homebridge. For my clients with less complex needs - one or more HE hubs - running as close to stock apps and drivers as possible.

edit: I am using MQTT in Node-RED to generate events for things like setting a global variable. I have a subflow for this.. Also use MQTT in place of the Link-In/Out Nodes.

2 Likes

@erktrek
I already installed mqtt and NR in a spare raspi.
I would not like to use HA at all

You can definitely do this without HA in the middle. My setup doesn't use HA.

1 Like

That sounds good - just relaying my current experiences. The goal for me is to get a good balance between simplicity, flexibility and ease of use. I do like to tinker and explore but not if it becomes a full time proposition..

I've run NR + Homebridge on an RPi4 for a long while before adding HA into the mix so definitely recommend that setup as well.

1 Like

Just thought I'd do an update on this.

Over the last couple of weeks I have moved over all of my Zigbee devices from one of my Hubitat hubs to Zigbee2MQTT. I now have 48 devices in total (29 Mains and 19 Battery) running on Z2M. All devices were identified and paired quickly. The webserver user interface for Z2M is very good, listing devices with your chosen friendly name, the IEEE device address, the device manufacturer/model, the latest LQI, and if the power type is mains or battery (if battery an icon indicating battery level is shown) and even an image of the device a single line. There are various advanced options for each device which I haven't fully explored yet, but seems to offer a huge range of customisation if available on the device. There is an OTA page for any devices that have the option of firmware updates. I had to update a Salus SP600 as it was on very old firmware and the power reporting was out by a factor of 10. At the click of a button it started the firmware update and the device now reports correctly. I really like the network map - it is super easy to see what router is being used by the battery devices and to identify any potential weak spots in the mesh.

I am using node-red-contrib-zigbee2mqtt in node red using localhost to access the devices so the whole system is independent of a network connection.

Another bonus that I discovered while testing is that if you remove and re-join a device, any use of that device within the Node Red logic is retained and immediately picked up again when it is re-joined. I presume it uses the specific IEEE of the device as a link and so recognises it again when it re-joins.

So overall, my experience of Zigbee2MQTT so far has been excellent and everything is working perfectly. I'm now running it all on Raspi 4 with 8GB RAM using a Samsung T5 SSD via USB 3.0. This is probably total overkill and I'm only using 7% of the RAM and an average processor load varying between 0% to 1%, but everything is running superfast so far.

My decision now, it whether to try moving the devices across from my other Hubitat which has about 45 devices on it. The reason I split into 2 hubs previously was that a single hub seemed to have increasing problems with devices dropping off once I got above about 60 devices. It felt like the Zigbee stack couldn't cope well with that amount of devices. I have no idea if that was really the case or if it was just a specific device and/or mesh problem, but it definitely ran better with 2 hubs running 40 odd devices each, than one running 80 odd. I also don't know how the zigbee chip in Hubitat compares to the one in my Sonoff stick to know if the Sonoff will handle more devices better or not.

I guess there is only one way to find out.......................................

1 Like

FYI - this is exactly how Hubitat handles zigbee devices. When you re-pair a device, it will slot back into its previous device-id, as long as the device isn't (force) removed.

My approach toward z2m has been to put Hubitat-incompatible zigbee devices on z2m. I have 82 zigbee devices on z2m and about 50 on Hubitat.

1 Like

I am talking about actually removing the device, then re joining it, not just re-pairing it.

In the Node red logic the device was still recognised even after it had been completely removed and then rejoined.

That's good to know. No issues running that number of devices on Z2M?

This is exactly what I am also referring to. Try on Hubitat. It will rejoin with exactly the same zigbee device-id (64-bit zigbee address).

None. As long as you have a sufficient number of repeaters.