[WIP] Adapter for Bluetooth "HappyLighting" / "Triones" bulbs

Hi all,

I’m going to get some of these cheapo Bluetooth bulbs and try and get them working with the WebThings Gateway: https://fr.aliexpress.com/item/4000154953584.html

The bulbs should arrive by 17th December and I want to get them working with the Gateway before I go away for two weeks on the 21st. I’ve not written an adapter before so I’ve got my work cut out to do it in this time! I’ll start working on the adapter before I get the bulbs but obviously won’t be able to test until I get them. If anyone has any helpful tips they will be much appreciated!

The Bluetooth bulbs are controlled by an app called “HappyLighting”. The same company makes the app for the Wifi bulbs which I’m not interested in, but maybe some elements of the control are similar for those of you that are. https://play.google.com/store/apps/developer?id=tek-q

Edit: And the iOS app (https://apps.apple.com/us/app/happylighting-life-with-smart/id1145694075) seems like it links to the manufacturer: https://www.qh-tek.com/en
So I will contact them and hopefully get some info on how to control them!

The same company make other Bluetooth bulb control apps called “Triones” and “Filight” and all three apps look the same. After looking Github I found someone who had reverse engineered the control for HappyLighting and possibly found that it’s the same as Triones: https://github.com/function61/hautomo/issues/26

And from there another which had reverse-engineered the protocol: https://gitlab.com/madhead/saberlight/blob/master/protocols/Triones/protocol.md

This project may also prove useful: https://github.com/IlyaZaprutski/triones-bluetooth

Edit: Found these methods which may prove useful to verify the above: https://github.com/moosd/ReverseEngineeredMiLightBluetooth

And this is a general guide to reverse engineering a BLE bulb using another bulb as an example: https://learn.adafruit.com/reverse-engineering-a-bluetooth-low-energy-light-bulb/overview. There are (obvious now!) apps which can scan BLE devices and return info about their interface, which will definitely be helpful.

As for writing an adapter, the wiki will obviously be a starting point (is it up to date?): https://github.com/mozilla-iot/wiki/wiki and @t1m1 suggested I start off by looking at the Xiaomi temperature and humidity adapter as an example: https://github.com/tim-hellhake/xiaomi-temperature-humidity-sensor-adapter

I’ll also look at these other adapters for bluetooth devices:




Are there any other adapters for bluetooth devices which could be useful examples?

Cheers :slight_smile: