Home Assistant / EspHome/ BTHome / Bluetooth Proxies

Posted on
  • I just came across this: https://esphome.github.io/bluetooth-prox­ies/

    I've had Home Assistant set up for a while, and really wanted a nice way of adding Bluetooth devices to it, but there never seemed to be a nice way. Now there is!

    For anyone who is new to this:

    • "Home Assistant" runs on a raspberry Pi, and is a Smart Home Dashboard that supports loads of stuff and glues all your smart home devices together
    • ESPHome is a way of programming ESP32/ESP8266 devices really easily - so you can buy something like a SonOff switch and reprogram it
    • BTHome.io was mentioned before - https://bthome.io/ - but it's effectively just a way of sending sensor data on normal bluetooth. You could do this all with normal Bluetooth already, but BTHome adds a few more 'standard' sensor types
    • Bluetooth proxies jam all this stuff together. You take a few ESP32s and dot them around your house, then they act as gateways from Bluetooth->WiFi->Home assistant

    It seems a few months ago this all got added for Bluetooth sensors, but then in the 2022.10 release they started supporting the ability to go from Home Assistant to bluetooth, for instance to control lights and smart switches.

    I still have to figure out the 'active' bit, but as a basic 'hello world', this is how you would set it up:

    // https://bthome.io/format/
    var toggle = false;
    
    function update() {
      toggle = !toggle;
      var temp = Math.round(E.getTemperature()*100);
      
      NRF.setAdvertising({
        0xFCD2 : [ 0x40,
                  /* BTHome Device Information
                  bit 0: "Encryption flag"
                  bit 1-4: "Reserved for future use"
                  bit 5-7: "BTHome Version" */
                  
                  0x02, // Temperature, 16 bit
                  temp&255,temp>>8,
    
                  0x0F, // Generic boolean value
                  toggle
      ]});
    }
    
    setWatch(update, BTN, {repeat:true,edge:"falling"});
    

    Is anyone interested in a bit more on this? Like me doing some tutorials on setting it up, maybe making a BTHome library?

    Personally, I think this is something I'll be rolling out across the house very soon :)

  • I'm interested! I don’t know how soon I will get to this, but I have always been interested in organizing a Smart Home based on bluetooth, with a minimum of wires.

    I would love to read about the results and experiments: how to deploy it, how stable will it work?

  • Thanks - I'll find out I guess. Not sure I'll get much time to post anything before Christmas

    I had plans to write some code for ESP32s to handle this myself, but it's great to see this has already been done.

    I've got a few wireless sensors dotted around the house (for instance detecting when the freezer door isn't shut properly) and it'll be great to be able to combine them all into one big system.

  • If anyone wants a quick easy to use way to get Bluetooth data into Home Assistant using a Bangle, I added an app here: https://espruino.github.io/BangleApps/?i­d=bthometemp

  • Just added a library for this too: https://www.espruino.com/BTHome

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

Home Assistant / EspHome/ BTHome / Bluetooth Proxies

Posted by Avatar for Gordon @Gordon

Actions