Using Zigbee devices with Homeassistant on an Odroid

Post Reply
crazyquark
Posts: 317
Joined: Thu Jan 15, 2015 4:22 pm
languages_spoken: english, french, romanian
ODROIDs: C1,C1+,C2,HC1,XU4
Has thanked: 2 times
Been thanked: 4 times
Contact:

Using Zigbee devices with Homeassistant on an Odroid

Unread post by crazyquark » Thu Jul 25, 2019 3:13 am

Hello,

This is by no means something I discovered, it's more of a: hey, did you know this can _also_ be done on any odroid?

Recently I dropped Homeassistant in favor of a Docker install of Hass.io on my Odroid-HC1, it's rather easy, just follow this guide:
https://www.smarthomebeginner.com/insta ... ker-linux/
This will give you access to the Hass.io addon store which includes, among others, the Zigbee2mqtt server. Hass.io will launch everything in dockers so it might help to also run a portainer if you want a nice web interface to monitor your containers:
https://portainer.readthedocs.io/en/sta ... yment.html. The portainer image is multiarch so it works out of the box on any Odroid.

Now for the zigbee part, once you have zigbee2mqtt installed you can connect this dongle to start talking to zigbee devices:
https://hackaday.io/project/163487-zigb ... sb-adapter
I struggled a bit with flashing it, I recommend getting maybe the CCDebugger tool from Aliexpress(I was cheap and I used an ESP8266 for flashing instead). If you go the ESP32/ESP8266 route see this:
http://automatedhome.party/2019/01/20/z ... s-than-10/
You will at least need to get a download cable because the pin header on the CC2531 dongle is non-standard(I think it's 1mm pitch). Or you could try to jam some dupont wires... did not try it.

There are 2 ways to flash:
- via CCLib and python, safe but veeery slow, takes hours(I am not kidding!)
- via CCLoader - fast but it did not work on the first try, not sure what's up there. I did get it to work in the end
See this for both methods:
https://www.zigbee2mqtt.io/information/ ... thods.html

It's easier if you use a 3.3V MCU(like the ESPs) so you do not have to add resistors to convert from 5V to 3.3V logic on data lines.

Or, of course, if you buy the CCDebugger tool(there are chinese clones on Aliexpress for I think 15$, official one is 50$), you can use this procedure:
https://www.zigbee2mqtt.io/getting_star ... c2531.html

Once you have all this set up you can pair zigbee devices for your home automation needs. I personally attached an Ikea Tradfri remote to control my AC and lights. I did not need to get the Tradfri bridge as well since I am connecting to it directly via Zigbee.

That's it!

P.S.
Here is an example automation script for using the Tradfri remote in Hass:

Code: Select all

- alias: 'Remote: AC'
  trigger:
    platform: state
    entity_id: sensor.0x000d6ffffe0b266b_action
    to: 'toggle'
  action:
    entity_id: switch.ac
    service: switch.toggle

- alias: 'Remote: Light'
  trigger:
    platform: state
    entity_id: sensor.0x000d6ffffe0b266b_action
    to: 'brightness_up_click'
  action:
    entity_id: light.living
    service: light.toggle
These users thanked the author crazyquark for the post:
mad_ady (Thu Jul 25, 2019 4:18 am)

User avatar
mad_ady
Posts: 6805
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 218 times
Been thanked: 167 times
Contact:

Re: Using Zigbee devices with Homeassistant on an Odroid

Unread post by mad_ady » Thu Jul 25, 2019 4:20 am

Haven't moved to Zigbee yet, but I'm keeping an eye on it.
Interesting setup, but what is the range of that dongle? Can it cover a "soviet-era" appartment?

User avatar
odroid
Site Admin
Posts: 32567
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 190 times
Been thanked: 355 times
Contact:

Re: Using Zigbee devices with Homeassistant on an Odroid

Unread post by odroid » Thu Jul 25, 2019 10:24 am

@crazyquark, Thank you for the very informative links.

@mad_ady, When I tested a simple peer-to-peer Zigbee connection a few years ago, generic distance range was 10~20 meters in buildings.
In the open field like a playground, I could have a solid connection at 60~70 meters distance once I increased RF power.
As far as I remember, there were a few options to adjust the power. But long distance connection needed a much bigger battery for a self-powered sensor node.
These users thanked the author odroid for the post:
mad_ady (Thu Jul 25, 2019 2:44 pm)

crazyquark
Posts: 317
Joined: Thu Jan 15, 2015 4:22 pm
languages_spoken: english, french, romanian
ODROIDs: C1,C1+,C2,HC1,XU4
Has thanked: 2 times
Been thanked: 4 times
Contact:

Re: Using Zigbee devices with Homeassistant on an Odroid

Unread post by crazyquark » Thu Jul 25, 2019 3:24 pm

Yes, the range is good for our small apartment.
It works across the room and from the other room :).

But as odroid said there are ways to increase the range if you need to:
https://www.zigbee2mqtt.io/how_tos/how_ ... range.html

I switched the Zigbee channel so that it *should* not be on the same channel as WiFi - Zigbee uses the crowded 2.4GHz band(my WiFi router is just a few inches from to the dongle).
I also oriented the dongle upright.
You can also use repeaters(I think Ikea sockets can work as repeaters)

If you want to go full metal jacket you can hack the antenna:
https://hackaday.io/project/163505-cc25 ... ntenna-mod

There is also a DIY router(will extend range greatly but it means hacking a device that connects to mains voltage):
https://www.zigbee2mqtt.io/how_tos/how_ ... outer.html

User avatar
OverSun
Posts: 1491
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Has thanked: 0
Been thanked: 18 times
Contact:

Re: Using Zigbee devices with Homeassistant on an Odroid

Unread post by OverSun » Thu Jul 25, 2019 6:41 pm

That's why I chose z-wave over zigbee. With comparable choice of end devices it is much closer to DIY concept.
The whole document of the first post would sound like "plug in 25 bucks usb stick (https://z-wave.me/uzb/), start homeassistant".
Difference is that spec of zigbee implies that your controller must implement many things much closer to the air, that's why all that firmwares and flashing through uart, and z-wave is just an interface to the radio and all logic can be implemented in software.

User avatar
odroid
Site Admin
Posts: 32567
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 190 times
Been thanked: 355 times
Contact:

Re: Using Zigbee devices with Homeassistant on an Odroid

Unread post by odroid » Fri Jul 26, 2019 9:06 am

@OverSun, Thank you for the information.
The z-wave looks nice because it supports 921 MHz for Korea regulation at least.
Since there are too many 2.4Ghz wifi/bluetooth stuff in the air, sub-Ghz band might be much less interfered in many urban areas.

Post Reply

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 4 guests