Active BLE connections within Home Assistant?

Posted on
  • I've just made some tests with BTHome and Home Assistant as covered by excellent videos from @Gordon:


    , Video2

    BTHome uses BLE advertising to send sensor data to Home Assistant (uplink). Now I would like to play with "actuators" which needs downlink. I was thinking of:

    • displaying data on a Pixl.js
    • Toggling relays on Sonoff devices (running Espruino of course)
    • doing PWM outputs
    • ...
      I suspect in this case the best bet is to integrate EspruinoHub into Home Assistant. So far so good, except I have installed a Raspberry PI with Home Assistant OS and I don't have access to the RPi system to install EspruinoHub. (HA OS is running into a Docker and you don't have access outside of it, AFAIK)

    Any ideas out there?

  • Yes, I've been feeling like I really wanted to do something like that as well.

    Home Assistant's use of built-in BLE or ESPHome devices is really neat so that would be best to use if possible though - I have several in my house now to get coverage throughout, and it does support making connections.

    BTHome itself doesn't support connections, and I did ask the author but he's not interested in implementing that at the moment.

    I really wanted to make a Home Assistant 'integration' for Espruino that allowed you to effectively just associate endpoints to function calls, so it'd connect to the UART, write "setX(0)\n" and then disconnect, but I haven't got around to that.

    It looked like it wasn't too hard though - afaik HA uses an API that's basically 'Bleak' so you could take the code from­hon, dump it into an integration and it'd work. The issue was really just making sure it had a nice interface so you could add/configure devices

  • Thank you for your detailed reply.

    I had a look at built-in BLE and I am not sure it is that easy to integrate actuators, especially proprietary BLE profiles, when SIG-defined profiles are not sufficient.
    I will probably have a try with ESPHome BLE relays, it seems that at least connection oriented communication would be possible. Not sure however how to deal with the application level.
    I agree that it would be great at some stage to provide an integration into Home Assistant. As I am playing with it those days, I will try to get my hands on a custom integration and see where it takes me. I will post here progress, if any.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Active BLE connections within Home Assistant?

Posted by Avatar for Jean-Philippe_Rey @Jean-Philippe_Rey