Zigbee2mqtt: getting rid of your proprietary Zigbee bridges (Xiaomi, Hue, TRADFRI)

Hi
is there a way to show in the front end the current zigbee2mqtt installed version and the latest version available ?

Hey, how can I add the retain flag to an auto discovered lamp?
Problem is, in the last days it often looses connection and turns on in the middle of the night when reconnecting to the broker. Also the state is inconsistent in HA when this happens.

Yes, there is. This is what I have. The command line sensor checks what version is installed, the rest reads the current version available, then I have a template sensor to combine the 2. It tells me what’s installed, but if a new version is available, it tells me “Update Available x.x.x”.

The icon template doesn’t seem to be working it the moment and I haven’t had a chance to work it out.

sensor:
  - platform: command_line
    name: zigbee2mqtt_installed_version
    command: 'cat /opt/zigbee2mqtt/package.json'
    value_template: '{{ value_json.version }}'
    scan_interval: 3600

  - platform: rest
    name: zigbee2mqtt_github_version
    resource: 'https://api.github.com/repos/Koenkk/zigbee2mqtt/releases/latest'
    headers:
      accept: application/vnd.github.v3+json
      content-type: application/json
      user-agent: home-assistant/rest-sensor
      Authorization: !secret github_header_token
    value_template: >-
      {{ value_json.tag_name }}
    scan_interval: 360

  - platform: template
    sensors:
      zigbee2mqtt_version:
        entity_id: 
          - sensor.zigbee2mqtt_github_version
          - sensor.zigbee2mqtt_installed_version
        friendly_name: Version
        value_template: "{%- if states.sensor.zigbee2mqtt_installed_version.state == states.sensor.zigbee2mqtt_github_version.state -%}{{states.sensor.zigbee2mqtt_installed_version.state}} {% else %}Update Available {{states.sensor.zigbee2mqtt_github_version.state}} {% endif%}"
        icon_template: >-
          {% if states.sensor.zigbee_installed_version.state == states.sensor.zigbee_github_version.state %}
            mdi:checkbox-marked
          {% else %}
            mdi:checkbox-blank-outline
          {% endif %}
2 Likes

thanks a lot !

I have some xiaomi contact sensors and a few tradfri items working nicely with zigbee2mqtt (thanks for all your hard work). I’m having trouble with a xiaomi aqara human body sensor (RTCGQ11LM). I can pair it and see it in HA, but it seems to stay in a constant state (as if it is floating). For example at 3am ish in an empty room it will change to occupied for several hours. The blue LED also doesn’t flash on movement. Does anyone have any ideas?

I don’t think the blue led is supposed to blink when occupied, mine doesn’t do that either. So this should be fine.

Did you check the link quality. I once had a sensor that did not change it’s state, although it should have and this was because of a bad connection (linkquality 0 or max. 1).
What still would be strange here, is that it changes it’s state in the middle of the night when no one is there. That cannot be explained by bad connection.

Thanks h4nc - good to know about the led.
linkstate is good (I tried it next to the stick too)
I have just turned it so the grey ring is up (I read this in another post) and it seems to be behaving for now. I also added Qos 1 to the config, so I’m not sure which has helped.

I’ll have to see whether it remains stable.

Thanks for the input

Just want to note that mine stand with the grey ring facing down and work fine.

good to know - i’ll try to invert after a longer test of the status quo

Another random question:

I would like to alter the transition time on an Ikea Tradfri GU10 bulb (LED1650R5). Is this possible?
how do I do this?
does it go under devices in the zigbee2mqtt/configuration.yaml
e.g.

devices:
    'some device id':
    friendly_name: 'tradfri bulb'
    retain: true
    qos: 1
    homeassistant:
      transition: 5

You have to use transition in an automation or a script. You can’t set it in the zigbee2mqtt config.

Thanks - I wondered that. I was hoping to have a generic transition so I didn’t need to specify it in each automation/script

I updated everything and now Zigbee2MQTT supports multiple clicks for the Hue Dimmer buttons.

While I love having the ability to assign multiple functions to a single button, I prefer having lightning fast response times that are now gone with this update because it has to determine whether the press is single or multiple.

Is there a way to also send an instant command like on-press-instant or something like that? it could just be ignored by people using other presses and would bring back the quickness for me and others who want it.

Anyone using z2m with node-red?

Ive just started out with NR and am struggling to get to grips with the z2m side of it.

I can do the normal MQTT stuff like toggle my sonoffs etc but going ‘z2m > NR > z2m’ is killing me and I feel like Im missing something stupid.

Has anyone got, or could do me, a quick flow of something simple like “Xiaomi Button ‘triple’ press > toggle a Hue bulb” I could pick apart to get me started?

I think I have to parse the incoming json, pick the click event, send it to another switch to convert to a /set event to send to the Hue bulb.

It seems a long way round way at the minute and really feel like Im missing something compared to yaml?

Im looking to (eventually) move most of my automations from HA into NR in prep for a new house.

All the examples Ive looked at are either really ‘simple’ (sonoff ON/OFF) or too much (presence detection and functions etc).

Id be most grateful :slight_smile:

I use the HA state node sensor for my zigbee2mqtt sensors in Node Red to trigger a Node Red flow. If I want to turn on a light controlled by zigbee2mqtt, I use a Home Assistant call service node within Node Red to do so.

Is the problem you’re having, detecting a triple click from the button"?

1 Like

You do know this is the home-assistant forum, not node-red.

Ahh right I see, so NR still talks to HA to get the state and use that for any triggers for automation created in NR.

I was under the impression that NR took the reigns away from HA and handled the automation completely by itself and HA picked up on the changes to states itself via the MQTT.

That makes a little more sense now with the interactions between the two!

1 Like

@IAmTheDude I used to use NR with the native plugins too - ie used HUE, TPLINK, etc; It was practically standalone from HA.

However, about 6 months ago I just moved everything over to use the HA plugin so I use the entities from HA and NR does the automations. I run NR in a Linux container (LXC in proxmox not Docker) and the CPU has gone form a constant 50% to around 1% now too.

The only drawback is that some HA releases do break the connection
oh and the fun I had when legacy passwords were depreciated :slight_smile:

Basically HA runs everything now and NR is for my automations based on HA entities. Not sure how others run it, but it works for me :slight_smile:
mb

1 Like

Brill, thats kind of what i was looking at.

I want to keep HA ‘in the loop’ and talking to NR. Some of the tuts Ive seen/watched use the HA entities but then others are independent of HA and it got a little confusing when first trying it out.

I plan to eventually have HA running on a more beefier box but still use the Pi’s around the house as bluetooth (for flic) and z2m access points depending on things pan out when I kit out all my Xiaomi and Hue stuff around the house.

I don’t intended to go full Hue and after using z2m for a while have no intentions of using any other hubs! :slight_smile:

Everywhere I look makes NR look SO easy until I sat down to play with it :frowning:

Ill give using HA>NA a whirl and go from there.

1 Like

{

“data_path”: “/share/zigbee2mqtt”,
“homeassistant”: true,
“permit_join”: true,
“mqtt_base_topic”: “zigbee2mqtt”,
“mqtt_server”: “mqtt://192.168.1.10:3218”,
“serial_port”: “/dev/ttyACM0”,
“devices”: ,
“network_key”:
}

{
“logins”: [
{
“username”: “xxx”,
“password”: “xxx”
}
],
“anonymous”: true,
“customize”: {
“active”: false,
“folder”: “mosquitto”
},
“certfile”: “fullchain.pem”,
“keyfile”: “privkey.pem”
}

Hi
 more than 1 month i try to wrok my zigbee2mqtt but didt work
 i do not know what i missing.i thing i will give up soon


i thing aqara wall swich or zigbee2mqtt is broken,i do not understand


any idea ?