ZiGate implementation
G1K opened this issue · 24 comments
Discussion of the implementation of a new adapter based on the NXP chip JN516x ( JN5168 / JN5169 )
#241
What you can try as a coordinator
-
Xiaomi gateway DGNWG05LM, ZHWG11LM
-
End devices from xiaomi JN5169 https://github.com/Jerome-PS/JN516xSniffer
- Xiaomi Door sensor
- Xiaomi smart button
- Xiaomi smart button UART1 ZiGate coordinators
-
Ready modules https://www.seeedstudio.com/Mesh-Bee-Open-Source-Zigbee-Pro-Module-with-MCU-JN516-p-1751.html
-
DIY module + TTL adapter
E75-2G4M10S Zigbee JN5169 aliexpress.com/item/32973411720.html
Road map
- Stability, queuing APDU, waiting for data and using SQN
- deduplication of all incoming messages by sqn fairecasoimeme/ZiGate#346 or use build custom firmware or alternate firmware
- implementation sendZclFrameToGroup
-
supported GP - (requires stable firmware with GreenPower support and 242 endpoint ) What is being assembled now limits the resources of the APDU or does not start after the firmware - OTA check, not sure if it will work
- more correct error handling and re-sending with route finding
- * Backup and restore ( mvp )
If you have the opportunity, please join the development and testing. I don't have much development experience especially with uart and ZiGate
Perhaps this will solve the requests
Koenkk/zigbee2mqtt#743
Koenkk/zigbee2mqtt#409
Does #241 and Koenkk/zigbee2mqtt#4737 being merged mean that zigbee-herdsman and zigbee2mqtt now works with all modules with ZiGate firmware including original ones from https://zigate.fr by the @fairecasoimeme project from Frédéric Dubois?
Do not own a ZiGate or other NXP Zigbee coordinator myself but know it is supported by ZHA for Home Assistant via zigpy-zigate
Known working Zigbee radio modules
- ZiGate USB-TTL
- ZiGate USB-DIN
- PiZiGate (ZiGate module for Raspberry Pi GPIO)
- ZiGate Pack WiFi (ZiGate USB-TTL with ESP8266 serial TCP server)
Perhaps this will solve the requests
Koenkk/zigbee2mqtt#743
Koenkk/zigbee2mqtt#409
Also related to #150
These changes are all available in Zigbee2MQTT 1.16.0 but it's unclear for me how stable it is.
FYI, Koenkk/zigbee2mqtt.io#474 has updated Zigbee2MQTT website documentation to list ZiGate USB-TTL as a supported adapter:
PS: Other ZiGate adapters not yet listed there, include ZiGate USB-DIN, PiZiGate, and ZiGate WiFi Pack -> https://zigate.fr/boutique/
Thanks and headsup to @fairecasoimeme @G1K @kirovilya @devbis @lenz
Hi everybody,
I'm trying to add my PiZiGate to Zigbee2MQTT, but i have errors:
Zigbee2MQTT:info 2020-12-14 16:38:29: Logging to console and directory: '/app/data/log/2020-12-14.16-38-28' filename: log.txt
Zigbee2MQTT:info 2020-12-14 16:38:29: Starting Zigbee2MQTT version 1.16.2-dev (commit #2468d61)
Zigbee2MQTT:info 2020-12-14 16:38:29: Starting zigbee-herdsman (0.13.41)
Zigbee2MQTT:error 2020-12-14 16:38:39: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2020-12-14 16:38:39: Failed to start zigbee
Zigbee2MQTT:error 2020-12-14 16:38:39: Exiting...
Zigbee2MQTT:error 2020-12-14 16:38:39: Error: failed to connect to zigate adapter [object Object] after 10000ms
at ZiGateAdapter.<anonymous> (/app/node_modules/zigbee-herdsman/dist/adapter/zigate/adapter/zigateAdapter.js:125:23)
at Generator.throw (<anonymous>)
at rejected (/app/node_modules/zigbee-herdsman/dist/adapter/zigate/adapter/zigateAdapter.js:25:65)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zigbee2mqtt@1.16.2-dev start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zigbee2mqtt@1.16.2-dev start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-12-14T15_38_39_702Z-debug.log
Using '/app/data' as data directory
> zigbee2mqtt@1.16.2-dev start /app
> node index.js
This is my configuration.yaml:
# Home Assistant integration (MQTT discovery)
homeassistant: true
# allow new devices to join
permit_join: true
# MQTT settings
mqtt:
# MQTT base topic for zigbee2mqtt MQTT messages
base_topic: zigbee2mqtt
# MQTT server URL
server: 'mqtt://127.0.0.1:1883'
# MQTT server authentication, uncomment if required:
user: Jonathan
password: xxxxxxxxxxxxx
# Serial settings
serial:
# Location of CC2531 USB sniffer
port: /dev/ttyS0
adapter: zigate
I use docker-compose:
zigbee2mqtt:
image: koenkk/zigbee2mqtt:latest-dev
container_name: zigbee2mqtt
hostname: "neptune_zigbee2mqtt"
restart: unless-stopped
network_mode: host
privileged: true
environment:
- TZ=Europe/Paris
volumes:
- zigbee2mqtt_data:/app/data
devices:
- /dev/ttyS0:/dev/ttyS0
/dev/ttyS0 is working, i used it before with ZHA in HA.
My PiZiGate firmware is 3.1d
Any ideas ?
Thanks !
Hey @Kalypox
Does the baudrate for your zigate adapter is equal to the one in herdsman? You should try to set the baudrate in the config file.
The second approach is to upgrade the firmware. It heavily relies on the raw Zigbee mode that is under development since 3.1c.
Maybe updating to the latest firmware can solve your problem.
Note! ZiGate 3.1d firmware or later is recommended for all ZiGate hardware is it contains an important bug-fix
https://zigate.fr/tag/firmware/
https://zigate.fr/2020/10/12/maj-firmware-zigate-version-3-1d/
Also updated docs recommend upgrading to ZiGate Zigbee coordinator firmware version 3.1d or later:
https://www.zigbee2mqtt.io/information/supported_adapters.html
Added Roadmap to start post
Described current problems in #252 (comment) related to #285
Most of the points from the roadmap are closed, but there is a problem with the stability of the module firmware when using raw mode in both directions. Perhaps they will be resolved, but for now I recommend trying to work with the firmware from this repository.
https://github.com/openlumi/JN-ZigbeeNodeControlBridge-firmware/releases/latest
The firmware is collected on Github Actions binaries are in artifacts
And it supports advanced logging, which can help in finalizing the adapter
I do not have devices to check OTA, but in the sniffer, I see the correct communication that there is no update for the device. If anyone tests please write here.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days
The latest improvements from the end of January are available in the 1.18 release
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days
@Koenkk Maybe re-open this issue for tracking and leave open even if no activity as ZiGate support is still listed as experimental?
hmm, why does github-actions bot close this?
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days
Maybe permanently remove the stale label somehow?
Most likely, you need to add the closing issue exempt-issue-labels to the action settings, specify a list of labels in it that do not need to be marked as obsolete. and for issue to use such a label
https://github.com/actions/stale#exempt-issue-labels
zigbee-herdsman/.github/workflows/stale.yml
Lines 11 to 18 in ff26225
@Koenkk Maybe add dont-stale label to this issue as well as it should probably also be keep open for the same reason as EZSP?
https://github.com/Koenkk/zigbee-herdsman/issues?q=is%3Aissue+is%3Aopen+label%3Adont-stale
Most of the points from the roadmap are closed, but there is a problem with the stability of the module firmware when using raw mode in both directions. Perhaps they will be resolved, but for now I recommend trying to work with the firmware from this repository. https://github.com/openlumi/JN-ZigbeeNodeControlBridge-firmware/releases/latest The firmware is collected on Github Actions binaries are in artifacts
And it supports advanced logging, which can help in finalizing the adapter
Could you clarify which firmware should be use on a ZiGate V1 to act as a coordinator
@pipiche38
Any depending on your type of chip and Baudrate for Zigate sticks most likely should be 5168 and 115200. Just do not take the versions with GP. The firmware JN chips looks at magic bats at the beginning of the firmware and should not let the firmware of 5169 be flashed in 5168 and vice versa.
We use firmware on Xiaomi Gateway, there is a chip 5169 as in Xiaomi end devices
But Zigate V1 firmware has seemed to be corrected and work as it should. The only problem that strongly interferes is the absence of PDM backup and periodically the chip reports that after rebooting it is Factory reseted
In the firmware
https://github.com/openlumi/JN-ZigbeeNodeControlBridge-firmware/releases/latest
Alx2000y/zigbee-herdsman@068bbe7...fd707e4
Realized raw PDM backup memory of NXP JN516x zigbee chip and recovery. Those who wish can try.
I'll put it on my todo list, this looks promising and could be a good alternative to the zigate firmware
Road map
...
- * Backup and restore ( mvp )
Does anyone have any more updates or news on the backup and restore features for the zigate adapter in zigbee-herdsman?
PS: This question is directly related to this discussion about Z2M migration across Zigbee stacks -> Koenkk/zigbee2mqtt#16478