Yeelight Blue Light Bulb

From IoT
Jump to: navigation, search

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

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
YesSubscriptionFeature.png
Hardware Revision String HardwareRevision OnHardwareRevisionUpdate
YesSubscriptionFeature.png
IEEE 11073-20601 Regulatory Certification Data List IEEERegulatory OnIEEERegulatoryUpdate
YesSubscriptionFeature.png
Manufacturer Name String ManufacturerName OnManufacturerNameUpdate
YesSubscriptionFeature.png
Model Number String ModelNumber OnModelNumberUpdate
YesSubscriptionFeature.png
PnP ID PnPID OnPnPIDUpdate
YesSubscriptionFeature.png
Serial Number String SerialNumber OnSerialNumberUpdate
YesSubscriptionFeature.png
Software Revision String SoftwareRevision OnSoftwareRevisionUpdate
YesSubscriptionFeature.png
System ID SystemID OnSystemIDUpdate
YesSubscriptionFeature.png

Yeelight Blue Light Bulb component supports the following custom services:

Service Property Event Read Subscribe Write Description
Custom Service ControlCharacter OnControlCharacterUpdate
YesSubscriptionFeature.png
YesSubscriptionFeature.png
Yeelight Blue custom service characteristic 1: ControlCharacter

Returns a TControlCharacter.

DelayOnOff OnDelayOnOffUpdate
YesSubscriptionFeature.png
YesSubscriptionFeature.png
Yeelight Blue custom service characteristic 2: DelayOnOff

Returns a TDelayOnOff.

DelayOnOffStatusQuery OnDelayOnOffStatusQueryUpdate
YesSubscriptionFeature.png
YesSubscriptionFeature.png
Yeelight Blue custom service characteristic 3: DelayOnOffStatusQuery

Returns a TGenericQuery.

OnDelayOnOffStatusResponseUpdate
YesSubscriptionFeature.png
Yeelight Blue custom service characteristic 4: DelayOnOffStatusResponse

Returns a TDelayOnOffStatusResponse.

StatusQuery OnStatusQueryUpdate
YesSubscriptionFeature.png
YesSubscriptionFeature.png
Yeelight Blue custom service characteristic 5: StatusQuery

Returns a TGenericQuery.

OnStatusQueryResponseUpdate
YesSubscriptionFeature.png
Yeelight Blue custom service characteristic 6: StatusQueryResponse

Returns a TStatusQueryResponse.

ColorFlow OnColorFlowUpdate
YesSubscriptionFeature.png
YesSubscriptionFeature.png
Yeelight Blue custom service characteristic 7: ColorFlow

Returns a TColorFlow.

LEDName OnLEDNameUpdate
YesSubscriptionFeature.png
YesSubscriptionFeature.png
Yeelight Blue custom service characteristic 8: LEDName

Returns a TLEDName.

OnLEDNameResponseUpdate
YesSubscriptionFeature.png
Yeelight Blue custom service characteristic 9: LEDNameResponse

Returns a TLEDNameResponse.

YeeLightCustomChar10 OnYeeLightCustomChar10Update
YesSubscriptionFeature.png
YesSubscriptionFeature.png
Yeelight Blue custom service characteristic 10

Returns a TYeeLightBlueCustomChar.

OnYeeLightCustomChar11Update
YesSubscriptionFeature.png
Yeelight Blue custom service characteristic 11

Returns a TYeeLightBlueCustomChar.

EffectSetting OnEffectSettingUpdate
YesSubscriptionFeature.png
YesSubscriptionFeature.png
Yeelight Blue custom service characteristic 12: EffectSetting

Returns a TGenericQuery.

YeeLightCustomChar13 OnYeeLightCustomChar13Update
YesSubscriptionFeature.png
YesSubscriptionFeature.png
Yeelight Blue custom service characteristic 13

Returns a TYeeLightBlueCustomChar.

YeeLightCustomChar14 OnYeeLightCustomChar14Update
YesSubscriptionFeature.png
YesSubscriptionFeature.png
Yeelight Blue custom service characteristic 14

Returns a TYeeLightBlueCustomChar.

YeeLightCustomChar15 OnYeeLightCustomChar15Update
YesSubscriptionFeature.png
YesSubscriptionFeature.png
Yeelight Blue custom service characteristic 15

Returns a TYeeLightBlueCustomChar.

YeeLightCustomChar16 OnYeeLightCustomChar16Update
YesSubscriptionFeature.png
YesSubscriptionFeature.png
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 the DelayOnOff state.
  • 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 each LEDNameQuery. 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 each LEDNameQuery to 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 TControlCharacter with an array of bytes received from the device.
      • Parameters: AValue with TBytes type.
    • Second overloaded method: Writes the color component values to the device.
    • Third overloaded method: Writes the on/off for the color component of the LED.
      • Parameters: Command with TLEDCommand type. The Command parameter only admits the ControlCharacterOn and ControlCharacterOff commands.
  • 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 TDelayOnOff with an array of bytes received from the device.
      • Parameters: AValue with TBytes type.
    • Second overloaded method: Writes the delay on/off to the device.
      • Parameters: Time and Status with Integer type.
  • 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 TGenericQuery with an array of bytes received from the device.
      • Parameters: AValue with TBytes type.
    • Second overloaded method: As a generic query, its function depends on the owner property. The owner properties can be: DelayOnOffStatusQuery, StatusQuery and EffectSetting, which are used to query the LED status, to query the time delay status and to set the effect settings, respectively.
      • Parameters: Command with TLEDCommand type. The Command parameter admits different commands, depending on the owner property:
        1. DelayOnOffStatusQuery - Admits the DelayOnOffStatusQuery command.
        2. StatusQuery - Admits the StatusQuery command.
        3. EffectSetting - Admits the DefaultColor, Gradual and NonGradual commands.
  • CommandValue: Returns a TLEDCommand type 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 of TDelayOnOffStatusResponse with 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 of TStatusQueryResponse with 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 TColorFlow with an array of bytes received from the device.
      • Parameters: AValue with TBytes type.
    • Second overloaded method: Writes the color flow values to the device.
    • Third overloaded method: Writes the on/off for the color flow.
      • Parameters: Command with TLEDCommand type. The Command parameter only admits the ColorFlowStart and ColorFlowStop commands.
  • 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.
  • Value: Raw array of bytes received from the device.
  • QueryType: Returns the query type as a TLEDCommand. QueryType has three possible values LEDName, LEDNameEnd and LEDNameQuery.
  • 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 of TLEDNameResponse with an array of bytes received from the device.
  • Value: Raw array of bytes received from the device.
  • QueryType: Returns the query type as a TLEDCommand. QueryType has three possible values LEDName, LEDNameEnd and LEDNameQuery.
  • 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 of TYeeLightBlueCustomChar with 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:

  1. The first one to specify the characters of the light bulb name.
  2. The LEDNameEnd command 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);

See Also