New custom component : ZiGate


If you reinstall / upgrade now, be careful as config has to be updated
Device addresses are now on 6 bytes : 4 for short address (i.e. 34bc) & 2 for endpoint (i.e.01)

so in config.yaml if short address is 34bc and endpoint is 01, device address must be defined as 34bc01

@touliloup : this should help with your wall switch


I was almost starting a pyzigate project… and then I realized that somebody beat me to it.

Very nice! Congratulations for the library and the custom component. Are you planning to upload the pyzigate project to the Python Package Index? It will be easier to integrate with the custom component.

Do you need something? I am a Python developer, own a ZiGate and have Aqara devices… unfortunately, I have just finished moving places, so my HA environment is “WIP” right now :cry:


Any help is welcome (corrections, enhancements, tests, whatever :slight_smile: ). You can propose patches anytime.

Indeed, we are currently improving the code in order to publish a pypi package. As it’s a first for me, I’m learning at the same time. Hopefully, it should be done this WE.


Hey there! Thanks for the work you did on this.

I bought my ZiGate device the other day, I hope it will arrive soon :stuck_out_tongue:. I already have a Philips Hue Bridge with some Hue Lights, I’ll give it a test (and see how to unpair the lights and the bridge :thinking:) . I think I might also buy some Xiaomi sensors to check if it works well with your code :wink:.

I’m willing to give you some help and some feedbacks on this, I think this project is really great!


At leat, pyzigate library published under pypi
pyserial or asyncio / serial_asyncio required
use of the library through HASS coming soon (will bring battery level for some xiaomi sensors)


News : Component is now far easier to install

  1. Grab the release :
  2. Unzip it in your <conf_folder>/custom_components/
    (you should put all the zigate, sensor & switches folders right under custom_components)
  3. Adapt your <conf_folder>/configuration.yaml

done :slight_smile: !
(It handles the download of the pizygate and asyncio-serial libraries as per homeassistant standard behavior)

NB1 : should work, but if you encounter problems, just ask here …
NB2 : configuration documentation still needs to be updated with the information available in this thread


I’m sorry i’m really a newbie :confused:
i download the release and put everything in my config folde :
ls /home/docker/hass/custom_components
LICENSE sensor switch zigate

At the restart i have in logs :
Traceback (most recent call last):
File “/usr/src/app/homeassistant/”, line 196, in _async_setup_component
result = yield from component.async_setup(hass, processed_config)
File “/usr/local/lib/python3.6/asyncio/”, line 212, in coro
res = func(*args, **kw)
File “/config/custom_components/zigate/”, line 43, in async_setup
from .zigate2hass import ZiGateProtocol, ZiGate2HASS
File “/config/custom_components/zigate/”, line 9, in
from pyzigate.zgt_parameters import *

how to fix the error ? :frowning:

thanks :slight_smile:



No noob thingy here, we’re all learning :slight_smile:
Seems you’re using docker so you need to give access the container to the /dev/ttyUSB0 device

Launch command needs to be updated :

docker run -d --name=“home-assistant” -v /home/toto/.homeassistant:/config -v /etc/localtime:/etc/localtime:ro --net=host –device=/dev/ttyUSB0:/dev/ttyUSB0 homeassistant/home-assistant

(obviously replace /home/toto/.homeassistant with your config path)

Or if you use docker-compose, add in your docker-compose.yaml (same level as network_mode :“host”) :

  - '/dev/ttyUSB0:/dev/ttyUSB0'

Just tested it with a fresh docker install … so it should work


Received my ZiGate this morning :wink:

I was way too impatient and started the setup. The steps you specified for the installation made it really easy. I wanted to thank you for these.

From there I wanted to pair it with one of my Philips Hue to dive a bit in it and see how it works. I read that you only have to call the service zigate.permit_join in HA and then the device should show up on the Welcome Screen. The issue here is that there are no push buttons on the Philips Hue to start pairing. The Philips Hue light does not show up on the Welcome Screen and it doesn’t feel like it has been paired. The Philips Hue App is able to tell that the light is available for pairing.

Do you have any idea about this?


Don’t know if you speak French but this can help:

If not, I’ll provide a quick translation tonight


Yep, I do speak French. This article helped, and actually it seems that removing the lights from the Philips Hue App does the trick to unpair it, however I am still unable to pair with zigate.

As I did not know if it came from my setup or from anything else, I tried to setup this on a docker on my laptop. Everything was setup properly and I followed (once again) the steps to install your components in the config directory under custom_components, but still unable to pair the device.

I read from the site of Zigate the following statement:

Attention ! la plupart du temps vous observerez que le endpoint 0x01 est quasiment toujours utilisé mais certains constructeurs jouent avec cet adressage pour rendre plus propriétaire leur objet. (ex : Philips HUE utilise le endpoint 0x0B)

I did not have the time yet to dive into your code and check how it works and what it does, but I was wondering if it was possible in anyway that it could be one of the reasons it does not work?


Hi all, thanks eLRIC for the component. Just tried it but don’t manage to connect a device (xiaomi aqara button).

  • I use the service to put zigate in join mode
  • I long press to button to put device in discover mode

And nothing append, here is the only log I have for the zigate component :

2018-01-24 22:08:38 DEBUG (MainThread) [custom_components.zigate] ZIGATE : Starting
2018-01-24 22:08:38 DEBUG (MainThread) [custom_components.zigate.zigate2hass] ZIGATE : Transport initialized : SerialTransport(<_UnixSelectorEventLoop running=True closed=False debug=False>, <custom_components.zigate.zigate2hass.ZiGateProtocol object at 0x7fb04921ecc0>, Serial<id=0x7fb049229dd8, open=True>(port='/dev/ttyUSB0', baudrate=115200, bytesize=8, parity='N', stopbits=1, timeout=0, xonxoff=False, rtscts=False, dsrdtr=False))

Do I miss something ?
Thanks for the help !


(edit : this is an answer to bdr’s question)

Should work (I just re-tested it to be sure) …
Just a question : are you long pressing the small side button (not the big front one), as in : ?


Pairing is before identifying the endpoints, so that should not interfere

In the link I posted, I was specifically thinking about that part :

Personnellement j’utilise la télécommande de Philips Hue :

Voici ma méthode pour remettre à Zéro, appairer et associer une ampoule :

On appuie sur ON + OFF ( 1 + 0) simultanément pendant 5 secondes à 50 cm de l’ampoule (sous tension bien entendu)
On ouvre le réseau ZigBee de votre coordinateur (ZiGate par exemple)
On éteint puis on remet sous tension l’ampoule qui s’appaire au coordinateur
Pendant que le réseau est ouvert, on retourne la télécommande et à l’aide d’un trombone, on appuie sur le bouton setup pendant 5-10 secondes. La télécommande joint à son tour le réseau ZigBee
Si on le souhaite, on peut associer la télécommande et l’ampoule en maintenant le bouton ON (1) pendant 5 secondes à 50 cm de l’ampoule (toujours sous tension).

Is it this process that is not working in your case ?


Seing the 1st issues :slight_smile: it might be useful to explain how to get more logs for investigation :

In you configuration.yaml, activate debug mode on zigate (and preferentially not on the rest to ease analyze)

  default: warning
     custom_components.zigate: debug
     custom_components.switch.zigate: debug
     custom_components.sensor.zigate: debug
     zigate: debug

The logs will be available in your conf folder, home-assistant.log file
Hope it will help …


For your first reply, yes I’ve tested this part. Nothing changed, even when I try the part on resetting the Dimmer Switch, I was unable to pair it with the Zigate.

Thanks for the help concerning the logs, I was ashamed not to be able to provide something as I only the service being called and executed. I’ll try this tomorrow, I’ll post the output in this thread. I also bought some Xiaomi / Aqara devices in order to check if I have any issue with this also and maybe this would help identify the problem as it seems that it’s working properly with you guys. Door and temperature sensor and Light Switch will be on their way soon. Hope the issue will only concern the Philips equipments :confused:


@eLRIC Yes, I’ve tried both.
I retested this morning. I’ve put the zigate in join mode, then I put the device in discover mode (using the liitle button on the edge - the blue led blinked once)
I have enabled all debug logs according to your last comment and here is the content of it :

2018-01-25 07:55:48 DEBUG (MainThread) [custom_components.zigate] ZIGATE : Starting
2018-01-25 07:55:48 DEBUG (MainThread) [custom_components.zigate.zigate2hass] ZIGATE : Transport initialized : SerialTransport(<_UnixSelectorEventLoop running=True closed=False deb
Serial<id=0x7f0513d68828, open=True>(port='/dev/ttyUSB0', baudrate=115200, bytesize=8, parity='N', stopbits=1, timeout=0, xonxoff=False, rtscts=False, dsrdtr=False))
2018-01-25 07:56:22 DEBUG (Thread-6) [zigate] --------------------------------------
2018-01-25 07:56:22 DEBUG (Thread-6) [zigate] REQUEST      : 0049 FFFC1E00
2018-01-25 07:56:22 DEBUG (Thread-6) [zigate]   # standard : 01 00 49 00 04 50 FF FC 1E 00 03
2018-01-25 07:56:22 DEBUG (Thread-6) [zigate]   # encoded  : b'010210490210021450fffc1e021003'
2018-01-25 07:56:22 DEBUG (Thread-6) [zigate] (timestamp : 07:56:22)
2018-01-25 07:56:22 DEBUG (Thread-6) [zigate] --------------------------------------

Again, nothing append… :no_mouth:


Strange : you’re missing the return info from zigate. Log sould be like :

2018-01-25 08:48:54 DEBUG (SyncWorker_0) [zigate] --------------------------------------
2018-01-25 08:48:54 DEBUG (SyncWorker_0) [zigate] REQUEST      : 0049 FFFC1E00
2018-01-25 08:48:54 DEBUG (SyncWorker_0) [zigate]   # standard : 01 00 49 00 04 50 FF FC 1E 00 03
2018-01-25 08:48:54 DEBUG (SyncWorker_0) [zigate]   # encoded  : b'010210490210021450fffc1e021003'
2018-01-25 08:48:54 DEBUG (SyncWorker_0) [zigate] (timestamp : 08:48:54)
2018-01-25 08:48:54 DEBUG (SyncWorker_0) [zigate] --------------------------------------
2018-01-25 08:48:54 DEBUG (MainThread) [zigate] --------------------------------------
2018-01-25 08:48:54 DEBUG (MainThread) [zigate] RESPONSE 8000 : Status
2018-01-25 08:48:54 DEBUG (MainThread) [zigate]   * Status              : Success
2018-01-25 08:48:54 DEBUG (MainThread) [zigate]   - Sequence            : b'0f'
2018-01-25 08:48:54 DEBUG (MainThread) [zigate]   - Response to command : b'0049'
2018-01-25 08:48:54 DEBUG (MainThread) [zigate]   # encoded : b'0180021002100215c30210021f021049021003'
2018-01-25 08:48:54 DEBUG (MainThread) [zigate]   # decoded : 0180 00 00 05 C3 00 0F 00 49 0003
2018-01-25 08:48:54 DEBUG (MainThread) [zigate]   (@timestamp : 08:48:54)

Even before pressing the little button …
I’ll try to guess what can prevent ZiGate’s return code from happening. What config are you running :, dockerized, python venv ?

NB : For the process in itself once solved, you may try to push the little button longer ? something like > 6 secs (the led normally blinks several times)


That will help for sure
Hue is confirmed to work with ZiGate, so we 'll find a way


@eLRIC I’am using a NUC with ESXi, I have a Debian VM with python venv.
The zigate USB stick seems to be OK at the OS layer :

Bus 001 Device 004: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

I’ll try to open it and look if everything is well connected, etc.

And yes, the blue LED probably blinks several times but stop blinking when I release the button.