Iot.Device.YeelightBlue.TYeelightBlue
Contents
- 1 Demo Project Samples
- 2 Supported Services
- 3 Custom Data Types
- 3.1 Yeelight Blue Light Bulb Commands
- 3.2 Yeelight Blue Light Bulb Control Character
- 3.3 Yeelight Blue Light Bulb Delay On Off
- 3.4 Yeelight Blue Light Bulb Generic Query
- 3.5 Yeelight Blue Light Bulb Delay On Off Status Response
- 3.6 Yeelight Blue Light Bulb Status Query Response
- 3.7 Yeelight Blue Light Bulb Color Flow
- 3.8 Yeelight Blue Light Bulb LED Name
- 3.9 Yeelight Blue Light Bulb LED Name Response
- 3.10 Yeelight Blue Light Bulb Custom Characteristics
- 4 Device Details
- 5 Known Issues
- 6 Device Specific Information
- 7 See Also
Go Up to ThingConnect Devices
Yeelight Blue Light Bulb is a Bluetooth LED bulb with over 16 million colours, and bright and warm shades of white light.
Use the TYeelightBlue component to communicate with the Yeelight Blue Light Bulb.
Demo Project Samples
You can find the sample projects for the Yeelight Blue Light Bulb in the following IoT demo directories after installing the component:
- Start | Programs | Embarcadero RAD Studio Berlin | Samples and then navigate to:
- Delphi:
Internet of Things\Object Pascal\Thing Connect\Yeelight Bulb - C++:
Internet of Things\CPP\Thing Connect\Yeelight Bulb
- Delphi:
Supported Services
The Yeelight Blue Light Bulb supports the following Bluetooth LE services and characteristics:
| Service | Characteristic | Property | Event | Read | Subscribe | Write |
|---|---|---|---|---|---|---|
| Device Information | Firmware Revision String | FirmwareRevision
|
OnFirmwareRevisionUpdate
|
|||
| Hardware Revision String | HardwareRevision
|
OnHardwareRevisionUpdate
|
||||
| IEEE 11073-20601 Regulatory Certification Data List | IEEERegulatory
|
OnIEEERegulatoryUpdate
|
||||
| Manufacturer Name String | ManufacturerName
|
OnManufacturerNameUpdate
|
||||
| Model Number String | ModelNumber
|
OnModelNumberUpdate
|
||||
| PnP ID | PnPID
|
OnPnPIDUpdate
|
||||
| Serial Number String | SerialNumber
|
OnSerialNumberUpdate
|
||||
| Software Revision String | SoftwareRevision
|
OnSoftwareRevisionUpdate
|
||||
| System ID | SystemID
|
OnSystemIDUpdate
|
Yeelight Blue Light Bulb component supports the following custom services:
| Service | Property | Event | Read | Subscribe | Write | Description |
|---|---|---|---|---|---|---|
| Custom Service | ControlCharacter
|
OnControlCharacterUpdate
|
Yeelight Blue custom service characteristic 1: ControlCharacter Returns a TControlCharacter. | |||
DelayOnOff
|
OnDelayOnOffUpdate
|
Yeelight Blue custom service characteristic 2: DelayOnOff Returns a TDelayOnOff. | ||||
DelayOnOffStatusQuery
|
OnDelayOnOffStatusQueryUpdate
|
Yeelight Blue custom service characteristic 3: DelayOnOffStatusQuery Returns a TGenericQuery. | ||||
OnDelayOnOffStatusResponseUpdate
|
Yeelight Blue custom service characteristic 4: DelayOnOffStatusResponse Returns a TDelayOnOffStatusResponse. | |||||
StatusQuery
|
OnStatusQueryUpdate
|
Yeelight Blue custom service characteristic 5: StatusQuery Returns a TGenericQuery. | ||||
OnStatusQueryResponseUpdate
|
Yeelight Blue custom service characteristic 6: StatusQueryResponse Returns a TStatusQueryResponse. | |||||
ColorFlow
|
OnColorFlowUpdate
|
Yeelight Blue custom service characteristic 7: ColorFlow Returns a TColorFlow. | ||||
LEDName
|
OnLEDNameUpdate
|
Yeelight Blue custom service characteristic 8: LEDName Returns a TLEDName. | ||||
OnLEDNameResponseUpdate
|
Yeelight Blue custom service characteristic 9: LEDNameResponse Returns a TLEDNameResponse. | |||||
YeeLightCustomChar10
|
OnYeeLightCustomChar10Update
|
Yeelight Blue custom service characteristic 10 Returns a TYeeLightBlueCustomChar. | ||||
OnYeeLightCustomChar11Update
|
Yeelight Blue custom service characteristic 11 Returns a TYeeLightBlueCustomChar. | |||||
EffectSetting
|
OnEffectSettingUpdate
|
Yeelight Blue custom service characteristic 12: EffectSetting Returns a TGenericQuery. | ||||
YeeLightCustomChar13
|
OnYeeLightCustomChar13Update
|
Yeelight Blue custom service characteristic 13 Returns a TYeeLightBlueCustomChar. | ||||
YeeLightCustomChar14
|
OnYeeLightCustomChar14Update
|
Yeelight Blue custom service characteristic 14 Returns a TYeeLightBlueCustomChar. | ||||
YeeLightCustomChar15
|
OnYeeLightCustomChar15Update
|
Yeelight Blue custom service characteristic 15 Returns a TYeeLightBlueCustomChar. | ||||
YeeLightCustomChar16
|
OnYeeLightCustomChar16Update
|
Yeelight Blue custom service characteristic 16 Returns a TYeeLightBlueCustomChar. |
Custom Data Types
The Yeelight Blue Light Bulb defines its custom data types in the following unit:
- Iot.Device.YeeLightBlueTypes
Yeelight Blue Light Bulb Commands
The TLEDCommand type enumerates the different commands for controlling the available functionalities of the Yeelight bulb. The commands are:
ControlCharacterOn- Turns on the light bulb.ControlCharacterOff- Turns off the light bulb.DelayOnOffStatusQuery- Asks for theDelayOnOffstate.StatusQuery- Asks for the status of the light bulb (color, brightness, color flow).ColorFlowStart- Starts the predefined color flow.ColorFlowStop- Stops the color flow.LEDName- This command is returned with the number of the sequence and the characters of the name at eachLEDNameQuery. For more information, see Defining the Name of the Light Bulb.LEDNameEnd- When setting the name of the light bulb, use this command to indicate the end of the name. It is also returned at eachLEDNameQueryto indicate the end of the returned name. For more information, see Defining the Name of the Light Bulb.LEDNameQuery- Asks for the name of the light bulb. For more information, see Asking for the Name of the Light Bulb.DefaultColor- Sets the current color as the default color when the LED is powered on.Gradual- Sets the color gradual mode. Therefore, when changing the color of the LED, the LED makes a smooth transition from one color to the other.NonGradual- Sets the color non-gradual mode. Therefore, when changing the color of the LED, the LED makes an inmediate transition from one color to the other.
Yeelight Blue Light Bulb Control Character
The TControlCharacter type contains the bit-field of YeeLight control character characteristic of the LED (UUID: FFF1). TControlCharacter is used to set the on/off/color/brightness of the LED.
Create: The constructor has three overloaded methods.- First overloaded method: Initializes an instance of
TControlCharacterwith an array of bytes received from the device.- Parameters:
AValuewith TBytes type.
- Parameters:
- Second overloaded method: Writes the color component values to the device.
- Parameters:
Colorwith TAlphaColor type andIntensitywith Integer type.
- Parameters:
- Third overloaded method: Writes the on/off for the color component of the LED.
- Parameters:
CommandwithTLEDCommandtype. TheCommandparameter only admits theControlCharacterOnandControlCharacterOffcommands.
- Parameters:
- First overloaded method: Initializes an instance of
Value: Raw array of bytes received from the device.ColorValue: Returns a TAlphaColor indicating color control.Brightness: Returns a Int8 indicating brightness control.
Yeelight Blue Light Bulb Delay On Off
The TDelayOnOff type contains the bit-field of YeeLight delay on/off characteristic of the LED (UUID: FFF2). TDelayOnOff is used to set the delay on/off for the LED.
Create: The constructor has two overloaded methods.- First overloaded method: Initializes an instance of
TDelayOnOffwith an array of bytes received from the device.- Parameters:
AValuewith TBytes type.
- Parameters:
- Second overloaded method: Writes the delay on/off to the device.
- Parameters:
TimeandStatuswith Integer type.
- Parameters:
- First overloaded method: Initializes an instance of
Value: Raw array of bytes received from the device.DelayTime: Returns a Int32 with the delay time in minutes.DelayOnOff: Returns a Int8 with the delay on/off status.
Yeelight Blue Light Bulb Generic Query
The TGenericQuery type contains the bit-field of three YeeLight characteristics (UUID: FFF3, UUID: FFF5 and UUID:FFFC). TGenericQuery is used to query the LED and time delay statuses and to set the effect settings.
Create: The constructor has two overloaded methods.- First overloaded method: Initializes an instance of
TGenericQuerywith an array of bytes received from the device.- Parameters:
AValuewith TBytes type.
- Parameters:
- Second overloaded method: As a generic query, its function depends on the owner property. The owner properties can be:
DelayOnOffStatusQuery,StatusQueryandEffectSetting, which are used to query the LED status, to query the time delay status and to set the effect settings, respectively.- Parameters:
CommandwithTLEDCommandtype. TheCommandparameter admits different commands, depending on the owner property:DelayOnOffStatusQuery- Admits theDelayOnOffStatusQuerycommand.StatusQuery- Admits theStatusQuerycommand.EffectSetting- Admits theDefaultColor,GradualandNonGradualcommands.
- Parameters:
- First overloaded method: Initializes an instance of
CommandValue: Returns aTLEDCommandtype with the corresponding command value of the owner property.Value: Raw array of bytes received from the device.
Yeelight Blue Light Bulb Delay On Off Status Response
The TDelayOnOffStatusResponse type contains the bit-field of YeeLight delay on/off status response characteristic (UUID: FFF4). TDelayOnOffStatusResponse is used to notify the status of time delay.
Create: Initializes an instance ofTDelayOnOffStatusResponsewith an array of bytes received from the device.Value: Raw array of bytes received from the device.DelayStatusQueryResponse: Returns a string with the status of the notification.DelayStatusResponseTime: Notifies the minutes of the delay on/off as a Int32.DelayStatusResponseOnOff: Notifies the status of the delay on/off as a Int8.
Yeelight Blue Light Bulb Status Query Response
The TStatusQueryResponse type contains the bit-field of YeeLight status query response characteristic (UUID: FFF6). TStatusQueryResponse is used to notify the status of the LED.
Create: Initializes an instance ofTStatusQueryResponsewith an array of bytes received from the device.Value: Raw array of bytes received from the device.Color: Notifies the color component of the LED as a TAlphaColor.Brightness: Notifies the brightness of the LED as a Int8.ColorFlow: Notifies the color flow of LED as a Int8.Delay: Notifies the delay of LED as a Int8.
Yeelight Blue Light Bulb Color Flow
The TColorFlow type contains the bit-field of YeeLight color flow characteristic (UUID: FFF7). TColorFlow is used to set/start/stop the color flow for the LED.
Create: The constructor has three overloaded methods.- First overloaded method: Initializes an instance of
TColorFlowwith an array of bytes received from the device.- Parameters:
AValuewith TBytes type.
- Parameters:
- Second overloaded method: Writes the color flow values to the device.
- Parameters:
Sequencewith Integer type,AColorwith TAlphaColor type,Intensitywith Integer type, andTimewith Integer type.
- Parameters:
- Third overloaded method: Writes the on/off for the color flow.
- Parameters:
CommandwithTLEDCommandtype. TheCommandparameter only admits theColorFlowStartandColorFlowStopcommands.
- Parameters:
- First overloaded method: Initializes an instance of
Value: Raw array of bytes received from the device.ColorSequence: Returns the color flow sequence for the LED as a Int8.ColorValue: Returns the color for LED.ColorBrightness: Returns a Int8 with the brightness for the LED.ColorTime: Returns the color flow change time in seconds for the LED as a Int8.
Yeelight Blue Light Bulb LED Name
The TLEDName type contains the bit-field of the YeeLight LED name characteristic (UUID: FFF8). TLEDName is used to set/query the name of the LED.
Create: The constructor has three overloaded methods.- First overloaded method: Initializes an instance of
TLEDNamewith an array of bytes received from the device.- Parameters:
AValuewith TBytes type.
- Parameters:
- Second overloaded method: Writes the LED name to the device. See Defining the Name of the Light Bulb.
- Parameters:
Sequencewith Integer type (range values: 0 to 5) andNamewith string type (up to 11 characters).
- Parameters:
- Third overloaded method: It can be used to indicate the completion of the name inserting or to ask for the name of the device. See Defining the Name of the Light Bulb and Asking for the Name of the Light Bulb.
- Parameters:
CommandwithTLEDCommandtype. TheCommandparameter only admits theLEDNameEndandLEDNameQuerycommands.
- Parameters:
- First overloaded method: Initializes an instance of
Value: Raw array of bytes received from the device.QueryType: Returns the query type as aTLEDCommand.QueryTypehas three possible valuesLEDName,LEDNameEndandLEDNameQuery.LEDNameSequence: Returns the LED name sequence number as a Int8 in case the LED name is greater than 11 characters.LEDName: Returns a string with the LED name.
Yeelight Blue Light Bulb LED Name Response
The TLEDNameResponse record contains the bit-field of the YeeLight LED name characteristic (UUID: FFF9).
Create: Initializes an instance ofTLEDNameResponsewith an array of bytes received from the device.Value: Raw array of bytes received from the device.QueryType: Returns the query type as aTLEDCommand.QueryTypehas three possible valuesLEDName,LEDNameEndandLEDNameQuery.LEDNameSequence: Notifies the LED name sequence number as a Int8 in case the LED name is greater than 11 characters.LEDName: Returns a string with the LED name.
Yeelight Blue Light Bulb Custom Characteristics
The TYeeLightBlueCustomChar type contains the bit-field of other YeeLight custom characteristics.
Create: Initializes an instance ofTYeeLightBlueCustomCharwith an array of bytes received from the device.Value: Raw array of bytes received from the device.
Device Details
- Device:
Yeelight Blue II - Model:
BUL22BL0101 - Firmware:
1.0
Known Issues
- Yeelight Blue Light Bulb device cannot be paired to a Windows machine. If the target platform of your application is 32-bit Windows or 64-bit Windows, it cannot be paired to the Yeelight Blue Light Bulb.
Device Specific Information
Defining the Name of the Light Bulb
To set the name of the light bulb use the LEDName property and at least two commands:
- The first one to specify the characters of the light bulb name.
- The
LEDNameEndcommand to specify the end of the name.
This light bulb allows you to use large names by setting the name in different sequences of characters. To this end, you can use up to 6 sequenes of maximum 11 characters. Each sequence of characters is composed by an integer that defines the number of the sequence and a string that defines the characters of the name (see the second Create overloaded method of the TLEDName property). The following code snippet sets the name of the light bulb with 4 sequences of characters.
Delphi:
YeelightBlue1.LEDName := TLEDName.Create(0, 'MyPretty');
YeelightBlue1.LEDName := TLEDName.Create(1, 'AndColorful');
YeelightBlue1.LEDName := TLEDName.Create(2, 'LightBulb');
YeelightBlue1.LEDName := TLEDName.Create(TLEDCommand.LEDNameEnd);
C++:
YeelightBlue1->LEDName = TLEDName(0, "MyPretty");
YeelightBlue1->LEDName = TLEDName(1, "AndColorful");
YeelightBlue1->LEDName = TLEDName(2, "LightBulb");
YeelightBlue1->LEDName = TLEDName(TLEDCommand::LEDNameEnd);
Asking for the Name of the Light Bulb
To ask for the name of the light bulb use the following instruction:
Delphi:
YeelightBlue1.LEDName := TLEDName.Create(TLEDCommand.LEDNameQuery);
C++:
YeelightBlue1->LEDName = TLEDName(TLEDCommand::LEDNameQuery);
Using the Color Flow Characteristic
To use the color flow characteristic, use the TColorFlow constructor in order to set a specific color flow. Then, use the ColorFlowStart and ColorFlowStop commands to start and stop the color flow.
The following code snippet uses the second constructor of TColorFlow to define a color flow with the following three colors: red, yellow and green. The first color in this flow is the red, which is defined with a 50% of intensity and lasts 1 second. The second color is the yellow, which is defined with 70% of intensity and lasts 3 seconds. Finally, the last color is the green, which is defined with 90% of intensity and lasts 2 seconds.
Delphi:
YeelightBlue1.ColorFlow := TColorFlow.Create(0, TAlphaColorRec.Red, 50, 1);
YeelightBlue1.ColorFlow := TColorFlow.Create(1, TAlphaColorRec.Yellow, 70, 3);
YeelightBlue1.ColorFlow := TColorFlow.Create(2, TAlphaColorRec.Green, 90, 2);
C++:
YeelightBlue1->ColorFlow = TColorFlow(0, TAlphaColorRec::Red, 50, 1);
YeelightBlue1->ColorFlow = TColorFlow(1, TAlphaColorRec::Yellow, 70, 3);
YeelightBlue1->ColorFlow = TColorFlow(2, TAlphaColorRec::Green, 90, 2);
Once the color flow is defined, use the ColorFlowStart and ColorFlowStop commands to respectively start and stop the color flow. See the following code snippets:
Delphi:
YeelightBlue1.ColorFlow := TColorFlow.Create(TLEDCommand.ColorFlowStart);
// ...
YeelightBlue1.ColorFlow := TColorFlow.Create(TLEDCommand.ColorFlowStop);
C++:
YeelightBlue1->ColorFlow = TColorFlow(TLEDCommand::ColorFlowStart);
// ...
YeelightBlue1->ColorFlow = TColorFlow(TLEDCommand::ColorFlowStop);