Add Bluetooth to Gladys 4

Add Bluetooth so we can add speakers and also Xiaomi Bluetooth temperature sensors.
And of course other things I haven’t thought of.

Ps: I hope there will be a lot of votes :grin:

I would also like Bluetooth for speakers, but especially for presence detection via a NUT (I don’t always have my smartphone with me).

+1 for NUT keychain management

The topic is currently in development but blocked because the available libraries are not 100% compatible with all systems, we will have to be patient a little longer.

https://github.com/GladysAssistant/Gladys/pull/505

Just for info :slight_smile: what is the exact problem?

Exactly, it’s a bit complicated, but in short:

  • with noble
    • on Windows, you need to install a generic driver so that your BLE device is detected by the lib
    • the code is full of holes and errors
    • the notify does not work correctly
  • with @abandonware/noble
    • fewer errors in the code
    • still Windows issues
    • notify not tested
  • with Sblendid
    • integration under Linux is not complete

Most other libraries are specific to Bluez (Linux).

I am therefore waiting for something more stable.

As this is a highly anticipated service and the libs are not ready, could a « hybrid Â» approach be considered? For example, running a Python lib and interfacing it with Gladys’ NodeJS code?

If you know of a Python library or any other that would work, it’s technically feasible.
We’ll have to check with the boss @pierre-gilles

For me, the most promising solution would be to go through noble or @abandonware/noble. Unless I’m mistaken, the Gladys v3 Bluetooth module is based on it, and it still works, right?

Granted, we won’t have Windows support, but does anyone really use Gladys on Windows (outside of development)? And even in development, there are plenty of options: Docker, WSL, right?

Given the demand around this service, I’m sure it would do the job!

Anyway, the services were designed not necessarily to support all platforms.

At least, does the @abandonware/noble service work well on Linux @AlexTrovato? That’s all that matters in my opinion :slight_smile:

I’m being picky, but could someone change the title to change bluetHooth to bluetooth? Because if I pronounce it like that, it sounds like « bloufshoufshh Â» :rofl:

It’s good, it’s fixed :slight_smile:

I can’t tell you if it works well under Linux, as I develop under Windows, in any case, it doesn’t work on WSL 2.
But I will try to switch to Linux to validate the proper functioning of the library.
After all, the service itself is not finished.

Ok, so I’m resuming development on this topic, there’s quite a bit of work to do, I’m relying on the Raspberry Pi’s Bluetooth.

Based on my initial tests, if the Bluetooth is not compatible, it doesn’t prevent Gladys from starting, and a message indicating that Bluetooth is not active is displayed.

We’ll go with that :slight_smile:

For my part, I vote for @abandonware/noble which allowed me to recover the data from my Xiaomi Mijia Bluetooth Low Energy sensors in 10 minutes via a Linux VM!

But it’s true that I didn’t manage to get it working on Windows (without WSL).

@pierre-gilles do you have usage statistics on this (OS distribution)?

Other projects probably succeed on Windows (Home Assistant maybe?), relying on two different bricks may make sense. Noble on Linux and a different application on Windows (Python, other).

Yes! In terms of unique instances since the alpha release, we have had:

These figures only count production instances, not development ones. However, by digging, the instances running on Windows/Mac seem to be more like tests than anything else, these instances date back to beta 1
 :slight_smile:

I am 100% for going with abandonware/noble for now!

Might as well display the module in « disabled Â» mode on platforms other than Linux for the moment!

The 22 instances of @AlexTrovato :smiley:

Exactly :slight_smile: The v4 is designed to have « platform-specific Â» services anyway, the package.json of a service can specify that the service only works on Linux.

Perfect :slight_smile:

So we agree, the idea is to display the module in the list, but to specify that it is not compatible with the platform?

Should we agree, the idea is to display the module in the list, but to specify that it is not compatible with the platform?

Yes! That’s exactly it.