Git Product home page Git Product logo

xiaomi-zb2mqtt's Introduction

xiaomi-zb2mqtt

Xiaomi Zigbee to MQTT bridge using zigbee-shepherd.

This little script allows you to use Xiaomi Zigbee sensors and switches without Xiaomi's gateway. It bridges the events sent from the sensors to MQTT. You can integrate the cheap and nice Zigbee sensors and switches with whatever smart home infrastructure you are using.

To run the bridge

  • Install
$ git clone https://github.com/oskarn97/xiaomi-zb2mqtt.git  
$ cd xiaomi-zb2mqtt  
/xiaomi-zb2mqtt$ npm install  
  • Configuration: for the moment you have to edit index.js and set your serial port and mqtt broker.

  • Run it

/xiaomi-zb2mqtt$ node index.js  
  • To see whats happening behind the scenes run it with debug enabled:
/xiaomi-zb2mqtt$ DEBUG=* node index.js  

Supports

  • Buttons - Single, double, triple, quad and "more than five" click. Push and hold long click.
  • Aqara Smart Wireless Wall Switch (both Single and Double Key) with remote click feature (only tested on QBKG03LM).
  • Temperature Hudimity sensor with Temperature, Humidity and Pressure (Aqara definitely works, Classic not tested but most likely also)
  • Xiaomi Smart Home Human Body Sensor (Aqara definitely works, Classic not tested but most likely also)
  • Xiaomi Window Door Sensor (both Aqara and Classic)

Notes

  • You need CC2531 USB stick flashed with the firmware from this repo

Pairing

  • To enable pairing mode, send mqtt message to the topic {base_topic}/cmnd/bridge/pair with the desired pairing mode duration in seconds as message, i.e.:
mosquitto_pub -t xiaomi/cmnd/bridge/pair -m 60
  • Unlike the gateway, the stick does not know the exact characteristics of each Xiaomi device. That is why pairing takes up to 60 seconds to finish. It is important that during this time, the device stays awake. Otherwise, pairing fails. Except the Wireless Wall Switches, you need to tap (not hold!) the reset button of the device every 3-4 seconds to keep it awake while paring until the confirmation appears. If you see the "cannot get Node descriptior" exception in the log, the device went to sleep and you need to try it again. Once successfully paired, the device works perfectly reliable.

Remote commands

  • To send a click command to wall switch just send mqtt message to the topic: {base_topic}/cmnd/bridge/send/{dev_id}/{channel_number} i.e.:
mosquitto_pub -t xiaomi/cmnd/bridge/send/0x0000ffff0000ffff/1 -m 1

xiaomi-zb2mqtt's People

Contributors

oskarn97 avatar andrewlinden avatar juliojs avatar dgomes avatar jpbarraca avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.