Skip to content

Instantly share code, notes, and snippets.

@juliancheal
Created November 17, 2016 23:24
Show Gist options
  • Save juliancheal/d139f8bfd6daceb8dd6b191f9f066f33 to your computer and use it in GitHub Desktop.
Save juliancheal/d139f8bfd6daceb8dd6b191f9f066f33 to your computer and use it in GitHub Desktop.
API Structure of the Yeelight BLE lamp bits and bobs

API

UUID Character Length Permission Description
0xFFF1 Control 18 Read/Write Control the color/light/on/off of LED
0xFFF2 Delay On/Off 8 Read/Write Set delay on/off for LED
0xFFF3 Delay On/Off Status 2 Read/Write Query the status of delay on/off Query
0xFFF4 Delay On/Off Status 10 Notify Notify the status of delay on/off Response
0xFFF5 Status Query 1 Read/Write Query the status of LED
0xFFF6 Status Response 20 Notify Notify the status of LED
0xFFF7 ColorFlow 20 Read/Write Set the color flow for LED
0xFFF8 LED Name 15 Read/Write Set the name of LED
0xFFF9 LED Name Response 15 Notify Notify the name of LED
0xFFFC Effect Setting 2 Read/Write Set the effect of color change

Description

Above is the table explaining the different bytes one needs to send and the length of the packets.

Example

For example to turn the light on, one would send ,,,100,,,,,,,,,,,, which is 18 chars long. To turn it green, 0,255,0,100,,,,,,, is also 18.

Datastructure

I think you're right a map or array of strucs sounds best, as I want a datastructure, that means I can do something like

foo.WriteCharacteristic(YeelightService, ControlCharacteristic, buf) Where:

  • YeelightService is the main uuid needed for the Yeelight BLE (0xFFF0).
  • ControlCharacteristic is 0xFFF1 indacting where changing a control characteristic aka colour change for intance.
  • buf is the payload e.g. 0,255,0,100,,,,,,,

I would want my packet creation method, to look at the datastructure above and know that a ControlCharacteristic needs to be of length 18.

@juliancheal
Copy link
Author

@katzien what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment