<img align="right" src="https://raw.githubusercontent.com/diacode/bsr_bulb/master/web/bsr_bulb.jpg", width="400">
An Elixir library for interacting with a BSR Smart Bulb that is connected via bluetooth. This is an RGB LED Bulb with built-in speaker.
It seems there are others brands that sell this bulb under their own name. Some of them are:
- 1byone
- ...
In order to reverse engineering the Bluetooth protocol of the bulb we used the Bluetooth HCI snoop log from Android, to capture the bluetooth packets between the mobile app and the smart bulb, and Wireshark to analyze the packets. You can read more about this approach here.
## Supported features
- Switch on
- Switch off
- Set color
On Mac OS X, pair your computer with your bulb by using the normal Bluetooth device explorer. Once connected, you should hear a sound coming from the bulb's speaker.
Then you need to find the serial port for your bulb. You can use ls /dev | grep tty
. For the 1byone version the port is /dev/tty.1byoneBulb-SerialPortSe
.
Then open an elixir terminal with iex -S mix
and type:
device = "/dev/tty.1byoneBulb-SerialPortSe"
{:ok, bulb} = BSRBulb.Client.start(device)
BSRBulb.Client.switch_on(bulb)
BSRBulb.Client.set_color(bulb, "#ff0000") # Red
BSRBulb.Client.switch_off(bulb)
This library was based on the Sphero library. While the bulb and Sphero are different devices, both are controlled through Bluetooth using erlang-serial.