Francisco Dorado
Francisco Dorado Software Architect at sngular.com in Seville. Specialised in backend technologies based in the Java ecosystem. Currently working on Microservices using Spring Framework and AWS Cloud technologies

Control of RST01BL Bluetooth Light Bulb with Home Assistant

Control of RST01BL Bluetooth Light Bulb with Home Assistant

This project provides to be a guide for the control of the RST01BL bluetooth light bulb and its integration with Home Assistant

Prerequisites

We need to follow the next steps before use the bluetooth bulb.

  • Identify the bulb address (XX:XX:XX:XX:XX:XX). You can use NRF Connect o similar.
  • Install the pexpect library, ‘sudo pip install pexpect’.
  • Install gatttool

How to use

Turn On

From python script:

1
> sudo python start-light.py XX:XX:XX:XX:XX:XX

From console:

1
2
3
4
> gatttool -I
> connect XX:XX:XX:XX:XX:XX
> char-write-cmd 0x0043 CC2333
> quit

Turn Off

1
> sudo python stop-light.py XX:XX:XX:XX:XX:XX

From console:

1
2
3
4
> gatttool -I
> connect XX:XX:XX:XX:XX:XX
> char-write-cmd 0x0043 CC2433
> quit

RGB Color

We’ll use 14 hex digits to change the color following the next pattern:

1
56 XX XX XX 00 YY AA
  • The XX XX XX indicates the values of R(Red) G(Green) B(Blue) in HEX. So if we want a red color we should indicate the value FF0000

  • The YY indicates if we want color (F0) or white ligth (0F). If we choose the white ligth value (F0) the XX XX XX value will be ignored.

Examples

  • Turn on
    1
    
    char_write_cmd 0x0043 CC2333
    
  • Turn off
    1
    
    char_write_cmd 0x0043 CC2433
    
  • White light
    1
    
    char_write_cmd 0x0043 56FFFFFF000FAA
    
  • Blue light
    1
    
    char_write_cmd 0x0043 560000FF00F0AA
    

Home assistant integration

1
2
3
4
5
6
switch:
  - platform: command_line
    switches:
       bluetooth_bulb:
         oncmd: "sudo python ~/.homeassistant/start-light.py XX:XX:XX:XX:XX:XX"
         offcmd: "sudo python ~/.homeassistant/stop-light.py XX:XX:XX:XX:XX:XX"   

References

[1] Link to the project in Github

[2] Link to buy here

comments powered by Disqus