Help defining the architecture of an add-on using bluetooth


I’m quite new to Home Assistant and smart home automation in general. Only starting playing with all this a few weeks ago. If I end up asking trivial things please forgive me but any help would be greatly appreciated :upside_down_face:.

I would like to have my Ikea standing desk controlled from HA.

In my phase of research I have found this:

I first thought that esphome-idasen-desk-controller add-on would let me connect to my desk using a simple bluetooth dongle. But I realised later on that it’s probably not going to work this way and that I need a special kind of device (ESP32) in order to use that repo, my dongle won’t be of any use here (?).

I’m not too keen on buying another device to control my desk and would like to control it directly using my bluetooth dongle.

First questions:

  • Is this a bad idea?
  • What would be the advantage of using an ESP32 device if any?

Based on that fact, I started to look into building my own solution that’d just use a bluetooth dongle.

Then I found:

I’ve given a go to that project and was able to connect to my desk and change the height using the CLI (itself connected to the desk using the bluetooth dongle).

What I’d like to do from there would be a new HA add-on that’d bundle a tiny nodejs docker image where I could run a modified version of that CLI in order to make it headless and that I could interact with over maybe some kind of node HTTP API?

But as I’m quite new with how HA ecosystem works, I’m not 100% sure how to plan for a good architecture here.

I’ve read HA add-on doc here and it did answer a few questions I had but not all of them.

For example I was afraid that I would be able to run a docker container with both --net=host and --privileged arguments but looking at the optional configuration options I was reassured (as it’s needed to have access to the bluetooth dongle).

Now, about the architecture:

  • I’m planning on using the custom lovelace card I shared earlier. I’m assuming that it’ll be fine to just set the correct sensors in here
  • I’m not clear what I need exactly between an “add-on” and an “integration”. My guess is an add on to have a NodeJS server running which can then be used by an integration for multiple devices?

I guess it may actually be easier to make a schema for me to explain:

Is there something that really doesn’t add up there? Are there simpler options? Can you think of a better architecture?

As you probably guessed from the picture I’m not 100% comfortable with the integration and add-on concept.

Thanks for any guidance :smiley:.

PS: One thing I forgot to mention. I’m guessing I should make some interface to transform the stream of data (height of the desk) and actions (like go up/down) into some MQTT events. Where would that be done exactly? I’m planning on reading the MQTT doc but haven’t done so just yet.

1 Like

I have just built a custom component for Home Assistant that controls my IDÅSEN desk directly using a Bluetooth dongle instead of an ESPHome device. Maybe that would be useful for you?

Sorry I this just now and it looks like I forgot to update this thread…

But I actually built a lib I’m quite happy with myself, feel free to take a look here: GitHub - maxime1992/linak-2-mqtt