[Custom component] Integration for Triones/HappyLighting based BLE lights

Hi!

Just want to share an integration I am working on. I got a cheap light strip from Amazon and am super annoyed by their malfunctioning IR remote and crappy app. Also I cannot use Home Assistant with it.

After some googling, I found out that the BLE protocol is used for a lot of cheap lights and is well documented here.

Decided to make a custom integration for it: GitHub - sysofwan/ha-triones: Home Assistant integration for BLE based Triones/HappyLighting lights

Appreciate your feedback :smiley:

:construction: This integration is still under active development, and may have bugs or breaking changes in the future. It may not be for you if stability is important.

3 Likes

It doesn’t seem to work with the Happy Lighting Smart LED Flood light. I get the bluetooth address popup when installing the add-on but when I add it, I cannot seem to connect.

Happy to help with any information you need, you might just need to point me in the direction to get it.

Were you able to finish setup? Is there any error/warning logs? Check in Configuration → Logs.

You can also add the following to configuration.yml to enable debug logs, which will be helpful:

logger:
  default: warn
  logs:
    custom_components.triones: debug

It doesn’t complete the setup.

I get:

This error originated from a custom integration.

Logger: custom_components.triones
Source: custom_components/triones/triones.py:86
Integration: Triones (documentation, issues)
First occurred: 15:13:43 (1 occurrences)
Last logged: 15:13:43

Error getting status: Device with address 93:02:00:00:03:29 was not found.

I have manually typed the BT address using a BLE scanner on my phone.

Are you saying the BT address was not in the logs initially or you have to enter the BT address during setup (it was not auto discovered)?

I have seen some issues connecting if there is an existing connection to the lights, for example if you are using the app or connected to the lights on a BLE scanner.

I had to enter the BT address manually during setup.

I didn’t have the app open my phone and but the BT scanner was running to find the address (it had a Connect button on it which I didn’t click). I’ll try close the app and then try connect. Will let you know.

If it was not auto discovered (the name needs to start with “Triones-” in BLE app), it is also possible that the light is too far from your Home Assistant.

The above is what is showing in my bluetooth scanner. I closed the app and didn’t have the HappyLighting app open. The light is also right next to my raspberry pi.

Below is the modal dialog I get

Screenshot_1

It looks like the light doesn’t start with Triones- but with Triones. I wonder if that is the reason why.

As mentioned before, I am happy to help in anyway if you need any more diagnostics.

I made an update to the auto discovery to consider names starting with “Triones:”. You can try pulling the changes and see if it works.

No joy. I think I have the update as I see a field for the Name which wasn’t there before.

Let me see if I can find a way to checking which devices my pi sees.

I added a debug log to print all devices discovered by your pi. You need to enable debug logs as above. Hope that helps.

I get the same problem as @mehtadone where it detects the light but when I submit that light I get the same “Unable to connect to Triones”. I also tried skipping that and just plugging in the bluetooth MAC manually and get the same thing.

I didn’t connect their spyware app at all, so this is from unboxing to HA.

image
image

Here are my logs.

2021-11-21 16:17:40 DEBUG (MainThread) [custom_components.triones] Discovered devices: [{'address': 'FF:FF:38:5B:40:65', 'name': 'Triones-FFFF385B4065'}, {'address': '50:32:37:8E:C0:9E', 'name': '50-32-37-8E-C0-9E'}, {'address': '7D:6E:88:67:D6:AC', 'name': '7D-6E-88-67-D6-AC'}, {'address': '13:76:96:07:E7:91', 'name': '13-76-96-07-E7-91'}, {'address': '4D:1D:50:98:F2:0D', 'name': '4D-1D-50-98-F2-0D'}, {'address': '02:C4:7F:51:2A:12', 'name': '02-C4-7F-51-2A-12'}, {'address': '5F:7C:40:A7:72:4A', 'name': '5F-7C-40-A7-72-4A'}, {'address': '79:D1:87:7F:9D:FD', 'name': '79-D1-87-7F-9D-FD'}, {'address': '5A:A6:8A:38:BF:20', 'name': '5A-A6-8A-38-BF-20'}, {'address': '49:42:DB:44:28:CD', 'name': '49-42-DB-44-28-CD'}, {'address': '30:EC:0C:04:EB:B2', 'name': '30-EC-0C-04-EB-B2'}, {'address': '74:E2:1F:75:69:E8', 'name': '74-E2-1F-75-69-E8'}, {'address': '61:2B:E7:F0:29:66', 'name': '61-2B-E7-F0-29-66'}]
2021-11-21 16:17:52 ERROR (MainThread) [custom_components.triones] Error getting status: Characteristic with UUID 0000ffd4-0000-1000-8000-00805f9b34fb could not be found!
2021-11-21 16:17:52 DEBUG (MainThread) [custom_components.triones] Traceback (most recent call last):
  File "/config/custom_components/triones/triones.py", line 73, in update
    await self._device.start_notify(R_CHARACTERISTIC_UUID, create_status_callback(future))
  File "/usr/local/lib/python3.9/site-packages/bleak/backends/bluezdbus/client.py", line 915, in start_notify
    raise BleakError(
bleak.exc.BleakError: Characteristic with UUID 0000ffd4-0000-1000-8000-00805f9b34fb could not be found!

2021-11-21 16:17:52 DEBUG (MainThread) [custom_components.triones]  cc 23 33

Thanks @CO_4X4. Please follow the GitHub issue you filed for updates on this.

Thank you so much for doing this. I have it working with two of these units:

I can hardly wait until I can invoke the built-in modes.

I just upgraded(?) to core-2021.12.0 and I now get the following error:

Logger: homeassistant.setup
Source: setup.py:291
First occurred: 4:25:33 PM (2 occurrences)
Last logged: 4:25:33 PM

Unable to prepare setup for platform triones.light: Platform not found (cannot import name ‘match_max_scale’ from ‘homeassistant.util.color’ (/usr/src/homeassistant/homeassistant/util/color.py)).

Thanks for the report, will look into this. Haven’t upgraded myself.

Fixed with latest version. This component now requires minimum HA version 2021.12.0 with the latest commit.

Thank you very much. That seems to have fixed it.

Hi, unfortunately HA gives “Config flow could not be loaded: undefined” error whenever I try to add the integration. Tried installing both manually and via HACS, is there anything else I should have installed in order for this to work?