New custom component : ZiGate (obsolete)

Hello,

Doudz component has progressed far more than mine and I would recommand anyone who would like to have an “up to date” zigate support to switch to his (https://community.home-assistant.io/t/another-component-for-zigate/). While I don’t use it personnaly, the response from the community seems nice and Doudz is prompt to support new versions.

That does not mean I’ll abandon zigate which is a fantastic tool, but I’ll focus in the future on a version purely based on MQTT with a simple daemon, easier to debug (I’m no fan of automatic component detection) and probably outside HA which is far too rich for my very simple needs. Thanks to all people who supported and helped through this small adventure. The code is still opensource and linked below if anyone wants to reuse parts of it


I started the implementation of a component for the ZiGate (http://zigate.fr/)

Installation steps in this post : New custom component : ZiGate (obsolete)

Code available here :


(based on the zigate python library : https://github.com/elric91/ZiGate through pypi)

Configuration examples available here :

Sensors and switches implemented as well as a service for device pairing

15 Likes

Awesome, I just tried it and it work well. The ZiGate is successfully initialized and I successfully see the capture message from my Xiaomi Button (already paired with the ZiGate prior to this test).

As a reminder for people passing here, ZiGate is a Zigbee gateway with an impressive compatibility, it already works well with device from:

  • Xiaomi
  • Ikea
  • Hue
  • Pluzzy
  • Orvibo
  • Innr
  • Osram
  • Trust
  • Jiawen
  • Heiman

It was started and sold through a Kickstarter campaign and the gateway is now also available here:
https://zigate.fr/produit/zigate-ttl/ (all in French for now…)

3 Likes

yep
There is still a lot of work to do. In the current code I misinterpret the use of component / platform and need to rewrite it a significant part of it (hopefully, the code was light :slight_smile: )

I still need to find the best way to cope with the diversity of switches & sensors it can manage … hopefully, I am motivated !

1 Like

The management of all the device type will have to be implemented one by one I’m afraid, since each vendor have it’s own interpretation/use of the protocol.

Once the base framework is in place, I’ll be able to help and implement the different device type/brand.

1 Like

Device data gathering (and publishing in HASS) is now working … or at least seems so …
I refactored a lot, so I hope it will work for others :slight_smile:

The instructions for installation (still in development, so manual steps are required) are on the github

edit : add the github URL : https://github.com/elric91/hass_custom_components

1 Like

Switches added (i.e door detection or presence sensor)
Pairing procedure simplified :

  • execute ‘zigate.permit_join’ service
  • put your device in discover mode
  • if everything is OK, you will have a notification on your home page (with the device address for use in config)

All info for installation / config here : https://github.com/elric91/hass_custom_components/blob/master/README.md

edit : updated post to reflect new pairing procedure (previous info is obsolete)

1 Like

Will this also work on the HUSBZB-1 stick, etc.? or just on the Zigate gateway? Looks great so far either way!

Hallo, can you use another beta tester?

Are im correct that the USB-TTL should be connected to the hass machine directly?

Hello

Indeed, you are correct
I’ll see in the future to manage the WiFi connection, so that you can use the ZiGate remotely

You’re welcome to beta test ! Instructions for installation are on the github, but feel free to ask if anything’s unclear

It will only work with the ZiGate, as it is meant to comply with ZiGate’s own protocol
(thx btw !)

Just tested it, awesome progress you made in such a short time :heart_eyes:

I now received the notification after pairing my device.

It’s the xiaomi push button, I also see the entry in the log when pressing/releasing the button, so it’s working great :slight_smile:

If it help in any way, here are the log entry:

Pressed:

--------------------------------------
RESPONSE 8102 : Attribute Report / Response
* General: On/Off
* Closed/Taken off/Press
FROM ADDRESS      : b'f5c9'
  - Source EndPoint : b'01'
  - Cluster ID      : b'0006'
  - Attribute ID    : b'0000'
  - Attribute type  : b'10'
  - Attribute size  : 1
  - Attribute data  : b'00'
  # encoded : b'018102120210021e5937f5c902110210021602100210021010021002110210c903'
  # decoded : 0181 02 00 0E 59 37 F5 C9 01 00 06 00 00 00 10 00 01 00 C903
  (@timestamp : 21:08:56

Released:

  --------------------------------------
RESPONSE 8102 : Attribute Report / Response
  * General: On/Off
  * Open/Release button
  FROM ADDRESS      : b'f5c9'
  - Source EndPoint : b'01'
  - Cluster ID      : b'0006'
  - Attribute ID    : b'0000'
  - Attribute type  : b'10'
  - Attribute size  : 1
  - Attribute data  : b'01'
  # encoded : b'018102120210021e5837f5c902110210021602100210021010021002110211c903'
  # decoded : 0181 02 00 0E 58 37 F5 C9 01 00 06 00 00 00 10 00 01 01 C903
  (@timestamp : 21:08:56

Excellent !
Were you able to add it in your configuration.yaml to see it in HASS ? Config should be something like

switch:
  - platform: zigate
    name: 'my_push_button'
    address: f5c9
    default_state: 'state'

(if ‘state’ is not working, try look at the other attributes available in developper tools / states menu)

edit : typo

I hadn’t try, as I thought my device would have to be handled as a binary_sensor or similar since it never really stays on or off and cannot be controlled by hass (unlike a switch).

I tried with the configuration you provided, the sensor is initialized, I see it in hass, and it goes ON when I press the button.
However it never goes OFF again. Only the first press fire an event.

Here is the first state change / event:

INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: entity_id=switch.testbutton, old_state=<state switch.testbutton=off; friendly_name=TestButton @ 2018-01-08T22:05:45.942485+01:00>, new_state=<state switch.testbutton=on; last seen=2018-01-08 22:06:17, state=open, friendly_name=TestButton @ 2018-01-08T22:06:17.667071+01:00>>
INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: entity_id=group.all_switches, old_state=<state group.all_switches=off; entity_id=('switch.testbutton',), order=0, auto=True, friendly_name=all switches, hidden=True @ 2018-01-08T22:05:45.942485+01:00>, new_state=<state group.all_switches=on; entity_id=('switch.testbutton',), order=0, auto=True, friendly_name=all switches, hidden=True @ 2018-01-08T22:06:17.667071+01:00>>

In Developer tools -> States I see the following attribute:

{
  "last seen": "2018-01-08 22:06:17",
  "state": "open",
  "friendly_name": "TestButton"
}

Have you tried to press it several times ?
I think the behaviour you see is because “on” = released :slight_smile: (which is the case on my door sensor)

in that case, I’ll add a functionality to make it straight / reverse :

  • straight : pressed = on / released = off (i.e. push button)
  • reverse : pressed = off / released = on (i.e. door sensor)

tell me if I guessed it right …

That could be half the solution, another thing is that the pressed/release event are always reported together by zigate. Even when I hold the button down.
I should at least see the switch as off while pressing it but the status doesn’t change.
I’ll see that more in detail tonight :slight_smile:

OK, so the switch seems to be a momentary one, which would explain how the double click is available
It behaves differently than the presence detector I tested which fires only a “on” event
Not a complex problem, I just need to confirm I guessed right :
Could you try a double click and send me the log ?

superb… But is there wifi in the module, or is that another module?

ZiGate is sold with usb serial or usb-serial + wifi during the kickstarter campaign
As far as I see on the website, it is for the time being only sold with usb serial

Btw, wifi is not yet implemented in the python library

The double click doesn’t seems to send anything different.

What I however noticed is that both the Press and Release are reported at the time. When I release the button.

The log entry from custom_components.zigate.interface only appear once I release the button. It seems like hass doesn’t process the first part, which is the press.

Single_click.xml (2.1 KB)
(it’s a log, had to change the extension to xml to be able to upload it here)

Switches behaviour updated.files to update :

  • zigate/interface.py
  • zigate/const.py
  • switch/zigate.py

Conf for your switch :slight_smile:

 - platform: zigate
   name: 'my_push_button'
   address: f5c9
   default_state: 'state'
   type: 'toggle'
  1. Type can be :
  • Omitted (normal).
  • ‘toggle’ : 1 click is on, next click is off.
  • ‘momentary’ (event is on, back to off 15 secs later)
  1. Other attribute : ‘inverted’: ‘Yes’ (on is off and vice versa). Omitted is normal

Quickly tested it, no obvious regression found so feel free to try it :slight_smile:

edit : format / typos

1 Like