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


#1284

@jarrah Thanks. Digging into the “groups” discussion on the github page gives me the impression that bulbs can belong to multiple groups, which is huge. Allows for the creation of fixtures inside rooms that Hue hub can’t do! I’ll have to test this out.


#1285

Hoping someone can point out someone obvious here, its doing my nut in at the moment.

Made the mistake of doing some config and cleanup while at work today. Updated HA, z2m etc and redid some of the code as I hit some breaking changes along the way.

Now all my automations related to z2m have stopped working and for the life of me cannot figure out why.

This is one example with my Hue remote, I have the same issue with Xiamoi buttons and door sensors connected through it. HA seems to be ‘ignoring’ automations connected to MQTT triggers.

I copied the new sensor and automation code directly from the github config pages as it has been updated since I first put them in. It works, HA sees it and changes the sensors state perfectly fine, it just will not trigger any actions attached to it!

(script.bedside_toggle = working fine on its own and when connected to FLIC button event)

z2m Config:
  '0x0017880104091dba':
    friendly_name: hue_remote_master_bedroom
 
HA YAML
sensor:
  - platform: "mqtt"
    name: HUE Remote - Master Bedroom  
    state_topic: "zigbee2mqtt/hue_remote_master_bedroom"
    availability_topic: "zigbee2mqtt/bridge/state"
    icon: "mdi:gesture-double-tap"
    value_template: "{{ value_json.action }}"
    force_update: true

automation:
  - alias: Bedside Toggle
    hide_entity: false  
    trigger:
      platform: mqtt
      topic: 'zigbee2mqtt/hue_remote_master_bedroom'
    condition:
      condition: template
      value_template: "{{ 'off' == trigger.payload_json.action }}"
    action:
      - service: script.turn_on
        entity_id: script.bedside_toggle

I can see it in the z2m logs:
zigbee2mqtt:info 2019-2-15 22:11:31 MQTT publish: topic 'zigbee2mqtt/hue_remote_master_bedroom', payload '{"battery":100,"linkquality":97,"last_seen":"2019-02-14T20:54:16.623Z","elapsed":1003052,"action":"off"}'

I can see it in HA logs
2019-02-15 22:11:31 DEBUG ... Received message on zigbee2mqtt/hue_remote_master_bedroom: b'{"battery":100,"linkquality":97,"last_seen":"2019-02-14T20:54:16.623Z","elapsed":1003052,"action":"off"}'

2019-02-15 22:11:31 DEBUG ... <Event state_changed[L]: entity_id=sensor.hue_remote_master_bedroom, old_state=<state sensor.hue_remote_master_bedroom=off; friendly_name=HUE Remote - Master Bedroom, ... @ 2019-02-15T22:10:10.396659+00:00>, new_state=<state sensor.hue_remote_master_bedroom=off; friendly_name=HUE Remote - Master Bedroom, ... @ 2019-02-15T22:11:31.182320+00:00>>

But the script does not get run, no mention of it in HA logs at all.

Now this is the absolute kicker, using the other hue remote events (on, press-up, press-down) in the exact same yaml, literally changing ‘off’ to one of the others…it works perfectly…

:japanese_goblin: absolutely killing me this is :speak_no_evil:


#1286

Check the status of your automation, it might be accidentally switched off.


#1287

Check if your automations are on. If you don’t have initial_state set to on in the automations, they are probably off now after upgrading to the new version.


#1288

Make the state_topic in the sensor and automatisme part the same as the topic topic of z2m.

zigbee2mqtt/0x0017880104091dba


#1289

O.M.G. I could kiss all of you.

They were all off except the working one. I didn’t even think to look at the state of the automations themselves…

I could cry :rofl:


#1290

@wixoff could you please confirm the flashing process (and firmware to use) for this device? Thank you in advance.


#1291

For everyone with a CC2531 stick and not yet using the latest firmware (1.1.1), it is now possible to flash the latest firmware without re-pairing the devices (or using tin foil etc).
You have to use this version https://github.com/Koenkk/Z-Stack-firmware/tree/dev/coordinator/CC2531/bin

More info here https://github.com/Koenkk/zigbee2mqtt/issues/1088

Flashed my stick yesterday and that worked like a charm :smile:


#1292

If I want to avoid re-pairing and use the latest firmware for the coordinator, is it mandatory to use the very same stick? I have a spare one and would love to flash a brand new stick instead. Thoughts?


#1293

You have to use the same stick. When flashing you also have to select Retain eee address so the config is not overwritten.
I suggest you flash the spare stick as router so you can improve the range of the Zigbee network.


#1294

Thanks man!


#1295

is there anyway to have HA notice that a light is still on, and have it mark it as switched on on the front-end?

So for example, if I reboot HA and a light is on already, it won’t be reflected that way in HA.

thoughts?


#1296

I did not set retain eee to enabled (as in the flash docs) but my devices still work (did not have to repair.

Do does this really make a difference?


#1297

Apparantly not as all your devices are still working :slight_smile:
I have read somewhere in the forum that this settings needs to be enabled when flashing a new firmware version, but maybe that’s was only needed with the old method.


#1298

It will be reflected that way.


#1299

I have one ikea TRÅDFRI bulb. Unfortunately, I still have a dumb wall switch. If I switch on the bulb, HA won’t notice it in my case. I must manually slide the item in HA, and then it will pick the state up.

I understand from your response that HA should pick it up automatically whenever the light turns on?? In my case it doesn’t apparently.


#1300

AFAIK that issue hasn’t been solved yet.


#1301

If you’d mentioned the dumb wall switch to start with it might have been clearer.


#1302

Well, isn’t it the same case with rebooting HA and switching on a light?


#1303

Yes there is a way! In the config file of zigbee2mqtt you have to set your bulb to “retain: true”: