zigpy-zigate
zigpy-zigate is a Python 3 implementation for the Zigpy project to implement ZiGate based Zigbee radio devices.
ZiGate is a open source ZigBee adapter hardware that was initially launched on Kickstarter by @fairecasoimeme
- https://www.zigate.fr
- https://www.kickstarter.com/projects/1361563794/zigate-universal-zigbee-gateway-for-smarthome
Hardware and firmware compatibility
The ZiGate USB adapter communicates via a PL-2303HX USB to Serial Bridge Controller module by Prolific. There's also a Wi-Fi adapter to communicate with ZiGate over network.
Note! ZiGate open source ZigBee USB and GPIO adapter hardware requires ZiGate 3.1a firmware or later to work with this zigpy-zigate module, however ZiGate 3.1d firmware or later is recommended as it contains a specific bug-fix related to zigpy. See all available official ZiGate firmware releases here (link).
Known working ZiGate compatible Zigbee radio modules
- ZiGate + USB / ZiGate USB-TTL
- ZiGate + USB-DIN / ZiGate USB-DIN
- PiZiGate + / PiZiGate (ZiGate HAT/Shield module for Raspberry Pi compatible GPIO header)
- Tip! PiZiGate are not limited to Raspberry Pi series as works with all computers with a Raspberry Pi compatible GPIO header.
- ZiGate Ethernet (ZiGate Ethernet serial-to-IP server) (Note! Requires the PiZiGate + radio module)
- Tip! ZiGate Ethernet can as alternativly also be used via ESPHome serial bridge firmware for ESP32 as an option.
- ZiGate + WiFi Pack / ZiGate WiFi Pack (ZiGate WiFi serial-to-IP server)
- Tip! ZiGate compatible WiFi module can also be used to convert radio board from ZiGate USB-TTL into this "ZiGate WiFi Pack".
Experimental ZiGate compatible Zigbee radio modules
- Open Lumi Gateway - DIY ZiGate WiFi bridge hacked from an Xiaomi Lumi Gateway with modded OpenWRT firmware
Port configuration
- To configure usb ZiGate (USB TTL or DIN) port, just specify the port, example :
/dev/ttyUSB0
- Alternatively you could manually set port to
auto
to enable automatic usb port discovery
- Alternatively you could manually set port to
- To configure pizigate port, specify the port, example :
/dev/serial0
or/dev/ttyAMA0
- To configure wifi ZiGate, manually specify IP address and port, example :
socket://192.168.1.10:9999
pizigate does require some additional adjustements on Raspberry Pi 3/Zero, and 4:
- Raspberry Pi 3 and Raspberry Pi Zero configuration adjustements
- Raspberry Pi 4 configuration adjustements
Flasher (ZiGate Firmware Tool)
zigpy-zigate has an integrated Python "flasher" tool to flash firmware updates on your ZiGate (NXP Jennic JN5168).
Thanks to Sander Hoentjen (tjikkun) zigpy-zigate now has an integrated firmware flasher tool!
See all available official ZiGate firmware releases here (link).
Flasher Usage
usage: python3 -m zigpy_zigate.tools.flasher [-h] -p {/dev/ttyUSB0} [-w WRITE] [-s SAVE] [-u] [-d] [--gpio] [--din]
optional arguments:
-h, --help show this help message and exit
-p {/dev/ttyUSB0}, --serialport {/dev/ttyUSB0}
Serial port, e.g. /dev/ttyUSB0
-w WRITE, --write WRITE
Firmware bin to flash onto the chip
-s SAVE, --save SAVE File to save the currently loaded firmware to
-u, --upgrade Download and flash the lastest available firmware
-d, --debug Set log level to DEBUG
--gpio Configure GPIO for PiZiGate flash
--din Configure USB for ZiGate DIN flash
Testing new releases
Testing a new release of the zigpy-zigate library before it is released in Home Assistant.
If you are using Supervised Home Assistant (formerly known as the Hassio/Hass.io distro):
- Add https://github.com/home-assistant/hassio-addons-development as "add-on" repository
- Install "Custom deps deployment" addon
- Update config like:
where 0.5.1 is the new version
pypi: - zigpy-zigate==0.5.1 apk: []
- Start the addon
If you are instead using some custom python installation of Home Assistant then do this:
- Activate your python virtual env
- Update package with
pip
pip install zigpy-zigate==0.5.1
Releases via PyPI
Tagged versions are also released via PyPI
- https://pypi.org/project/zigpy-zigate/
- https://pypi.org/project/zigpy-zigate/#history
- https://pypi.org/project/zigpy-zigate/#files
Developer references
Documents that layout the serial protocol used for ZiGate serial interface communication can be found here:
- https://github.com/fairecasoimeme/ZiGate/tree/master/Protocol
- https://github.com/doudz/zigate
- https://github.com/Neonox31/zigate
- https://github.com/nouknouk/node-zigate
How to contribute
If you are looking to make a contribution to this project we suggest that you follow the steps in these guides:
- https://github.com/firstcontributions/first-contributions/blob/master/README.md
- https://github.com/firstcontributions/first-contributions/blob/master/github-desktop-tutorial.md
Some developers might also be interested in receiving donations in the form of hardware such as Zigbee modules or devices, and even if such donations are most often donated with no strings attached it could in many cases help the developers motivation and indirect improve the development of this project.
Related projects
Zigpy
Zigpy is Zigbee protocol stack integration project to implement the Zigbee Home Automation standard as a Python 3 library. Zigbee Home Automation integration with zigpy allows you to connect one of many off-the-shelf Zigbee adapters using one of the available Zigbee radio library modules compatible with zigpy to control Zigbee based devices. There is currently support for controlling Zigbee device types such as binary sensors (e.g., motion and door sensors), sensors (e.g., temperature sensors), lightbulbs, switches, and fans. A working implementation of zigbe exist in Home Assistant (Python based open source home automation software) as part of its ZHA component
ZHA Device Handlers
ZHA deviation handling in Home Assistant relies on the third-party ZHA Device Handlers project. Zigbee devices that deviate from or do not fully conform to the standard specifications set by the Zigbee Alliance may require the development of custom ZHA Device Handlers (ZHA custom quirks handler implementation) to for all their functions to work properly with the ZHA component in Home Assistant. These ZHA Device Handlers for Home Assistant can thus be used to parse custom messages to and from non-compliant Zigbee devices. The custom quirks implementations for zigpy implemented as ZHA Device Handlers for Home Assistant are a similar concept to that of Hub-connected Device Handlers for the SmartThings platform as well as that of zigbee-herdsman converters as used by Zigbee2mqtt, meaning they are each virtual representations of a physical device that expose additional functionality that is not provided out-of-the-box by the existing integration between these platforms.
ZHA integration component for Home Assistant
ZHA integration component for Home Assistant is a reference implementation of the zigpy library as integrated into the core of Home Assistant (a Python based open source home automation software). There are also other GUI and non-GUI projects for Home Assistant's ZHA components which builds on or depends on its features and functions to enhance or improve its user-experience, some of those are listed and linked below.
ZHA Custom Radios
zha-custom-radios adds support for custom radio modules for zigpy to [Home Assistant's ZHA (Zigbee Home Automation) integration component]. This custom component for Home Assistant allows users to test out new modules for zigpy in Home Assistant's ZHA integration component before they are integrated into zigpy ZHA and also helps developers new zigpy radio modules without having to modify the Home Assistant's source code.
ZHA Custom
zha_custom is a custom component package for Home Assistant (with its ZHA component for zigpy integration) that acts as zigpy commands service wrapper, when installed it allows you to enter custom commands via to zigy to example change advanced configuration and settings that are not available in the UI.
ZHA Map
zha-map for Home Assistant's ZHA component can build a Zigbee network topology map.
ZHA Network Visualization Card
zha-network-visualization-card is a custom Lovelace element for Home Assistant which visualize the Zigbee network for the ZHA component.
ZHA Network Card
zha-network-card is a custom Lovelace card for Home Assistant that displays ZHA component Zigbee network and device information in Home Assistant
Zigzag
Zigzag is an custom card/panel for Home Assistant that displays a graphical layout of Zigbee devices and the connections between them. Zigzag can be installed as a panel or a custom card and relies on the data provided by the zha-map integration commponent.
ZHA Device Exporter
zha-device-exporter is a custom component for Home Assistant to allow the ZHA component to export lists of Zigbee devices.