Skip to content

Control Yeelight using cheap BLE devices like trackers

License

Notifications You must be signed in to change notification settings

sabaatworld/node-ble-yeelight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This is a simple Node.js script which shows how to control your Yeelights over LAN using cheap BLE tracker devices. In this case, I purchased some BLE tracker devices that have a button on them. Given this program is running (tested on Mac OS 10.15.3), it automatically discovers any BLE devices named "TrackerPA" as soon as they are available and subscribes to the notification topics for its button. This way I can have as many BLE tracker devices connected as I want. Whenever any tracker disconnects, the BLE scanning is reset and remaining trackers are quickly re-connected.

On receiving a button press notification, I cycle through different scenes for the two Yeelight bulbs in this script. Double pressing the button cycles to the previous scene. You can program your own scenes using this example.

References

  1. https://lsong.org/node-yeelight/Yeelight.html
  2. https://www.yeelight.com/download/Yeelight_Inter-Operation_Spec.pdf
  3. https://github.com/noble/noble/wiki/Getting-started
  4. https://github.com/noble/noble/blob/master/examples/pizza/central.js
  5. https://github.com/noble/noble/blob/master/examples/advertisement-discovery.js