Federico Ceratto and I have been working on the packaging of Domoticz, one of the leading free and open source home automation / smart home solutions.

I've taken that a step further, packaging the plugin for the Zigate USB stick and two of the utilities for updating firmware on the Zigate, the JennicModuleProgrammer and the zigate-flasher.

These are initially Debian packages, also available for Raspbian, but I also try to share any lessons from this effort with the upstream developers and also provide a foundation for Ubuntu and Fedora packaging.

Raspberry Pi 2.0 with Zigate USB stick

Trying the packages

Raspbian setup (Raspbian users only)

  1. Download the Raspbian light image from the official Raspbian download page
  2. Write the image to an SD card using
    cat
    or a similar tool
  3. Boot the Raspberry Pi
  4. Run
    sudo raspi-setup
  5. Set a password for the pi user, the default is raspberry
  6. Set the hostname
  7. In (4) Localization settings, set your Locale, Timezone and Keyboard
  8. In (5) Interfacing, enable SSH
  9. At the command line, run
    timedatectl
    to verify the time and time synchronization is correct
  10. Run
    ip addr
    to see your IP address
  11. (optional) Connect to the Pi from your usual workstation and copy your SSH public key to
    ~pi/.ssh/authorized_keys
  12. (optional) Disable PasswordAuthentication in
    /etc/ssh/sshd_config
    (you don't want the script kiddies next door turning on your heating system in the middle of summer do you?)

Package repository setup (Debian, Raspbian and Ubuntu users)

As these were not included in the recent release of Debian 10 (buster) and as they are evolving more rapidly than packages in the stable distribution, I'm distributing them through Debify.

To use packages from Debify, the first step is to update your apt configuration. This works for regular Debian or Raspbian systems running stretch or buster:

$ wget -O - http://apt.debify.org/add-apt-debify | bash

Package installation

$ sudo apt update
$ sudo apt install domoticz-zigate-plugin

All the necessary packages should be installed automatically. A sample installation log is below for comparison.

Zigate users - check firmware version

You may want to check that you have the latest firmware installed in your Zigate.

  1. Download the firmware image from here
  2. If your apt setup automatically installs Recommended packages then jennic-module-programmer has already been installed for you. If not, you can do
    sudo apt install jennic-module-programmer zigate-flasher
    . You can also try the alternative tool, zigate-flasher
  3. Unplug your Zigate USB stick and open the case. Hold down the button and while holding the button, reconnect it to the USB port. The blue light should now be illuminated by very dimly. This means it is ready for a firmware update.
  4. Run the update, for example, if you copied or downloaded the firmware to /tmp and if you have no other USB serial device attached, you could use the following command:
    sudo JennicModuleProgrammer -s /dev/ttyUSB0 -f /tmp/ZiGate_Coordinator_v3.1a.bin
  5. Wait for the command to complete successfully
  6. Detach the Zigate and put it back into its case
  7. Attach the Zigate again
  8. Restart Domoticz:
    sudo systemctl restart domoticz

If the JennicModuleProgrammer utility doesn't work for you, if it sits there for ten minutes without doing anything you can also try the zigate-flasher. I packaged both of these so you have the choice: please share your feedback in the Domoticz forums. Repeat the steps above, replacing step 4 with:

  1. $ sudo zigate-flasher -p /dev/ttyUSB0 -w /tmp/ZiGate_Coordinator_v3.1a.bin
    Found MAC-address: 00:11:22:33:44:55:66:77
    writing new flash from /tmp/ZiGate_Coordinator_v3.1a.bin
    $
    

Zigate users: quick Domoticz setup

  • Make sure your power supply provides sufficient power for the Raspberry Pi and the Zigate
  • Connect to the Raspberry Pi using your web browser, Domoticz uses port 8080. Therefore, if the IP address is 192.168.1.105, the URL will be http://192.168.1.105:8080
  • Click the Setup -> Hardware setting in the menu
  • Add your Zigate. Be certain to set the Join time to a long value or 255 while testing.
  • Verify that the blue light is flashing on the Zigate. This means it is ready for devices to join. If it doesn't flash, you can try restarting Domoticz with
    sudo systemctl restart domoticz
    or try the Software Reset option in the Hardware settings.
  • Try to join a device such as a light bulb or temperature sensor. For example, on a temperature sensor, you might need to hold down the join button for a few seconds until the light flashes.
  • In Domoticz, go to the Setup -> Devices tab and verify the new device is visible in the list

Next steps and troubleshooting

Please share your feedback and questions through the Domoticz forums.

Sample installation log

pi@pi5:~ $ sudo apt install domoticz-zigate-plugin
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  domoticz jennic-module-programmer libopenzwave1.6 libpython3-dev libpython3.5-dev openzwave
The following NEW packages will be installed:
  domoticz domoticz-zigate-plugin jennic-module-programmer libopenzwave1.6 libpython3-dev libpython3.5-dev openzwave
0 upgraded, 7 newly installed, 0 to remove and 74 not upgraded.
Need to get 51.7 MB of archives.
After this operation, 91.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://apt.debify.org/debify debify-raspbian-stretch-backports/main armhf libopenzwave1.6 armhf 1.6+ds-1~bpo9+1 [406 kB]
Get:2 http://raspbian.raspberrypi.org/raspbian stretch/main armhf libpython3.5-dev armhf 3.5.3-1+deb9u1 [36.9 MB]
Get:3 http://apt.debify.org/debify debify-raspbian-stretch-backports/main armhf openzwave armhf 1.6+ds-1~bpo9+1 [24.6 kB]
Get:4 http://apt.debify.org/debify debify-raspbian-stretch-backports/main armhf domoticz armhf 4.11020-2~bpo9+1 [10.8 MB]
Get:5 http://apt.debify.org/debify debify-raspbian-stretch-backports/main armhf domoticz-zigate-plugin all 4.4.9~beta1-2~bpo9+1 [3,515 kB]
Get:6 http://apt.debify.org/debify debify-raspbian-stretch-backports/main armhf jennic-module-programmer armhf 0.6-1~bpo9+1 [9,690 B]
Get:7 http://raspbian.raspberrypi.org/raspbian stretch/main armhf libpython3-dev armhf 3.5.3-1 [18.7 kB]                                                                     
Fetched 51.7 MB in 9s (5,717 kB/s)                                                                                                                                           
Selecting previously unselected package libopenzwave1.6.
(Reading database ... 34831 files and directories currently installed.)
Preparing to unpack .../0-libopenzwave1.6_1.6+ds-1~bpo9+1_armhf.deb ...
Unpacking libopenzwave1.6 (1.6+ds-1~bpo9+1) ...
Selecting previously unselected package libpython3.5-dev:armhf.
Preparing to unpack .../1-libpython3.5-dev_3.5.3-1+deb9u1_armhf.deb ...
Unpacking libpython3.5-dev:armhf (3.5.3-1+deb9u1) ...
Selecting previously unselected package libpython3-dev:armhf.
Preparing to unpack .../2-libpython3-dev_3.5.3-1_armhf.deb ...
Unpacking libpython3-dev:armhf (3.5.3-1) ...
Selecting previously unselected package openzwave.
Preparing to unpack .../3-openzwave_1.6+ds-1~bpo9+1_armhf.deb ...
Unpacking openzwave (1.6+ds-1~bpo9+1) ...
Selecting previously unselected package domoticz.
Preparing to unpack .../4-domoticz_4.11020-2~bpo9+1_armhf.deb ...
Unpacking domoticz (4.11020-2~bpo9+1) ...
Selecting previously unselected package domoticz-zigate-plugin.
Preparing to unpack .../5-domoticz-zigate-plugin_4.4.9~beta1-2~bpo9+1_all.deb ...
Unpacking domoticz-zigate-plugin (4.4.9~beta1-2~bpo9+1) ...
Selecting previously unselected package jennic-module-programmer.
Preparing to unpack .../6-jennic-module-programmer_0.6-1~bpo9+1_armhf.deb ...
Unpacking jennic-module-programmer (0.6-1~bpo9+1) ...
Setting up jennic-module-programmer (0.6-1~bpo9+1) ...
Setting up libopenzwave1.6 (1.6+ds-1~bpo9+1) ...
Setting up libpython3.5-dev:armhf (3.5.3-1+deb9u1) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up libpython3-dev:armhf (3.5.3-1) ...
Setting up openzwave (1.6+ds-1~bpo9+1) ...
Setting up domoticz (4.11020-2~bpo9+1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/domoticz.service → /lib/systemd/system/domoticz.service.
Setting up domoticz-zigate-plugin (4.4.9~beta1-2~bpo9+1) ...
Adding user `domoticz' to group `dialout' ...
Adding user domoticz to group dialout
Done.
pi@pi5:~ $