Sensors? I'd like to buy the < $5 ones, not the > $30 ones

(YF) #41

I just received the Xiaomi Gateway and motion sensors, but I don’t plan to turn it on. I am waiting for the CC Debugger from Aliexpress. If it works out with Zigbee2mqtt, I won’t even turn on the Xiaomi gateway. The range with the CC2531 Sniffer isn’t very good either, 30m line of sign. Don’t forget that these are Zigbee stuff, which has a shorter range than Z-Wave. In the case of Zigbee2mqtt, you can use additional CC2531 Sniffers as the routers to extend the range.

(YF) #42


Hello Tom,

I received the CC Debugger on Friday, and I managed to get everything working now. There was a bit of a hiccup with the debugger LED light not turning green, but it turns out that one of the connection to the sniffer wasn’t tight enough. I was also a bit freak out when I can’t easily plug in the USB dongle to the PI since the ZWave ZStick is too big, but after squeezing the two sticks a bit, it all works out.

As for the range, it is better than I was expecting. My house is a typical North American 2400 sq ft 2-storey + basement, rectangle shape. My PI is in the basement at the front. I have no problem placing the motion sensor on the furthest corner of my house, about 2-meter high above the second floor. I can also put it 2 meters out in the backyard of the house. The basement is close to 8 feet high, first floor is 9 feet high; all hardwood floors. All together, I would say that for my case the range is between 12 to 17 meters, may be even a bit more. I don’t need a router/repeater for my house.

The motion sensors are working very well now. I know Xiaomi sensors tend to drop with other hubs, but it didn’t happen for me yet. So zigbee2mqtt is definitely a viable option for Zigbee sensors.

Xiaomi : Which Gateway is recommended?
(SiHui) #43

A short tutorial in the Tutorials and Examples section would be really great :heart_eyes:

(enBoig) #44

I am trying to make my movment sensor work, but I am a newbie to mqtt messages (barely make sonoff devices work…)
A tutorial/example is welcome.

My sensor returns
2018-07-09T20:22:36.516Z - info: MQTT publish, topic: ‘zigbee2mqtt/moviment’, payload: ‘{“illuminance”:4,“occupancy”:true}’

So no battery level, and I don’t know how to make a rule to switch lights after detecting the movement…

(SiHui) #45

(enBoig) #46

Thanks, being a newbie is so frustrating!

(Vincent Regaud) #47

It can be. Take it in your stride, there is a lot to learn.
It can be hard and sometimes it will be.
Follow the tutorials step by step, don’t skip any because you think you know better, you don’t.
Read the docs, again and again. When it doesn’t work, read the docs again.
Check for typos, and again.
Check the log files. they help a lot to find out what is wrong.
When you are stuck search the forum. Someone is likely to have had your problem before and it was solved.
If your can find the solution, post your set-up, items and rules and we’ll help.
Welcome to OH

(enBoig) #48

I managed to make it work without a Switch item or creating a Map file (I thought it was necessary.

For future reference I ended with a String item

String  movement_sensor		"Movement [%s]" <Motion> 	(FF_LaundryRoom)	{mqtt="<[broker:zigbee2mqtt/sensor:state:JSONPATH($.occupancy)]"} 

And a simple rule

rule movement_detected
when Item movement_sensor changed to "true"


(Vincent Regaud) #49

Just a couple of small changes:
Use the item.sendCommand() method instead of the action sendCommand(String, String)
There are several reasons for this:

And you don’t need the ; in the rules DSL EXCEPT after the return statement

The name of the rule needs to be in ""

rule "movement_detected"
    Item movement_sensor changed to "true"

(YF) #50

When I have some times, I will try to write a tutorial. There isn’t much to it though. The two links at zigbee2mqtt and mqtt should take care of everything.

For the Xiaomi sensor, the messages containing the battery comes less often, and could be independent from triggering of the motion sensor. It looks like this:

Jul 13 18:59:53 raspberrypi npm[32362]: 2018-7-13 18:59:53 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0001fa45fd', payload: '{"battery":"100.00","voltage":3025,"illuminance":112,"occupancy":true}'

You can examine the zigbee2mqtt log for debugging purpose.

sudo journalctl -u zigbee2mqtt.service -f

You can also look at the light rules I have for reference: