Zigbee Home Automation in SG 2021

James Koh
4 min readJan 2, 2021

--

I’ve finally got around to setting up Zigbee Home Automation (ZHA)in 2021 🍿

My setup requisites:

  1. Raspberry Pi 3B
  2. (Optional) Monitor for Raspberry Pi
  3. Home Assistant setup on raspi v0.118.4
  4. Zigbee Radio USB — I got mine from aliexpress for $9 with shipping, took about one and a half weeks to reach Singapore.

Following Instructions from:

https://www.home-assistant.io/integrations/zha/

#1 find home assistant using nmap, in this case, raspi address was 192.168.1.110

nmap -sn 192.168.1.0/24---Nmap scan report for 192.168.1.110
Host is up (0.27s latency).
MAC Address: B8:27:EB:0A:B4:A3 (Raspberry Pi Foundation)

#2 login to HA

#3 Add ZHA from Configuration > +ADD INTEGRATION > Zigbee Home Assistant > Please Wait … > Select Serial Port > Selected from drop down > Submit > Load for a minute > …

… Pick Radio Type > Selected Legacy TI_CC > Submit > …

… Enter Settings > Port — left it as-is since I couldn’t find a relevant ID > Port Speed — as-is > data flow control — leave blank > Submit > …

failed. It won’t pair? Maybe I need to flash ZHA

Instructions for flashing:

#4 Open raspberrypi case, connect pins to debug port

https://lemariva.com/blog/2019/08/zigbee-flashing-cc2531-using-raspberry-pi-without-cc-debugger

#5 I was able to connect the pins after manually bending them, however, with hassio flashed on my raspberry pi, I can’t proceed further. Looks like I have to order a debugger. 😆

#6 (+2weeks) Debugger has arrived 👏, unpack it.

Follow the instructions for flashing with this from zigbee2mqtt``

https://www.zigbee2mqtt.io/information/flashing_the_cc2531.html

#7 install libraries with homebrew

brew install autoconf automake libusb boost pkgconfig libtool

There were a few warnings, but I decided to continue with running the cloned cc-tool repo with ./bootstrap and ./configure . Immediately ran into a permissions issue when compiling. So the warnings while installing with homebrew were probably critical.

No package 'libusb-1.0' found

Checking brew info libusb I happily found libusb installed by homebrew but it was not available as a cpp library.

#8 I looked at a few links that recommended changing CPATH, but that didn’t quite make sense — why would homebrew imports have broken and only require c/cpp changing symlinks? It’s much more likely that the entire gcc had got messed up. I decided to uninstall all the homebrew dependencies above, and use command line tools.

xcode-select --install
xcode-select -switch /Library/Developer/CommandLineTools

#9 This time around, install the homebrew libraries one-by-one and came across the error with no write access

Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks

So this meant that I had to give access for /usr/local

mkdir -p /usr/local/include
mkdir -p /usr/local/Frameworks
sudo chown -R $(whoami) $(brew --prefix)/*

#10 Plug in the CC-Debugger, connect it to the CC2531 USB and press the reset button.

#11 Run ./bootstrap and ./configure

Success

#12 Head back to add integration, ZHA now allows another device address

..and seems to be happy with it.

oooh. So much easier

--

--

James Koh
James Koh

Written by James Koh

yesterday was tough, make tomorrow better

No responses yet