Mozilla iot gateway
Here is what I am going to setup. I am obviously not going to rewrite one more time the tutorial and docs from mozilla. I will simply describe the specific setup I used, and the little things I setup to make it work.
Prerequisites
- Raspberry pi 3b
- Zigbee dongle, zwave dongle list of compatible hardware - I used Digi XStick (ZB mesh version) and Aeotec Z-Stick (Gen5)
- Zigbee Smart bulb (i used a philips hue), zigbee motion detector (I used philips motion sensor)
Linux
I used my favorite lean alpine linux, with the setup as I explained in this post minus the complexity brought up by the rpi0.
Docker
Again, following my previous post, minus the rpi0 complexity.
Launching the iot gateway with docker
First thing first, if you are using a zwave dongle, you need to make sure /dev/ttyACM0 is owned by the dialout group, otherwise, it won’t be available. Assuming your alpine hostname is “home-gateway”:
ssh -i ~/.ssh/YOURPUBKEY maintenance@home-gateway
sudo chown root:dialout /dev/ttyACM0
If you want this change to be permanent, you will need to use the eudev package:
sudo apk add eudev
printf 'SUBSYSTEM=="tty", KERNEL=="ttyUSB0", ATTRS{product}=="XStick", GROUP="dialout"\n\nSUBSYSTEM=="tty", KERNEL=="ttyACM0", ATTRS{product}=="DWC OTG Controller", GROUP="dialout"\n' | sudo tee -a /etc/udev/rules.d/90-tty.rules > /dev/null
sudo rc-update add udev sysinit
sudo lbu ci
Launching the container with the needed devices:
sudo docker run -d --restart always --name mozilla-iot-gateway --net host -v /media/mmcblk0p3/mozilla-iot-gateway:/home/node/.mozilla-iot mozillaiot/gateway:arm
A little explanation:
- restart always will simply restart if the container crashes, but also on startup
- –net host is unfortunately compulsory for some addons of the gateway
- mounting a volume saved on mmcblk0p3 allows to have persistent storage (remember alpine otherwise runs in ram)
The booting time is very long, so be patient.
Without the udev rule
docker run -d --restart always --name mozilla-iot-gateway --net host -v /media/mmcblk0p3/mozilla-iot-gateway:/home/node/.mozilla-iot --device=/dev/ttyUSB0 --device=/dev/ttyACM0 moz
illaiot/gateway:arm
You have to add the device to docker run.
Reaching you gateway
You should be able to use an external URL to reach your RPi, XXX.mozilla-iot.org. It is not a simple website, it’s also a PWA, allowing you to set it up as an app on your mobile phone! You can also reach it from within your network with https://home-gateway:4443/things
Configuration
From there on, I had no issues, you an simply follow the mozilla tutorial
Conclusion
Here I am: docker, minimal host alpine linux and iot devices. Next step: k3s!