Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZiGate implementation #242

Open
4 of 7 tasks
G1K opened this issue Oct 21, 2020 · 24 comments
Open
4 of 7 tasks

ZiGate implementation #242

G1K opened this issue Oct 21, 2020 · 24 comments

Comments

@G1K
Copy link
Contributor

G1K commented Oct 21, 2020

Discussion of the implementation of a new adapter based on the NXP chip JN516x ( JN5168 / JN5169 )
#241

What you can try as a coordinator

Road map

  • Stability, queuing APDU, waiting for data and using SQN
  • deduplication of all incoming messages by sqn duplicate data indication 0x8002 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

@Hedda
Copy link
Contributor

Hedda commented Nov 3, 2020

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

@Gamester17
Copy link

Perhaps this will solve the requests
Koenkk/zigbee2mqtt#743
Koenkk/zigbee2mqtt#409

Also related to #150

@Koenkk
Copy link
Owner

Koenkk commented Nov 3, 2020

These changes are all available in Zigbee2MQTT 1.16.0 but it's unclear for me how stable it is.

Hedda added a commit to Hedda/zigbee2mqtt.io that referenced this issue Nov 30, 2020
Update supported adapters with ZiGate USB-TTL. Experimental as per Koenkk/zigbee-herdsman#242
Koenkk added a commit to Koenkk/zigbee2mqtt.io that referenced this issue Nov 30, 2020
* Update supported adapters with ZiGate USB-TTL

Update supported adapters with ZiGate USB-TTL. Experimental as per Koenkk/zigbee-herdsman#242

* Update supported adapters with ZiGate USB-TTL

* Mention ZiGate USB-TTL hardware specification

Mention ZiGate USB-TTL hardware specification

* Update supported_adapters.md

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
@Hedda
Copy link
Contributor

Hedda commented Nov 30, 2020

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

@jonathan-gatard
Copy link

jonathan-gatard commented Dec 14, 2020

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 !

@devbis
Copy link
Contributor

devbis commented Dec 14, 2020

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.

@jonathan-gatard
Copy link

jonathan-gatard commented Dec 14, 2020

Hi @devbis,
Thanks you a lot !!!
It works, i've added:

advanced:
  baudrate: 115200

image

Have a nice day !

@Hedda
Copy link
Contributor

Hedda commented Dec 14, 2020

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

@G1K
Copy link
Contributor Author

G1K commented Jan 13, 2021

Added Roadmap to start post

Described current problems in #252 (comment) related to #285

@G1K
Copy link
Contributor Author

G1K commented Jan 28, 2021

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

@G1K
Copy link
Contributor Author

G1K commented Jan 28, 2021

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.

@github-actions
Copy link
Contributor

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

@github-actions github-actions bot added the stale label Feb 28, 2021
@G1K
Copy link
Contributor Author

G1K commented Mar 2, 2021

The latest improvements from the end of January are available in the 1.18 release

@github-actions
Copy link
Contributor

github-actions bot commented Apr 3, 2021

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

@Hedda
Copy link
Contributor

Hedda commented Jan 18, 2022

@Koenkk Maybe re-open this issue for tracking and leave open even if no activity as ZiGate support is still listed as experimental?

https://www.zigbee2mqtt.io/guide/adapters/#experimental

@Koenkk Koenkk reopened this Jan 18, 2022
@Hedda
Copy link
Contributor

Hedda commented Jan 26, 2022

hmm, why does github-actions bot close this?

@Koenkk Koenkk reopened this Jan 26, 2022
@Koenkk Koenkk removed the stale label Jan 26, 2022
@github-actions
Copy link
Contributor

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

@github-actions github-actions bot added the stale label Feb 26, 2022
@Hedda
Copy link
Contributor

Hedda commented Feb 28, 2022

Maybe permanently remove the stale label somehow?

@Koenkk Koenkk removed the stale label Feb 28, 2022
@G1K
Copy link
Contributor Author

G1K commented Mar 2, 2022

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

- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: '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'
stale-pr-message: 'This pull request 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'
days-before-stale: 30
days-before-close: 7
operations-per-run: 500

@Hedda
Copy link
Contributor

Hedda commented Mar 9, 2022

@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

@pipiche38
Copy link

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

@G1K
Copy link
Contributor Author

G1K commented Feb 18, 2023

@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.

@pipiche38
Copy link

I'll put it on my todo list, this looks promising and could be a good alternative to the zigate firmware

@Hedda
Copy link
Contributor

Hedda commented Feb 21, 2023

Road map

...

  • * Backup and restore ( mvp )

@G1K Do you have any more updates or news on the backup and restore features for the zigate adapter in zigbee-herdsman?

PS Requestion is related to this discussion about cross-hardware migrations -> Koenkk/zigbee2mqtt#16478

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants