Another component for ZiGate

Yes sure but when I switch back to your component the motion sensor paired with zha was detected and added (even if I had to restart discovery).
And for devices like the xiaomi dual relay behind the wall switch you can’t access to the pair button without removing the wall switch…

Sorry about that
it should probably possible to write a small script that import zigate.json into the zha database.

Oh do not misunderstand what I mean.
You only have a functionality they don’t but of course it’s not something usual to switch from a component to another.

Impressive work @doudz, you have all my thanks!
I was thinking for getting a Conbee 2,instead but now will hold off and try the zha component and give zigate another chance!

Hello Doudz and all,
I’m using your component since a year now and works perfetly with many Xiaomi, Philips and Ikea sensor/devices.
I would like to thank you a lot for the time you spend on it. I follow with attention all the evolutions and
that s why I tried the ZHA component. I am pretty sure I ve update zigate firmaware to 3.1a and (im sure) I m using home assisant at version 0.98.1
I see on GitHub that you have released a new version of zigpy-zigate (0.2.0) but I am stuck now. I use HASSbian and after have successfully upgrade tne zigpy-zigate to 0.2.0 (pip freeze in venv show 0.2.0 version for your module).

Installing collected packages: zigpy-zigate
  Found existing installation: zigpy-zigate 0.1.0
    Uninstalling zigpy-zigate-0.1.0:
      Successfully uninstalled zigpy-zigate-0.1.0
Successfully installed zigpy-zigate-0.2.0

but when I restart HA service it downgrad it to 0.1.0

 CGroup: /system.slice/system-home\x2dassistant.slice/[email protected]
           ├─14507 /srv/homeassistant/bin/python /srv/homeassistant/bin/hass
           └─14541 /srv/homeassistant/bin/python -m pip install --quiet zigpy-zigate==0.1.0 --upgrade --constraint /srv/homeassistant/lib/python3.7/site-packages/homeassistant/pac


I would like to know if it s possible to avoid this. I am aware that this is not related to your component but if you have any ideas I take them. Now if I changing to Hass.io make things easier I would do it.

For the records I tried this because when I want to pair a device to the zigate (Add device in ZHA) the zigate did not seems to be in paring mode (blue led is not blinking) and get this log :

Sep 02 07:58:06 hassbian hass[14507]: 2019-09-02 07:58:06 DEBUG (MainThread) [zigpy_zigate.zigbee.application] Broadcast not implemented.
Sep 02 07:58:06 hassbian hass[14507]: 2019-09-02 07:58:06 DEBUG (MainThread) [zigpy_zigate.uart] Send: 0x49 b'fffc3c00'
Sep 02 07:58:06 hassbian hass[14507]: 2019-09-02 07:58:06 DEBUG (MainThread) [zigpy_zigate.uart] Frame to send: b'\x00I\x00\x04r\xff\xfc<\x00'
Sep 02 07:58:06 hassbian hass[14507]: 2019-09-02 07:58:06 DEBUG (MainThread) [zigpy_zigate.uart] Frame escaped: b'\x02\x10I\x02\x10\x02\x14r\xff\xfc<\x02\x10'
Sep 02 07:58:06 hassbian hass[14507]: 2019-09-02 07:58:06 DEBUG (MainThread) [zigpy_zigate.uart] Frame received: 800000054c8000004900
Sep 02 07:58:06 hassbian hass[14507]: 2019-09-02 07:58:06 DEBUG (MainThread) [zigpy_zigate.api] data received 0x8000 b'80000049' LQI:0
Sep 02 07:58:06 hassbian hass[14507]: 2019-09-02 07:58:06 DEBUG (MainThread) [zigpy_zigate.zigbee.application] zigate_callback_handler [128, 0, 73, b'']

Thanks

You’ll have to wait for a HA update to have 0.2.0

Ok thx for the clear answer !

I’ve added a sensor to configuration.yml to get the battery level but I am getting unknown for the temperature:

sensor:
  - platform: template
    sensors:
      sensor_zigate_bathroom_suite_battery:
        unit_of_measurement: '%'
        value_template: '{{ zigate.bathroom_suite.attributes.battery_level }}'
        friendly_name: "Suite bathroom battery"

zigate.bathroom_suite is the id of the sensor that appears under zigate
temperature sensor id is sensor.zigate_bathroom_suite_temperature so, I’ve also tried {{ states.sensor.zigate_bathroom_suite_temperature }} that instead of unknown appears %.
any help?

Tries something like this

{{ states.zigate['00158d0002a229fb'].attributes.battery_level }}

where 00158d0002a229fb is the unique id

Thanks @doudz I’ll try and give feedback

@doudz tried "{{ states.zigate['zigate_bathroom_suite_temperature'].attributes.battery_level }}"
and "{{ states.zigate['bathroom_suite'].attributes.battery_level }}"
with the same results as above, not working.

It works for me:

and:

it also worked for me on the template editor, but not with the configuration.yml! :thinking:

You could use this: https://github.com/notoriousbdg/Home-AssistantConfig/blob/3adce961312c018ffff733d8e581e77cde2d9e8a/packages/battery_alert.yaml
recommended by doudz !
You get a sensor for every single device with a battery attribute :heart_eyes:

Yes, I’ll use it.

In the meantime solved the issue adding this:
entity_id: zigate.bathroom_suite

Automation with aqara cube
Hello, Guys

I’m trying to use the cube rotation to modulate brightness of Hue bulbs but it’s not working as expected.
I haven’t found a working example with zigate so I tried this. It works partially. I can only move one step lower or one step higher and I can’t understand why

- alias: cube brightness
  trigger:
  - entity_id: sensor.zigate_00158d000xxxxxxx_rotation
    platform: state
  action:
    - data_template:
        brightness: >
          {% set delta = 40 %}
          {% if states('sensor.zigate_00158d000xxxxxx_rotation') | int > 0 %}
            {%- set bright = state_attr('light.zigate_001788010xxxxxxx_11','brightness') | int + delta %}
          {% elif states('sensor.zigate_00158d000xxxxxxx_rotation') | int < 0 %}
            {%- set bright = state_attr('light.zigate_001788010xxxxxxx_11','brightness') | int - delta %}
          {% endif %}
          {% if bright > 255 %}
            255
          {% elif bright < 0 %}
            0
          {% else %}
            {{ bright }}
          {% endif %}
      entity_id: light.zigate_001788010xxxxxxx_11

The step is 40 (brightness range from 0 to 255)

After 1 rotation I have this error:
Error rendering data template: UndefinedError: 'bright' is undefined
The error might be caused by the fact that the rotation value goes back to 0 once cube is stopped but doesn’t help understanding what doesn’t work.

Any idea?

Don’t know where int is set but could it be 0?
Si you should have <= or >= ?

Did you try to set bright on first ?

- alias: cube brightness
  trigger:
  - entity_id: sensor.zigate_00158d000xxxxxxx_rotation
    platform: state
  action:
    - data_template:
        brightness: >
          {% set bright = state_attr('light.zigate_001788010xxxxxxx_11','brightness') | int %}
          {% set delta = 40 %}
          {% if states('sensor.zigate_00158d000xxxxxx_rotation') | int > 0 %}
            {%- set bright = state_attr('light.zigate_001788010xxxxxxx_11','brightness') | int + delta %}
          {% elif states('sensor.zigate_00158d000xxxxxxx_rotation') | int < 0 %}
            {%- set bright = state_attr('light.zigate_001788010xxxxxxx_11','brightness') | int - delta %}
          {% endif %}
          {% if bright > 255 %}
            255
          {% elif bright < 0 %}
            0
          {% else %}
            {{ bright }}
          {% endif %}
      entity_id: light.zigate_001788010xxxxxxx_11

What do you mean? The thing is the rotation value goes back from the final angle to 0 each time the cube is released so I wanted to exclude this case because including 0 caused bumps in brightness.
I go from 0 to 90 angle -> angle > 0 --> brightness up
I release the cube -> angle = 0 -> brightness up or down depending on where the = 0 is in the if loop.

I tried to use a template for trigger. rotation > 0 or rotation < 0 but that didn’t solve my problem either ( only one step up or down and then bright undefined)

Hey Doudz,
I will try tonight.

By the way, what does the zha compatibility imply for people already using zigate component?
Do we now need to use ZHA integration (and re setup everthing since entity names, attributes and co might be different)?
What about zigate dependent features: panels, network graph, services?

Thanks for your work and time!