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


My zigbee xiaomi switches do not automatically turn back on after a power outage. Is there anything specific I need to setup so they retain their last setting when power is restored?
My mqtt config is as follows:

  port: 1883
  discovery: true
  client_id: home-assistant-1
  keepalive: 60
  username: !secret mqtt_username
  password: !secret mqtt_password
    topic: 'hass/status'
    payload: 'online'
    retain: true
    topic: 'hass/status'
    payload: 'offline'
    retain: true



Thanks @ryanbeaton - I have upgraded to 1.2.1 and still the same - the zigbee xiaomi sockets do not automatically switch on after power is restored. What happens is when power power input is lost to the zigbee switch and that switch is turned on, the device/switch goes to “Unavailable” after the availability timeout figure of 15 seconds or so. When power is restored, the zigbee switch is detected as online again, and the switch remains OFF. Here is part of my relevant configuration.yaml for zigbee2mqtt

  availability_timeout: 15
  cache_state: true
  report: true
    friendly_name: '0x00158d0001a1f3d3'
    retain: true


I couldn’t find someone with a similar problem in this thread so here it goes.

I’m using zigbee2mqtt with nodered and home assistant. Everything works as it should. However, in node red i use a state change node to trigger an notification and it triggers even when the state hasn’t changed.

I’ve seen that when this happens mqtt does send an mqtt message with the state of the sensor and homeassistant doesn’t update this because the state is still the same. However, node red does pick up the “state change” and triggers my notification.

Does anybody here have the same problem?


Sounds like you could use this node:


Thank you that would definitely solve the problem. However, why does this happen? The state change node should only pick up state changed events send out by homeassistant.

Does the state change event also trigger when an mqtt message with the same payload is send by zigbee2mqtt?


Would be nice to have something like this as a zigbee device. Does someone know a device like this with zigbee?


Zigbee2mqtt has a forum since yesterday.


Just an update in case anyone has any suggestions. Still having trouble with this motion sensor. When I re-pair it, it will work for a few hours then it gets ‘stuck’ and wont detect motion. It sends an MQTT message about once per minute saying ‘occupancy: true’ etc. As I mentioned before this happens even when placed next to the controller, so I don’t think it is linkstate.


I bought 2 of them about 3 months ago, they worked perfectly. Then I decided to buy 2 more and with one of the last 2 I had the same issues you are having, it would see motion when there was no movement etc… I marked is as DOA and bought a new one which worked perfectly.

Before marking it as DOA did you tried to use a new battery? If so do you only have one motion sensor or more?


I have 3 of them and haven’t seen any of the issues you report… strange.


Thanks - good suggestion to try a new battery (and good to know it probably isn’t just me doing something stupid). I have another one on the way from china (but the model without luminance) so hopefully that will work.


Hey guys, i have a problem with one of my osram blubs. It turns on in the middle of the night. Seems that it looses connection.
In the log i can see that when it reconnects, a message is published and it looks like the default value for the blub is “on”
Any way to prevent this?

zigbee2mqtt:info 3/21/2019, 6:34:36 PM Zigbee publish to device '0x7cb03eaa00ac34e2', genOnOff - on - {} - {"manufSpec":0,"disDefaultRsp":0} - null


Sorry for maybe stupid question. I’ve connected ikea bulb and I see in log and in configuration.yaml that it is connected. But I quite confused what to do next. I can not find how to control it in hass.io. How to show it as an entity?


I think you should watch this video from the hook up. It explains exactly what you’re facing!


Did you manage to find roller blinds that are supported?


Ikea is releasing roller blinds soon that I’m sure will be supported :slight_smile:


look in configuraton (in the left menu) and then integrations. It should auto discover the bulb.


yes, when I open integrations I see mqtt in the top but when I go in it says that there is no devices
maybe it wasn’t connected correctly?


it sometimes can take a little time to appear. iirc there is also a line in the zigbee2mqtt configuration.yaml that will control discovery, but it should be on by default.