Any tips on using Nerves and a Zigbee gateway?

Hi everyone!

I currently have a Raspberry Pi 3B running Nerves, and it’s communicating with some smart switches over WiFi, which works great. Now, I’m thinking about switching to Zigbee devices and I know I’ll need a Zigbee gateway for that.

Has anyone here used a Zigbee dongle with Nerves? How does it work for you?

This is what I have in mind:

SONOFF Zigbee 3.0 USB Dongle Plus Gateway

Any tips or recommendations would be really appreciated!

Thanks in advance! :blush:

3 Likes

Haven’t seen anything specific. This looks like it would do some of the basics: GitHub - jonathanhockman/ex_zigbee: An Elixir Library to communicate using a serial connected ZigBee device

If bringing up something new I usually look at how a similarly high-level language does it. I come from Python, so zigpy maybe? That will usually tell me if I need to go off into native code and so on.

I think you need your Nerves system to include cp210x which I think would go in the linux defconfig. So check the custom system docs for how to build that in?

This is all sketchwork but hope it helps.

1 Like

Awesome! thank you for the tips!

Did you get this working?

I bought the same dongle on impulse under the assumption “I’m sure somebody did this with Nerves, I’ll get my confirmation after ordering it”, and so here we are :clown_face:

I’m going to try to get into the IoT of Smart Home world, but I want to run my own thing on Nerves rather than Home Assistant or the like.

I want to do everything with Nerves but I run HomeAssistant with Zigbee2MQTT. There are too many integrations in place already and I have too many types of devices (beyond Zigbee).

If you only want to do very specific things with a select few devices it is probably feasible to talk to a Zigbee radio device like the sonoff and implement the bits you need but I think reliability takes a lot of iterations there.

I wanted the app, the notifications and so on. I may still end up doing automation using Elixir as described here:

I don’t relish learning to do that stuff in Home Assistant yaml.

And I have added a bunch of Nerves devices using Homex.

Home Assistant is such a mature project with so much functionality that unless you have a smaller scope in mind and want the practice it makes a ton of sense to use it.

Home Assistant OS actually looks similar to Nerves in terms of technical choices for the underpinnings. It does A/B partitions, Buildroot and all that :slight_smile:

But keep us posted on what you end up doing.

2 Likes

Hi,

Unfortunately, I got busy and had to abandon the idea. Everything ended up in a box.
Anyways, LLMs are getting better now, so you could theoretically port it to Nerves as Lars originally suggested.

I remember trying it many years ago it even then it felt as you described, so I have no doubts in that regard. My scope is small, but I’m sure it will grow with time too. I just want control, and no python haha

I got the device and I will at some point soon try to get it up and running. The first goal is to just add programmable control to my IKEA lamps (Zigbee on the box, though they claim only their hub will be able to control them), and see if I could make one of those “clap twice toggle lights” triggers somehow, as a fun project, though the long-term goal is to be able to control all lights and audio in the apartment through one interface.

My goal

The journey is the goal, and to do it with Nerves. I want to deepen my knowledge of Nerves and its ecosystem, and hopefully provide something useful for others while doing so :slight_smile:

Another reason is that it will not “just” be a Smart Home Hub, but also do a lot of other custom things that Elixir does best, and where I want to minimise the image/container(s) as much as possible.

If I get something useful going with this, I’ll update here!

2 Likes

Cool! Go for it. Sounds great for learning :slight_smile:

IKEA is bog standard Zigbee. If there are quirks they should be implemented in the zigbee2mqtt project already. For reference.

I have all my IKEA lights on off-brand Zigbee controllers.

1 Like

I am attempting something similar, but decided not to go with the Zigbee dongle you linked. Instead I flashed an ESP32-C6 as a Zigbee NCP and using Nerves to communicate with it via ZNSP over UART. I am still in an early stage, but I managed to get it to initialize the Zigbee network. Next step is fully initializing the whole network and then allowing devices to join the network.

1 Like