All Projects → Marcocanc → mi-lamp-re

Marcocanc / mi-lamp-re

Licence: MIT license
💡 Reverse Engineering Notes for the Yeelight Bedside Lamp (BLE)

Projects that are alternatives of or similar to mi-lamp-re

ble2mqtt
Bluetooth to MQTT bridge, add your bluetooth-capable (including controllable) devices to your smart home
Stars: ✭ 46 (+31.43%)
Mutual labels:  bluetooth, ble, xiaomi
esphome-components
ESPHome components
Stars: ✭ 62 (+77.14%)
Mutual labels:  yeelight, ble, xiaomi
ioBroker.ble
Monitor Bluetooth Low Energy beacons
Stars: ✭ 39 (+11.43%)
Mutual labels:  bluetooth, ble
spherov2.py
Unofficial Python API for all Sphero toys
Stars: ✭ 36 (+2.86%)
Mutual labels:  bluetooth, ble
Gesture-Detecting-Macro-Keyboard
Glorified Bluetooth macro keyboard with machine learning (TensorFlow Lite for Microcontrollers) running on an ESP32.
Stars: ✭ 68 (+94.29%)
Mutual labels:  bluetooth, ble
coBlue
Use Bluetooth Low Energy for remote commands, file transfer, Based on bluez Bluetooth protocol stack (BLE Terminal)
Stars: ✭ 41 (+17.14%)
Mutual labels:  bluetooth, ble
app-xyo-nodejs
XYO Archivist/Diviner CLI
Stars: ✭ 41 (+17.14%)
Mutual labels:  bluetooth, ble
yeelight-cli
a low level, cross-platform command line client for Yeelight
Stars: ✭ 43 (+22.86%)
Mutual labels:  yeelight, xiaomi
sblendid
A JavaScript Bluetooth Low Energy (BLE) Library
Stars: ✭ 60 (+71.43%)
Mutual labels:  bluetooth, ble
ESP32BleAdvertise
Simple library for BLE advertise using ESP32 in Arduino
Stars: ✭ 39 (+11.43%)
Mutual labels:  bluetooth, ble
ChromeBluetooth
Demo of a "Stress Display" using Chrome Bluetooth. Reads Heart-rate data, and displays "stress" colors to a smart bulb. (Uses a SBT5007 smart bulb)
Stars: ✭ 14 (-60%)
Mutual labels:  bluetooth, ble
ble
Bluetooth Low Energy for Linux / macOS
Stars: ✭ 264 (+654.29%)
Mutual labels:  bluetooth, ble
contact-tracer
A prototype contact tracer app for COVID-19 pandemic response
Stars: ✭ 50 (+42.86%)
Mutual labels:  bluetooth, ble
ble2mqtt
A BLE to MQTT bridge
Stars: ✭ 60 (+71.43%)
Mutual labels:  bluetooth, ble
hass-miio-yeelink
Xiaomi Miio Yeelink/Yeelight devices for Home Assistant
Stars: ✭ 140 (+300%)
Mutual labels:  yeelight, xiaomi
ganglion-ble
Web Bluetooth client for the Ganglion brain-computer interface by OpenBCI
Stars: ✭ 27 (-22.86%)
Mutual labels:  bluetooth, ble
SmartSpin2k
Transform your spin bike into a Smart Trainer!
Stars: ✭ 88 (+151.43%)
Mutual labels:  bluetooth, ble
RejsaRubberTrac
RejsaRubberTrac - A wireless thermal camera for monitoring tire temperatures
Stars: ✭ 77 (+120%)
Mutual labels:  bluetooth, ble
BTLinker
🔥空祖家的蓝牙连接封装库,适用于智能硬件蓝牙通讯
Stars: ✭ 64 (+82.86%)
Mutual labels:  bluetooth, ble
Gormsson
Harald "Bluetooth" Gormsson was a king of Denmark and Norway.
Stars: ✭ 25 (-28.57%)
Mutual labels:  bluetooth, ble

Yeelight Bedside Lamp RE Notes

This repo is outdated and no longer maintained. Most of the things I've learned about the protocol have flown into homebridge-yeelight

NOTE: Code snippets are in Swift since I'm reversing the iOS App

Endpoints

Service UUID: 8E2F0CBD-1A66-4B53-ACE6-B494E25F87BD

Characteristics UUID: AA7D3F34-2D4F-41E0-807F-52FBF8CF7443

Command Formatting

So far it seems like the hex command length is always 18 Bytes. We need to pad out the string with 0.

func formatCommandString(string: NSString, length: Int = 36) -> NSString {
    return string.stringByReplacingOccurrencesOfString(" ", withString: "")
            .stringByPaddingToLength(length, withString: "0", startingAtIndex: 0)
}

Notify

Register for Notify on 8F65073D-9F57-4AAA-AFEA-397D19D5BBEB

Notify types:

When receiving a notification, the first bytes define what is being received

  • 4363.. Device Status
    • 01 Unauthorized/Not paired
    • 02 Authorized/Paired
    • 04 Authorized device (UDID)
    • 07 Lamp disconnect imminent

Pairing with the Device

To Pair with the device,send the 4367 command with a client uuid. Example: 43677207d94ecb9e4ec5be6eafa46ed1c07c

The Lamp will notify with 43 63 01 to signal that it is in pairing mode.

Press the Scene Button on your Lamp to pair.

The Lamp will notify with 43 63 02 to confirm successful pairing

If the Lamp was previously paired with the device, it will notify 43 63 04

Turn On/Off

The On/Off state can be switched with the 4340.. command. 434001 will turn it on, 434002 will turn it off

Change Color with RGB & Brightness

func changeColorString(red: Int, green: Int, blue: Int, brightness: Int = 0) -> NSString {
    //not sure what the 4th param does yet, also setting brightness to 0 will have no effect
    return NSString(format: "4341 %02X %02X %02X %02X %02X", red, green, blue, 0, brightness)
}

Formatted Example: 4341FF00D700000000000000000000000000

Change Temperature and Brightness

Temperature can range from 1700 to 6500

func changeTempBrightnessString(temperature: Int, brightness: Int = 0) -> NSString {
    return NSString(format: "4343 %04X %02lX", temperature, brightness)
}

Formatted Example: 434313886400000000000000000000000000

More Commands

  • Disconnect: 4368
  • Read color flow: 434c %02lx
  • Delete color flow: 4373 %02lx
  • Read lamp name: 4352
  • Get statistics Data: 438c
  • Set delay to off: 437f01%02x Will add more soon...
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].