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

This is currently not possible, but there is an issue open to add this for Tradfri: https://github.com/Koenkk/zigbee2mqtt/issues/151

Here also my Zigbee2mqtt working on Hass.IO and got my Philips Ledstrip connected, now I got my Philips Hue Dimmer Switch Paired. Any thoughts on this how to add this as a sensor or switch within Hass.IO?

Hi Guys!

Foremost, this is an incredible project and it is perfectly working with Xiaomi and HUE devices! Congratulations!

Now Im trying to improve my setup by creating scenes on HA with HUE lights, but something doesnā€™t seem correct since when triggered the scene only turn the lights on but doesnt change collors or set the bright level.

Anyone had success with this kind of setup?

Edit: Ive noticed that trying to command more than one light at time crashes the Z2M at the point that I have to restart the raspberry. Actually Ive created a Light Group (https://www.home-assistant.io/components/light.group/). Controlling lights individually isnt a problem, but grouped Z2M crashes every time.

I think thats related with MQTT payload format sent by HA while lights are in group is different when sent to a single light. Simple commands as turn on and off doesnā€™t trigger this issue, only changing brightness or collors.

Thanks in advance!

Troitino

Trying to add a new device - AliExpress sourced WF321 single colour LED strip controller (and WF323 for RGB).
But neither of them appear to even connect to the network - followed pairing instructions, status light on the device seems to light up but no dice. Also tried pushing buttons to keep it awake like some of the Xiaomi devices require. Nothing showing in debug log eitherā€¦ thoughts on where to from here?

Googled version of the manual: https://www.kiwilighting.com/user-guide/KW-WF320-ZigBee/KW-WF321.pdf

Further to this, just tested by trying to get a Hue Dimmer Switch to pair, and I get the expected ā€œWARN Device with modelID ā€˜RWL021ā€™ is not supported.ā€ Error, so suspecting itā€™s an issue with these AliExpress devices.

Hello everyone,

I think Iā€™ve managed to install all the different components. Big shout out to @scottdarby for taking care of the dongle :slight_smile:

So far I do see MQTT messages comming into Mosquitto server

zigbee2mqtt/0x00158d000252b7a5 {"click":"single"}
zigbee2mqtt/0x00158d000252b7a5 {"click":"single"}
zigbee2mqtt/0x00158d000252b7a5 {"click":"single"}

But I know one can display de device in Home Assistant. Unfortuntally I donā€™t see any entity in my entity list in HA and this feels a bit weird.

Could somebody provide some guidance on how to represent the paired device in HA?

Thanks a million and sorry if Iā€™m overlooking something very obvious :frowning:

You need to add them to your config file,

this page should help get you started out

Thanks @Cee,

I missed that one!! Not sure how by I definitely missed it. I would swear I followed all the nested steps but nowhere did I see I reference to that chapter. Will take a look and reach back in case it didnā€™t work, but Iā€™m confident it will work :slight_smile:

One question, why would someone want to manually setup the different device profiles and not have the system provision the devices through autodiscovery?

Many thanks again! :slight_smile:

1 Like

I personally setup all mine manually, then if they drop out, they are just unavailable, or if you restart, and something isnā€™t working, its easier to see that is has failed, rather trying to look for something that isnā€™t there. Well, thatā€™s my view anyway, donā€™t take it as anything more than that. I am still very new to HA as well.

What is the use of FRIENDLY NAME in

state_topic: "zigbee2mqtt/<FRIENDLY_NAME>"

in the configuration you pointed me to? Is it mqtt topic? What do you use in your case, or how do you structure this data?

Thanks :grinning:

Come on guys! Read the wiki. Yes, you could give the zigbee device a friendly name.

3 Likes

If I have been able to come this far by myself, it is not because I have not read the wiki, believe me.

from this page in the wiki,

I donā€™t have mine setup and running at the moment, as the hive devices I bought it for arenā€™t supported, and are beyond my scope of adding them in, and the person that was working on them seemā€™s to have gone quiet, but an example from the page above,

devices: 
  '0x00158d0001d82999':
    friendly_name: 'my_occupancy_sensor'
    retain: true
    occupancy_timeout: 20
    qos: 1

But if you havenā€™t set up a friendly name then,

friendly_name: Used in the MQTT topic of a device. By default this is the device ID (e.g. 0x00128d0001d9e1d2).

Hope this helps out again.

It does! I now only seem to have a conflict with mqtt, but will investigate into it later on when Iā€™m back at my desk. Thanks @Cee

Check entity_registry.yaml on double entries.

Thanks @kitus,
Just received the latest batch if anyoneā€™s interested in a pre-flashed device PM me!

I love when one accomplishes something relevant. Iā€™ve now just managed to switch on and off a Tradfri bulb using a xiaomi button, with no gateways in between!!!

I feel however that there is some room for improvement. I hope you guys can help me figure out a couple of things:

  1. I just paired the bulb, and configuration.yaml (zigbee2mqtt) did already display the new device with the friendly unfriendly name. I then edited the name but the entity in HA showed of course the previous unfriendly name. Do I really need to restart HA everytime I add a new device?
  2. When the system came up, it showed the Xiaomi button with state unknown and the tradfri light as off. Neither of both states was right because as soon as I clicked on the button, the light went off. This leads me to the main question: How do you guys harden your configuration (not only for this add-on but generally speaking) so that when you reboot your system, you reach a known state before accepting newer updates from the world?

Many thanks and congratulations to @Koenkk and the team. This is AWESOME!!

Well, it seems I was lucky enough with the two first devices I tried to add to Zigbee2mqtt because, as reported just above, it worked very well. However, Iā€™ve decided to add two additional devices and it seems they donā€™t work:

  1. Xiaomi PIR: It seems the system sees it during pairing, and does embrace it a little bit different than with the Xiaomi switch (thatā€™s at least my humble interpretation if I compare the log they both generated during the pairing process. And zigbee2mqtt is not fully recognizing the PIR based on what the log suggests:

    2018-7-29 02:09:14 INFO Currently 4 devices are joined:
    2018-7-29 02:09:14 INFO pulsador_xiaomi_test (0x00158d000252b7a5): WXKG01LM - Xiaomi MiJia wireless switch (EndDevice)
    2018-7-29 02:09:14 INFO kitchen_bulb (0x000b57fffedc1058): LED1623G12 - IKEA TRADFRI LED bulb E27 1000 lumen, dimmable, opal white (Router)
    2018-7-29 02:09:14 INFO tradfri.bulb-corridor (0x90fd9ffffe4bf6fd): LED1545G12 - IKEA TRADFRI LED bulb E26/E27 980 lumen, dimmable, white spectrum, opal white (Router)
    2018-7-29 02:09:14 INFO xiaomi.movement-kitchen (0x00158d000251f830): unkown - undefined unknown (EndDevice)

And, regarless what I try, the PIR detector will simply not appear on the entity view in States (Entities) view, whereas the other 3 do appear in there

  1. The second tradfri bulb that I just added to the system, canā€™t seem to be commanded by Home Assistant (it does not react when I turn it on or off in HA interface. If I review the log I see warning messages:

    2018-7-29 02:12:25 WARN Cannot handle MQTT message with topic ā€˜zigbee2mqtt/tradfri.bulb-corridor/setā€™ and message ā€˜{ā€œstateā€: ā€œONā€}ā€™
    2018-7-29 02:12:31 WARN Cannot handle MQTT message with topic ā€˜zigbee2mqtt/tradfri.bulb-corridor/setā€™ and message ā€˜{ā€œstateā€: ā€œONā€}ā€™
    2018-7-29 02:13:17 WARN Cannot handle MQTT message with topic ā€˜zigbee2mqtt/tradfri.bulb-corridor/setā€™ and message ā€˜{ā€œstateā€: ā€œONā€}ā€™

On this note, Iā€™ve seen there is a PR created for addressing a similar case TRADFRI bulb E27 opal 1000lm Ā· Issue #21 Ā· Koenkk/zigbee2mqtt Ā· GitHub with a very similar IKEA bulb, but it looks like it was solved in May. Does anybody have an ā€œIKEA TRADFRI LED bulb E26/E27 980 lumenā€ and is successfully using it with Z2MQTT?

Iā€™m also attaching the full log I see in the add-on in case it helped understand what is going on:

    >[Info] Configuration file found. Will overwrite configurable               fields with values from add-on configuration
    [Info] Configuration written to /share/zigbee2mqtt/configuration.yaml
    [2018-07-29T02:08:58.721Z] PM2 log: Launching in no daemon mode
    [2018-07-29T02:08:59.639Z] PM2 log: Starting execution sequence in -fork mode- for app name:npm id:0
    [2018-07-29T02:08:59.746Z] PM2 log: App name:npm id:0 online
    > [email protected] start /app
    > node index.js
    2018-7-29 02:09:09 INFO Starting zigbee2mqtt version 0.1.1 (commit #738c31c)
    2018-7-29 02:09:09 INFO Starting zigbee-shepherd
    2018-7-29 02:09:14 INFO zigbee-shepherd started
    2018-7-29 02:09:14 INFO Currently 4 devices are joined:
    2018-7-29 02:09:14 INFO pulsador_xiaomi_test (0x00158d000252b7a5): WXKG01LM - Xiaomi MiJia wireless switch (EndDevice)
    2018-7-29 02:09:14 INFO kitchen_bulb (0x000b57fffedc1058): LED1623G12 - IKEA TRADFRI LED bulb E27 1000 lumen, dimmable, opal white (Router)
    2018-7-29 02:09:14 INFO tradfri.bulb-corridor (0x90fd9ffffe4bf6fd): LED1545G12 - IKEA TRADFRI LED bulb E26/E27 980 lumen, dimmable, white spectrum, opal white (Router)
    **2018-7-29 02:09:14 INFO xiaomi.movement-kitchen (0x00158d000251f830): unkown - undefined unknown (EndDevice)**
    2018-7-29 02:09:14 WARN `permit_join` set to  `true` in configuration.yaml.
    2018-7-29 02:09:14 WARN Allowing new devices to join.
    2018-7-29 02:09:14 WARN Set `permit_join` to `false` once you joined all devices.
    2018-7-29 02:09:14 INFO Zigbee: allowing new devices to join.
    2018-7-29 02:09:14 INFO Connecting to MQTT server at mqtt://core-mosquitto:1883
    2018-7-29 02:09:14 INFO zigbee-shepherd ready
    2018-7-29 02:09:14 INFO Connected to MQTT server
    2018-7-29 02:09:14 INFO MQTT publish, topic: 'zigbee2mqtt/bridge/state', payload: 'online'
    2018-7-29 02:09:14 INFO MQTT publish, topic: 'homeassistant/sensor/0x00158d000252b7a5/click/config', payload: '{"icon":"mdi:toggle-switch","value_template":"{{ value_json.click }}","json_attributes":["battery","voltage","action","duration"],"state_topic":"zigbee2mqtt/pulsador_xiaomi_test","availability_topic":"zigbee2mqtt/bridge/state","name":"pulsador_xiaomi_test"}'
    2018-7-29 02:09:14 INFO MQTT publish, topic: 'homeassistant/light/0x000b57fffedc1058/light/config', payload: '{"brightness":true,"platform":"mqtt_json","command_topic":"zigbee2mqtt/kitchen_bulb/set","state_topic":"zigbee2mqtt/kitchen_bulb","availability_topic":"zigbee2mqtt/bridge/state","name":"kitchen_bulb"}'
    2018-7-29 02:09:14 INFO MQTT publish, topic: 'homeassistant/light/0x90fd9ffffe4bf6fd/light/config', payload: '{"brightness":true,"color_temp":true,"platform":"mqtt_json","command_topic":"zigbee2mqtt/tradfri.bulb-corridor/set","state_topic":"zigbee2mqtt/tradfri.bulb-corridor","availability_topic":"zigbee2mqtt/bridge/state","name":"tradfri.bulb-corridor"}'
    spinlock: false []
    spinlock: true []
    2018-7-29 02:09:21 INFO Device incoming...
    **2018-7-29 02:09:21 INFO MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"device incoming"}'**
**    2018-7-29 02:09:26 INFO Device incoming...**
    2018-7-29 02:09:26 INFO MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"device incoming"}'
    2018-7-29 02:10:54 INFO Zigbee publish to '0x000b57fffedc1058', genOnOff - on - {} - null
    2018-7-29 02:10:54 INFO MQTT publish, topic: 'zigbee2mqtt/kitchen_bulb', payload: '{"state":"ON"}'
    2018-7-29 02:10:55 INFO MQTT publish, topic: 'zigbee2mqtt/kitchen_bulb', payload: '{"state":"ON"}'
    2018-7-29 02:10:57 INFO Zigbee publish to '0x000b57fffedc1058', genOnOff - off - {} - null
    2018-7-29 02:10:58 INFO MQTT publish, topic: 'zigbee2mqtt/kitchen_bulb', payload: '{"state":"OFF"}'
    2018-7-29 02:10:58 INFO MQTT publish, topic: 'zigbee2mqtt/kitchen_bulb', payload: '{"state":"OFF"}'
    2018-7-29 02:10:59 INFO Zigbee publish to '0x000b57fffedc1058', genOnOff - on - {} - null
    2018-7-29 02:10:59 INFO MQTT publish, topic: 'zigbee2mqtt/kitchen_bulb', payload: '{"state":"ON"}'
    2018-7-29 02:11:00 INFO MQTT publish, topic: 'zigbee2mqtt/kitchen_bulb', payload: '{"state":"ON"}'
    2018-7-29 02:11:00 INFO Zigbee publish to '0x000b57fffedc1058', genOnOff - off - {} - null
    2018-7-29 02:11:00 INFO MQTT publish, topic: 'zigbee2mqtt/kitchen_bulb', payload: '{"state":"OFF"}'
    2018-7-29 02:11:01 INFO MQTT publish, topic: 'zigbee2mqtt/kitchen_bulb', payload: '{"state":"OFF"}'
    **2018-7-29 02:11:38 WARN Cannot handle MQTT message with topic 'zigbee2mqtt/tradfri.bulb-corridor/set' and message '{"state": "ON"}'**
    2018-7-29 02:11:47 WARN Cannot handle MQTT message with topic 'zigbee2mqtt/tradfri.bulb-corridor/set' and message '{"state": "ON"}'
    2018-7-29 02:11:50 INFO Zigbee publish to '0x000b57fffedc1058', genOnOff - on - {} - null
    2018-7-29 02:11:50 INFO MQTT publish, topic: 'zigbee2mqtt/kitchen_bulb', payload: '{"state":"ON"}'
    2018-7-29 02:11:51 INFO MQTT publish, topic: 'zigbee2mqtt/kitchen_bulb', payload: '{"state":"ON"}'
    2018-7-29 02:11:52 INFO Zigbee publish to '0x000b57fffedc1058', genOnOff - off - {} - null
    2018-7-29 02:11:52 INFO MQTT publish, topic: 'zigbee2mqtt/kitchen_bulb', payload: '{"state":"OFF"}'
    2018-7-29 02:11:52 INFO MQTT publish, topic: 'zigbee2mqtt/kitchen_bulb', payload: '{"state":"OFF"}'
    spinlock: false []
    device already in network
    2018-7-29 02:12:25 WARN Cannot handle MQTT message with topic 'zigbee2mqtt/tradfri.bulb-corridor/set' and message '{"state": "ON"}'
    2018-7-29 02:12:31 WARN Cannot handle MQTT message with topic 'zigbee2mqtt/tradfri.bulb-corridor/set' and message '{"state": "ON"}'
    2018-7-29 02:13:17 WARN Cannot handle MQTT message with topic 'zigbee2mqtt/tradfri.bulb-corridor/set' and message '{"state": "ON"}'
    2018-7-29 02:13:44 INFO Zigbee publish to '0x000b57fffedc1058', genOnOff - on - {} - null
    2018-7-29 02:13:44 INFO MQTT publish, topic: 'zigbee2mqtt/kitchen_bulb', payload: '{"state":"ON"}'
    2018-7-29 02:13:45 INFO MQTT publish, topic: 'zigbee2mqtt/kitchen_bulb', payload: '{"state":"ON"}'
    2018-7-29 02:13:47 INFO Zigbee publish to '0x000b57fffedc1058', genOnOff - off - {} - null
    2018-7-29 02:13:47 INFO MQTT publish, topic: 'zigbee2mqtt/kitchen_bulb', payload: '{"state":"OFF"}'
    2018-7-29 02:13:48 INFO MQTT publish, topic: 'zigbee2mqtt/kitchen_bulb', payload: '{"state":"OFF"}'
    2018-7-29 02:16:37 INFO MQTT publish, topic: 'zigbee2mqtt/kitchen_bulb', payload: '{"state":"OFF"}'

Does anybody have any idea what may be going on with the PIR detector and the second IKEA bulb? The fact that I managed to pair and command the first IKEA bulb almost effortlessly, and now the second bulb is not propperly working is a bit weird.

  1. I see these messages poping up every now and then

    2018-7-29 10:56:34 INFO MQTT publish, topic: ā€˜zigbee2mqtt/kitchen_bulbā€™, payload: ā€˜{ā€œstateā€:ā€œOFFā€}ā€™
    2018-7-29 10:56:48 INFO Device incomingā€¦
    2018-7-29 10:56:48 INFO MQTT publish, topic: ā€˜zigbee2mqtt/bridge/logā€™, payload: ā€˜{ā€œtypeā€:ā€œpairingā€,ā€œmessageā€:ā€œdevice incomingā€}ā€™
    2018-7-29 10:59:35 INFO MQTT publish, topic: ā€˜zigbee2mqtt/pulsador_xiaomi_testā€™, payload: ā€˜{ā€œclickā€:ā€œsingleā€}ā€™

    but I donā€™t really know what they mean. Any ideas?

Thanks in advance everyone,

I can pick up the battery level through the gateway, are you saying it doesnā€™t come through for Zigbee2mqtt?

    kitchen_window_battery:
      value_template: '{{ states.binary_sensor.door_window_sensor_158d0001a4e17b.attributes.battery_level }}'

Just ordered my parts from AliExpress, and definitely looking forward to removing the Hub.
Thanks @Koenkk and team!!

Yeah so the switches show the battery level but the door sensors (binary sensors) and also the motion sensor (just added this weekend) dont show hte battery levels within HA.

They do present over MQTT just not in HA:

Received message on zigbee2mqtt/xds1bedroom: b'{"battery":"100.00","voltage":3035,"contact":true}'

Door and Motion:
1

Sensors:
2

This will display a seperate sensor for the battery within HA for the Sensor:

   - platform: template
     sensors:
       xiaomi_rb1_battery_sensor:
         friendly_name: 'Xiaomi Round Button 1 - Battery'
         value_template: '{{ states.sensor.xrb1bedroom.attributes.battery }}'
         unit_of_measurement: '%' 

But the same wont work for the binary sensors:

   - platform: template
     sensors:
       xiaomi_ds1_battery_sensor:
         friendly_name: 'Xiaomi Door Sensor 1 - Battery'
         value_template: '{{ states.binary_sensor.xds1bedroom.attributes.battery }}'
         unit_of_measurement: '%'

Yes, I am seeing the same.

I have a Xioami human presence and illuminance sensor (giving a HA binary sensor and a HA sensor) and a Xiaomi leak detection sensor (giving a HA binary sensor).

Both devices publish battery level and voltage to MQTT (although in an inconsistent fashion - not usually for a while after a restart), but only the HA sensor shows them.