Another component for ZiGate

You need to shutdown home assistant before doing any modification like that Because zigate.json file is writed from memory at shutdown.

BTW thanks @doudz for new updates and admin pannel looks already great and usefull!

1 Like

Is there any change in the component that could explain this behavior ?
Recently I have noticed that every time I restart hass all my zigate switch triggers a state change.

In fact the state stay the same but it cause me issues with automation.

For example I have a node red automation that start the ventilation in the bathroom for 5 minutes when you turn off the light.
Now when I restart hass, if the switch was off then the automation is triggered.

I notice the same problem since few Home assistant releases. I don’t know why.
All my lights look ON at start

Hi,

I migrate of Jeedom to Hassio.

I have very losted!

How to create automations:

I read in the manual is correct this:

'- alias: Toggle dining light on single press
trigger:
platform: event
event_type: xiaomi_aqara.click
event_data:
entity_id: sensor.zigate_00158d0002330_multiclick
click_type: single
action:
service: switch.toggle
entity_id: switch.zigate_00158d064bc2_2

  • alias: Toggle couch light on double click
    trigger:
    platform: event
    event_type: xiaomi_aqara.click
    event_data:
    entity_id: sensor.zigate_00158d0002330_multiclick
    click_type: double
    action:
    service: switch.toggle
    entity_id: switch.zigate_001583664bc2_2

@doudz do you have automation for these lights ?
Because for me state doesn’t change it’s all my zigate switch state who are triggered at restart. But if switch was off the state triggered is off, the issue is with automation reacting like the state was just changed from on to off.

@Neofitos could you please describe your devices and what you try to achieve with your automation ?

Great job for you custom component Doudz.
One question, I use some Xiaomi plugs with power consumption. I manage to get consumption in ZHA but not in your component, is it normal?

Hi,

I am running hassio in a docker container on a RPI4/PiZiGAte.
I think I have docker correctly accessing the serial port of the RPI4.

I am facing the following errors :
2019-12-28 10:40:14 DEBUG (SyncWorker_11) [custom_components.zigate] Port : /dev/ttyS0
2019-12-28 10:40:14 DEBUG (SyncWorker_11) [custom_components.zigate] Host : None
2019-12-28 10:40:14 DEBUG (SyncWorker_11) [custom_components.zigate] GPIO : True
2019-12-28 10:40:14 DEBUG (SyncWorker_11) [custom_components.zigate] Led : True
2019-12-28 10:40:14 DEBUG (SyncWorker_11) [custom_components.zigate] Channel : None
2019-12-28 10:40:14 DEBUG (SyncWorker_11) [custom_components.zigate] Scan interval : 0:02:00
2019-12-28 10:40:15 DEBUG (SyncWorker_11) [custom_components.zigate] ZiGate object created <zigate.core.ZiGateGPIO object at 0xb2446050>
2019-12-28 10:40:15 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_component.py”, line 218, in async_setup_platform
self.hass, self.config, self.domain, platform_type
File “/usr/src/homeassistant/homeassistant/setup.py”, line 231, in async_prepare_setup_platform
integration = await loader.async_get_integration(hass, platform_name)
File “/usr/src/homeassistant/homeassistant/loader.py”, line 278, in async_get_integration
Integration.resolve_from_root, hass, components, domain
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/homeassistant/homeassistant/loader.py”, line 154, in resolve_from_root
manifest_path = pathlib.Path(base) / domain / “manifest.json”
File “/usr/local/lib/python3.7/pathlib.py”, line 908, in truediv
return self._make_child((key,))
File “/usr/local/lib/python3.7/pathlib.py”, line 695, in _make_child
drv, root, parts = self._parse_args(args)
File “/usr/local/lib/python3.7/pathlib.py”, line 649, in _parse_args
a = os.fspath(a)
(…)
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] Try loading persistent file
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] Trying to load /config/zigate.json
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] Load success
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] REQUEST : 0x0010
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] Msg to send b’0010000010’
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] Encoded Msg to send b’01021010021002101003’
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] Waiting for status message for command 0x0010
2019-12-28 10:40:24 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b’\x01\x80\x02\x10\x02\x10\x02\x15\x95\x02\x10\x02\x10\x02\x10\x10\x02\x10\x03\x01\x80\x10\x02\x10\x02\x15\x8f\x02\x10\x02\x13\x02\x13\x1a\x02\x10\x03’
2019-12-28 10:40:24 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-12-28 10:40:24 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8000: b’00000010’
2019-12-28 10:40:24 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8000 - Status response : status:0, sequence:0, packet_type:16, error:b’’, lqi:0
2019-12-28 10:40:24 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-12-28 10:40:24 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-12-28 10:40:24 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8010: b’0003031a’
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] STATUS code to command 0x0010:RESPONSE 0x8000 - Status response : status:0, sequence:0, packet_type:16, error:b’’, lqi:0
2019-12-28 10:40:24 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8010 - Version list : major:3, installer:31a, lqi:0, version:3.1a
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] Waiting for message 0x8010
2019-12-28 10:40:24 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] Stop waiting, got message 0x8010
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] REQUEST : 0x0021 b’\x03\x18\xc8\x00’
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] Msg to send b’00210004f60318c800’
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] Encoded Msg to send b’0102102102100214f6021318c8021003’
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] Waiting for status message for command 0x0021
2019-12-28 10:40:24 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b’\x01\x80\x02\x10\x02\x10\x02\x15\xa4\x02\x10\x02\x10\x02\x10!\x02\x10\x03’
2019-12-28 10:40:24 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-12-28 10:40:24 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8000: b’00000021’
2019-12-28 10:40:24 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8000 - Status response : status:0, sequence:0, packet_type:33, error:b’’, lqi:0
2019-12-28 10:40:24 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] STATUS code to command 0x0021:RESPONSE 0x8000 - Status response : status:0, sequence:0, packet_type:33, error:b’’, lqi:0
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] REQUEST : 0x0023 b’\x00’
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] Msg to send b’002300012200’
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] Encoded Msg to send b’010210230210021122021003’
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] Waiting for status message for command 0x0023
2019-12-28 10:40:24 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b’\x01\x80\x02\x10\x02\x10\x02\x15\xa6\x02\x10\x02\x10\x02\x10#\x02\x10\x03’
2019-12-28 10:40:24 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-12-28 10:40:24 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8000: b’00000023’
2019-12-28 10:40:24 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8000 - Status response : status:0, sequence:0, packet_type:35, error:b’’, lqi:0
2019-12-28 10:40:24 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] STATUS code to command 0x0023:RESPONSE 0x8000 - Status response : status:0, sequence:0, packet_type:35, error:b’’, lqi:0
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] Check network state
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] REQUEST : 0x0009
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] Msg to send b’0009000009’
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] Encoded Msg to send b’010210021902100210021903’
2019-12-28 10:40:24 DEBUG (SyncWorker_8) [zigate] Waiting for status message for command 0x0009
2019-12-28 10:40:24 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b’\x01\x80\x02\x10\x02\x10\x02\x15\x8c\x02\x10\x02\x10\x02\x10\x02\x19\x02\x10\x03\x01\x80\x02\x19\x02\x10\x16o\xff\xff\x02\x10\x15\x8d\x02\x10\x02\x12\x1e,\xc8PF\xee#@\x02\x1f\xbc\x89\x02\x11;\x02\x1b\x02\x10\x03’
2019-12-28 10:40:24 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-12-28 10:40:24 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8000: b’00000009’
2019-12-28 10:40:24 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-12-28 10:40:24 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8000 - Status response : status:0, sequence:0, packet_type:9, error:b’’, lqi:0
2019-12-28 10:40:25 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8009: b’ffff00158d00021e2cc85046ee23400fbc89013b0b’
2019-12-28 10:40:25 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-12-28 10:40:25 DEBUG (SyncWorker_8) [zigate] STATUS code to command 0x0009:RESPONSE 0x8000 - Status response : status:0, sequence:0, packet_type:9, error:b’’, lqi:0
2019-12-28 10:40:25 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8009 - Network state response : addr:ffff, ieee:00158d00021e2cc8, panid:20550, extended_panid:17159629441543504187, channel:11, lqi:0
2019-12-28 10:40:25 DEBUG (SyncWorker_8) [zigate] Waiting for message 0x8009
2019-12-28 10:40:25 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-12-28 10:40:25 DEBUG (SyncWorker_8) [zigate] Stop waiting, got message 0x8009
2019-12-28 10:40:25 DEBUG (SyncWorker_8) [zigate] Network is down, start it
2019-12-28 10:40:25 DEBUG (SyncWorker_8) [zigate] REQUEST : 0x0024
2019-12-28 10:40:25 DEBUG (SyncWorker_8) [zigate] Msg to send b’0024000024’
2019-12-28 10:40:25 DEBUG (SyncWorker_8) [zigate] Encoded Msg to send b’01021024021002102403’
2019-12-28 10:40:25 DEBUG (SyncWorker_8) [zigate] Waiting for status message for command 0x0024
2019-12-28 10:40:25 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b’\x01\x80\x02\x10\x02\x10\x02\x15\xa1\x02\x10\x02\x10\x02\x10$\x02\x10\x03’
2019-12-28 10:40:25 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-12-28 10:40:25 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8000: b’00000024’
2019-12-28 10:40:25 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8000 - Status response : status:0, sequence:0, packet_type:36, error:b’’, lqi:0
2019-12-28 10:40:25 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2019-12-28 10:40:25 DEBUG (SyncWorker_8) [zigate] STATUS code to command 0x0024:RESPONSE 0x8000 - Status response : status:0, sequence:0, packet_type:36, error:b’’, lqi:0
2019-12-28 10:40:25 DEBUG (SyncWorker_8) [zigate] Waiting for message 0x8024
(…)

I have not (yet) the knowledge to parse these lines.
Do you have an understanding of theses traces ?
Does lqi:0 means the RF signal is too weak ?

Thanks for any help you could provide.

Not sure if you’ve been following the thread on the EcoSmart bulbs and remote:

I was able to pair the bulb with my Zigate but like others, no luck with the remote. Wondering if you think that the work that is being done with ZHA will work out of the box with your Zigate component, if not, is there a way that you can check what has been done and see if you could implement? These remotes are really nice.

When you say “no luck with the remote” what do you mean ?
The remote is paired but there’s no sensor entity in HA ?
Or you can’t pair the remote ?

Yes, seems like I can pair the remote, but the only thing that I can see are these two entities:

  • zigate.ccccccfffed98f1f
  • sensor.device_ecca_ccccccfffed98f1f_battery

The battery sensor seems to report correctly as it shows 100% but the other zigate entity does not seem to report any state change.

But it seems like the thread that I pointed out earlier has found a fix for it.
Wondering if you could leverage the same fix.

Hello doudz,

When I upgrade HA from 0.103.6 to 0.104.b0 and up, I get the following error :
2020-01-25 16:19:34 DEBUG (SyncWorker_11) [custom_components.zigate] Port : /dev/serial0
2020-01-25 16:19:34 DEBUG (SyncWorker_11) [custom_components.zigate] Host : None
2020-01-25 16:19:34 DEBUG (SyncWorker_11) [custom_components.zigate] GPIO : True
2020-01-25 16:19:34 DEBUG (SyncWorker_11) [custom_components.zigate] Led : True
2020-01-25 16:19:34 DEBUG (SyncWorker_11) [custom_components.zigate] Channel : None
2020-01-25 16:19:34 DEBUG (SyncWorker_11) [custom_components.zigate] Scan interval : 0:02:00
2020-01-25 16:19:35 DEBUG (SyncWorker_11) [custom_components.zigate] ZiGate object created <zigate.core.ZiGateGPIO object at 0xa6f5f350>
2020-01-25 16:19:35 ERROR (MainThread) [homeassistant.setup] Error during setup of component zigate
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.7/site-packages/homeassistant/setup.py”, line 174, in _async_setup_component
component.setup, hass, processed_config # type: ignore
File “/usr/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/homeassistant/.homeassistant/custom_components/zigate/init.py”, line 288, in setup
component = EntityComponent(_LOGGER, DOMAIN, hass, scan_interval, GROUP_NAME_ALL_ZIGATE)
TypeError: init() takes from 4 to 5 positional arguments but 6 were given
2020-01-25 16:20:43 ERROR (SyncWorker_14) [homeassistant.components.xiaomi_aqara] No gateway discovered

I have ugraded the zigate fw to 3.1.c but this error remains.
I had a look at the differences between 0.103.6 and 0.104.b0 but could’t find a link to that error.

Have you encountered this issue so far ?

Hi,
You’re not using the latest version of the component, the problem has been solved, please update from git

1 Like

I updated Zigate component and then upgraded HA to 0.104.3 and this is working.
Thank you very much.

I know this is not the right thread for this, but I am looking for the psm-set and psm-get commands of the Xiaomi gateway. I have been asking on several other forums but didn’t get any answers.
If you happen to have them could you send them to me at [email protected] ?

Thank you again.

Hello,
everyone, what’s the status of zigpy-zigate ?
is it better than zigate component or it’s a dead projet ?

Thanks every one ! :slight_smile:

Clearly none of the two projects are dead.
Both have advantages and inconvenients.
The zigate component fit my own needs so that’s why I’m still using it (and because the python lib is shared with the Jeedom plugin too)

zigpy-zigate hasn’t been fully tested by me because of lack of time, so when something goes wrong it’s hard to say if it’s a zigpy problem, zigpy-zigate problem or zigate problem.
Any help is well accepted.

2 Likes

Hello,

I am seing in the log traces like :
2020-03-12 15:13:40 DEBUG (ZiGate-Decode data) [custom_components.zigate] Update attribute for device Device lumi.sensor_switch (9ee5) 00158d00039xxxxx {‘endpoint’: 1, ‘cluster’: 6, ‘addr’: ‘9ee5’, ‘attribute’: 32768, ‘data’: 2, ‘expire’: 2, ‘name’: ‘multiclick’, ‘type’: <class ‘int’>, ‘value’: 2}

I’d like to know if there is a possibility to access from an automation the fields like “data”, “expire”, value" ?
Those fields are not accessible thru state_attr(‘sensor.zigate_00158d00039xxxxx_multiclick’, ‘value’).

If you try to use the event zigate.attribute_updated you should have all the fields.

Thanks biau for your answer.

I have been thru with path “event zigate.attribute_updated”.
It applies only to zigate.00158d00039xxxxx, not to sensor.zigate_00158d00039xxxxx_multiclick.

When I try to access the attributes of zigate.00158d00039xxxxx, only those are available :
lqi_percent, type, manufacturer, receiver_on_when_idle, missing, generic_type, groups, datecode, battery_voltage, battery_level, addr, id, ieee, last_seen, lqi, mac_capability, power_type, rejoin_status,
friendly_name, icon
The fields ‘attribute’, ‘data’, ‘expire’, ‘name’ are not available. I think they are related to multiclic.

Also, I noticed that :
{{ states.zigate.00158d00039xxxxx }} and {{ states.zigate.00158d00039xxxxx.icon }} are giving an error,
althought :
{{ states(‘zigate.00158d00039xxxxx’) }} and {{ state_attr(‘zigate.00158d00039xxxxx’, ‘icon’) }} give a result.

Hi
I pair my new profalux shutter with the zigate and home assistant added it as light entity instead of a cover entity. Does anyone know how to fix that?
Thanks !

Thanks for this plugin. It worked well but I have issue from time to time with my four Legrand switches (reference 067723) In fact at some moment, some switches (not always the same, sometime just one, sometime the four of them) doesn’t work correctly. I press some button, and nothing happen (ie : no event in home assistant automation). After a few time, then it restart… Is there anything I can try to improve this ?

Thanks