ZigBeeForDomoticZ plugin Wiki

Legacy - PiZigate installation

ZiGate coordinators (including the PiZigate) are no longer supported by the plugin. This page is kept for existing PiZigate users only and is not maintained. We advise you to move to a Texas Instruments, Silicon Labs or deCONZ coordinator: see Compatible coordinators. For a supported installation, follow Plugin installation.


PiZigate installation on RPi3B+ running on Raspbian (Linux)

  1. Make sure you have all the latest software and python3-dev is installed:

     sudo apt-get update
     sudo apt-get upgrade
     sudo apt-get install python3-dev
    
  2. The PiZigate GPIO commands below (and Tools/pi-zigate.sh) use the gpio command of wiringpi, which is no longer packaged in recent Raspberry Pi OS releases. Test if wiringpi is installed:

     gpio -v
     gpio readall
    
  3. If not, install it :

     sudo apt-get install wiringpi
    

    if it doesn’t work you can download the wiringpi package from here

  4. Set the gpio pins for production mode in rc.local so that this will happen on every reboot:

     sudo nano /etc/rc.local
     gpio mode 0 out
     gpio mode 2 out
     gpio write 2 1
     gpio write 0 0
     gpio write 0 1
    

    Put these 5 lines just before the exit 0 line, save and exit

  5. If you have a RPi3B+, shutdown Bluetooth permanently by editing config.txt:

     sudo nano /boot/config.txt
    

    Put this on the end of the file:

     dtoverlay = pi3-disable-bt
    
    

    Save and exit.

  6. Open the cmdline.txt:

     sudo nano /boot/cmdline.txt
    
    

    Delete the text console = serial0,115200 Save and exit

  7. Type the following commands (if pi is the username you are log in):

     sudo systemctl disable hciuart
     sudo usermod -aG gpio pi
     sudo shutdown
    
    
  8. Power off the RPi, plug the Pizigate card in the gpio slot and power up.

  9. Set the accessibility of the serial adapter to ‘No’ using raspi-config option P6 (Interfacing options / serial):

     sudo raspi-config
    
    
  10. Install a Domoticz version supported by the plugin: see Requirements.

  11. Install the plugin as described in Manual installation on Linux.

  12. Startup the Pizigate:

     Tools/pi-zigate.sh run
    
    
  13. Go to the hardware tab of Domoticz and Add the new hardware: Name: Zigbee (or something similar) Type: Zigbee for domoticz plugin Click Add

    Next, click on the new hardware in the list to edit settings: Coordinator Model: ZiGate (or ZiGate+ for a PiZigate+) Coordinator connection type: PI Serial Port: /dev/serial0 Click Update

    See Plugin settings for the other parameters. If everything went okay, the blue LED will flash brightly and you can pair Zigbee devices from the plugin WebUI.

FLASHING

If you ever have to enter flash mode to update the Pizigate firmware, first type:

gpio mode 0 out
gpio mode 2 out
gpio write 2 0
gpio write 0 0
gpio write 0 1

After flashing the firmware, a sudo reboot will reload defaults from rc.local


PiZigate installation on RPi3B+ running on Fedora 29 (Linux)

Fedora was my development platform, and I was a bit frustrated when the PiZigate came and was only running on Raspbian. Finally after few trials and changes, I have been able to get a Fedora 29 , Domoticz , PiZigate stack fully operational

Fedora configuration

Platform: RPI3 B+

  1. Enable UART

    • Edit file /boot/efi/config.txt
      • Make sure that the following lines are uncommented
        • enable_uart=1
        • dtoverlay = pi3-disable-bt
        • reboot
    • Disable any Getty on /dev/ttyS1
      • systemctl stop serial-getty@ttyS1.service
      • systemctl disable serial-getty@ttyS1.service
    • Check that there is no more process attached to /dev/ttyS1
      • lsof /dev/ttyS1 or ps -ef | grep ttyS1
  2. Check /dev/ttyS1 access rights

    • ls -l /dev/ttyS1

    • edit /etc/group and make sure that the user running domoticz belongs to the tty group
      • sudo usermod -aG tty domoticz
    • make sure that /dev/ttyS1 is read/write access
      • sudo chmod 666 /dev/ttyS1
  3. Enable GPIO

    • Install libgpiod and python3 RPi.GPIO
      • sudo dnf install python3-RPi.GPIO libgpiod-utils
    • Kernel must run withthe iomem=relaxed option
      • Edit /etc/exlinux.conf and add iomem=relaxed in the append statement

      Here is an exemple of what you should have

     label Fedora (5.4.17-200.fc31.armv7hl) 31 (Thirty One)
     kernel /vmlinuz-5.4.17-200.fc31.armv7hl
     append ro root=UUID=2161061e-8612-4e18-a4e1-0e95aca6d2ff LANG=en_US.UTF-8 selinux=0 audit=0 rd.driver.blacklist=nouveau iomem=relaxed
     fdtdir /dtb-5.4.17-200.fc31.armv7hl/
     initrd /initramfs-5.4.17-200.fc31.armv7hl.img
    
    • You can use the pi-zigate-fedora.py tool provided under Tools/Fedora to switch the PiZigate to RUN or FLASH mode. For now you must be root when executing this module

      • sudo python3 Tools/Fedora/pi-zigate-fedora.py run
  4. Sanity check

    • A tool is provided under Tools/Fedora to test the communication with the PiZigate. The tools is based on the PiZiGate_test tool provided with Zigate and is limited to the pure communication test.

    • recompile the tool gcc -o PiZiGate_test-fedora PiZiGate_test-fedora.c
    • excute it ./PiZiGate_test-fedora /dev/ttyS1
    [domoticz@rasp Fedora]$ ./PiZiGate_test-fedora /dev/ttyS1
    Opening : /dev/ttyS1 ...
    + /dev/ttyS1 opened --> OK
    + Packet 01 02 10 10 02 10 02 10 10 03 sent --> OK
    + Packet received --> OK
    size : 37
    01 80 00 00 05 95 00 00 00 10 00 03
    01 80 10 00 05 8f 00 03 03 1a 00 03
    

If you reach this step, you can start domoticz and configure the plugin on the PiZigate