New custom component : ZiGate (obsolete)

Did anyone manage to setup Xiaomi Aqara Water / Flood / Leak sensor with Zigate?


It does not work for me when I try to set it up using switch component with following configuration:
switch:
  - platform: zigate
    name: 'Water Leak'
    address: e8fb01
    default_state: 'event'
    type: 'momentary'

When I check the logs I can see corresponsing entry when I put it in water and when I take it out.
Here’s debug entry when it detected water:

[zigate] RESPONSE 8401 : Zone status change notification
[zigate]   - Sequence       : b'05'
[zigate]   - EndPoint       : b'01'
[zigate]   - Cluster id     : b'0500' (Security & Safety: IAS Zone)
[zigate]   - Src addr mode  : b'02'
[zigate]   - Src address    : b'e8fb'
[zigate]   - Zone status    : b'0001'
[zigate]     - Binary       : 0000000000000001
[zigate]     - Alarm 1 : Opened/Alarmed
[zigate]     - Alarm 2 : Closed/Not alarmed
[zigate]     - Tampered : No
[zigate]     - Battery : OK
[zigate]     - Supervision reports : No
[zigate]     - Report when normal : No
[zigate]     - Trouble : No
[zigate]     - AC (Mains) : Ok
[zigate]     - Test Mode : No
[zigate]     - Battery defective : No
[zigate]   - Zone id        : b'00'
[zigate]   - Delay count    : 0
[zigate]   # encoded : b'018402110210021e1a02150211021502100212e8fb021002110210ff021002107e03'
[zigate]   # decoded : 0184 01 00 0E 1A 05 01 05 00 02 E8 FA 00 01 00 FF 00 00 7E03
[zigate]   (@timestamp : 12:38:10)

It seem to use different format (comparing to presense detection sensor), but I’m not sure if I should configure it differently.

Ok, it look like it’s dead here.
No offense and thanks for the support I got, thanks to the devs for providing the component on their free time even if it does not fit my needs.
Actually my home automation is in a early stage and home assistant is the first I tried.

I will give a shot to jeedom with a stronger french community and a larger user panel of zigate.

I will still monitor this thread in case of things change because I love the home assistant architecture.
Or maybe I will try zigbeemqtt. :thinking:

2 Likes

Just connected the Zigate wifi gateway to HASSIO and used this component.
Its working fine with the human presence sensor.
I configured is as a switch as the example shows.
@eLRIC; keep up the good work. Thanks for developing the component.
Kees

1 Like

Hi all.

Is it possible to have more then one ZiGate in HASS? Eg. one serial and one WiFi?

I am think of replacing the Xiaomi GW with ZiGate to avoid the Chinese cloud (GW is behaving strange from time to time when connection is lost) but I have some doubts if it will cover whole flat.

Thanks.

never tried it.
at the moment if you have a connection issue with zigate wifi, Hass won’t reconnect to it automatically, you’ll have to restart it.
concerning the cloud, my xiaomi/yeelight are blocked by my firewall.

If I’m correct zigate use zigbee devices connected on power line as zigbee router.
So if you have xiaomi wall switch or even zigbee bulbs like tradfri or yeelight it should extend the range no?

Hello everyone, I just received my zigate wifi and I was trying to set ip up :

  • First I have downloaded the folowing github repository : https://github.com/elric91/homeassistant_zigate
  • Then I have extracted it into \hassio\config\custom_components so I have the light, sensor, switch and zigate folders directly in the custom_components folder.
  • I modified my configuration.yaml file with zigate:

# Enable ZiGate
zigate:

  • I restarted homeassistant
  • Finnally I went into developpement -> Services into Hassio and then called the service “zigate.permit_join” and nothing happens. The blue led of the zigate stays blue but does not blink and I can not pair any device.

Do you already had this issue?

I am lost, would you have any idea to help me please?

Thank you very much.

Kind regards

Aurélien

I think I had to do a zigate.init the first time I use it.

I tried but nothing happened neither :frowning:

To what did you connect the zigate? Which serial port does the zigate have?

Maybe add this in logger.yaml to see if you have more info in homeassistant.log:

  logs:
     custom_components.zigate: debug
     custom_components.switch.zigate: debug
     custom_components.sensor.zigate: debug
     zigate: debug

I did connect the Zigate to a 5V usb charger. I have a wifi zigate. Should I open a port ?

Here is my log :

2018-06-06 21:29:33 INFO (MainThread) [homeassistant.setup] Setting up zigate
2018-06-06 21:29:33 DEBUG (MainThread) [custom_components.zigate] ZIGATE : Starting
2018-06-06 21:29:33 DEBUG (MainThread) [custom_components.zigate] ZIGATE : Finding zigate addresses
2018-06-06 21:29:33 DEBUG (MainThread) [custom_components.zigate] ZIGATE : All known addresses added
2018-06-06 21:29:33 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=zigate, service=permit_join>
2018-06-06 21:29:33 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=zigate, service=raw_command>
2018-06-06 21:29:33 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=zigate, service=init>
2018-06-06 21:29:33 INFO (MainThread) [homeassistant.setup] Setup of domain zigate took 0.0 seconds.
2018-06-06 21:29:33 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=zigate>
2018-06-06 21:29:33 DEBUG (MainThread) [custom_components.zigate.zigate2hass] ZIGATE : Transport initialized : SerialTransport(<uvloop.Loop running=True closed=False debug=False>, <custom_components.zigate.zigate2hass.ZiGateProtocol object at 0x72b5b970>, Serial<id=0x72b5b2f0, open=True>(port=‘/dev/ttyUSB0’, baudrate=115200, bytesize=8, parity=‘N’, stopbits=1, timeout=0, xonxoff=False, rtscts=False, dsrdtr=False))
2018-06-06 21:29:35 WARNING (MainThread) [homeassistant.setup] Setup of config is taking over 10 seconds.

Can you see anything interesting?

I do not :frowning:

Thank you very much for helping me :slight_smile:

I have found : I needed to complete the init.py file with the host IP address !

Thank you very much guys !

Have a nice thankgiving :slight_smile:

usermod -a -G dialout homeassistant

Don’t forget this, if you are running into Raspberry Pi configuration, connected via USB (if you followed the tutorial for Python venv) :wink:

Hello,

Battery level in volt is not very useful.
Battery level in % would be much better, even more with this plugin:

What do you think of this for battery calculation?
@eLRIC can you integrate something like this in next release?
I will help in a couple of months, now I am a little busy.

  if (mvolts> = 3000)

 {

     battery_level = 100;

 }

 else if (mvolts> 2900)

 {

     battery_level = 100 - ((3000 - mvolts) * 58) / 100;

 }

 else if (mvolts> 2740)

 {

     battery_level = 42 - ((2900 - mvolts) * 24) / 160;

 }

 else if (mvolts> 2440)

 {

     battery_level = 18 - ((2740 - mvolts) * 12) / 300;

 }

 else if (mvolts> 2100)

 {

     battery_level = 6 - ((2440 - mvolts) * 6) / 340;

 }

 else

 {

     battery_level = 0;

 }

This would be very device specific, not every device 3 volts coin battery.
A template sensor might also be a solution to display the battery in %

I’m doing it using a template sensor, I’m using the same logic than core/homeassistant/components/xiaomi_aqara.py at 39843a73de1b8e2a42be1e9300580726baecd18f · home-assistant/core · GitHub

ugly template:

value_template: “{% if state_attr(‘sensor.temperature_XX’,‘battery’) %} {% set min_volt = 2.8 %} {% set max_volt = 3.3 %} {% set v = [ states.sensor.temperature_XX.attributes.battery, max_volt ] | min %} {% set v = [ states.sensor.temperature_XX.attributes.battery, min_volt ] | max %} {% set p = 100 * (v-min_volt) / (max_volt-v) %} {{ p }} {% endif %}”

@touliloup actually, every Xiaomi device has got a 3.3v battery (CR2032 or CR2450), IKEA use a 3.3v CR2032, HEIMAN products uses a big CR123A or a smaller CR203 or 2xAAA (1.5v), Orvibo sensors uses a CR2032, so that’s (almost) universally accepted. Other zigbee devices are just RGB bulb/lights (A/C connected, so no battery reporting).

I’m a UI developer, I want to start a new project for giving Zigate a proper PHP web interface, but I don’t have much time for a couple of months, I can start working on this project on August.

I had the Raspbee for a month or so, and it reported battery status in percent, there are not thousands of zigbee devices so this is really doable.

Even if not doable, we can just put in the code 3 or 4 battery behaviours, and then select them in the sensor (since after the sensor is annuonced in HA, we still need to add it manually in HA).
If I will work on the complete UI, it will be done before hand, and just automagically imported in HA like it is now working with DeCONZ.

We can do something like this, until then:

  - platform: zigate
name: 'Sensore Temperatura Zigate'
address: 245e01
default_state: temperature
battery_type: CR2032 #Optional, it will give battery output 0/100 instead of bare voltage. Can be CR2032, CR123A, 2xAA, 2xAAA, TESLAGIGAPOWER
default_unit: '°C'

Hi,

I need help setting up Zigate on RancherOS ->Docker -> Homeassistant
I tried zigate first on a window machine and everything worked fine but I can’t get homeassistant to talk to zigate. In the log I get :

2018-06-11 18:49:35 ERROR (SyncWorker_2) [homeassistant.loader] Unable to find component zigate
2018-06-11 18:49:35 ERROR (MainThread) [homeassistant.components] Component not found: zigate
2018-06-11 18:49:36 ERROR (MainThread) [homeassistant.core] Error doing job: Unclosed client session
2018-06-11 18:49:40 ERROR (SyncWorker_10) [homeassistant.loader] Error loading custom_components.zigate. Make sure all dependencies are installed
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/loader.py", line 86, in get_component
    module = importlib.import_module(path)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/zigate/__init__.py", line 7, in <module>
    from homeassistant.util import async as hasync
ImportError: cannot import name 'async'``

I looked, I have all the files in custom_components, I even saw homeassistant create a pycache folder in the zigate folder after modifying the config yaml.

any idea where I went wrong?