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

I changed the scripts

(function(jsonString) {
var data = JSON.parse(jsonString);
var value =;
var output = "NULL";
if (value == true) {
     output = "CLOSED";
} else if (value == false) {
     output = "OPEN";
return output;

Works as expected. Thanks.

I couldnt avoid, commenting on this one.

I use quite a few Xioami, sensors around my house, but not with any of the mentiond gateways, what I use is an Rasbee addon card for RaspberryPi from a German company with the name Dresden Electronics. I use it with Xiaoami Sensors, Philips hue lamps, Ikea Trådfri bulbs, lamps, switches and sensors. And for reliability i have had ONE Xioami sensor fail on me, but that was after it had fallen of the shelf where I had put it (to test), and the cats got hold of a small temperature sensor and used it as an hockey puck, so I guess it really doesnt count :slight_smile:

Annyway the solution is basicly configured like this -
Bulbs and lamps integradet to OH with the hue binding, as the DeconZ software emulates the RestApi of the hue gateway, Sensor values i have integrated using via websocket to NodeRed that reports to MQTT, and with openhab subscribing to the values. Sensor battery values get hold of using the http Binding asking the Rest Api directly every half an hour.

The mqtt solution i found here (i think)

The raspbee solution supports up to 200 devices.

/Ole, not in any way afiliated with Xioami, Ikea or Dresden elektronics…

I blocked the gateway’s MAC address from making outbound connections in my firewall after the initial setup and it works fine without being able to talk to the server.

1 Like

@SteveDowling Yup I read about that too; that would be my second option. I am ordering both the gateway and the CC2531 USB sniffer ( I am going to try the latter first; if it works, I wont’ even need to turn on the Xiaomi gateway.

1 Like

I received my Gateway and sensors yesterday.
If you are using iOS (iPhone/iPad) as your setup device, Be advised that setting the gateway into developer mode is NOT AT ALL obvious. The binding docs were written with Android in in mind and when the docs say to press the version number several times to reveal the hidden menu, in iOS there is no version.

Much googleing finally revealed that I was to tap several times in BLANK SPACE in the lower part of the screen. Then the hidden menu is in Chinese. Here is the link I found

A nice you tube video is at

It works and now I get to write rules to turn on and off lights when a door opens and closes

The gateway does have a China plug, so get an adapter if you are plugging into a non-China receptacle.

I ordered the RF Bridge and sensors. I wonder if the RF Bridge will somehow work with the “Universal Garage Door Remote Keypad” I bought 2 years ago

I’m pretty happy with the gateway itself. It’s really easy to add new devices to it and I use it as a speaker in my home office to alert me when a motion sensor has been triggered. It was minor pain to set up initially but after that it is very convenient and I’ve never had any issues with it. Just press the button on the side of the gateway three times and hold the button on the device for a bit to add new devices.

For me, the fact that it has a Chinese plug on it is actually a bonus because it’s the same plug as AU/NZ but upside down :slight_smile:

Just put a second hub or a third, OpenHab can see every hub in my house. I just add the sensors to the correct hub and they show up in paperui. Also each hub can be used as a night light and siren.

Try… It will NOT work when it uses rolling codes.

No rolling code, but I have no experience with this kind of hardware hacking

I just saw your message now. That Rasbee card looks pretty cool. I love the advertised range of 500m. That would beat pretty much any hub/gateway/usb stick out there. The CC2531 USB sniffer I am ordering only has a range of ~30m. The software stack and initial setup look a bit intimidating however.

Can anyone confirm, through actual usage, that the range is really only 7m? That doesn’t seem very far.

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.



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.


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


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…

Thanks, being a newbie is so frustrating!