Beginner help with ESPHome / Bluetooth proxy

I’ve never done anything with an ESP chip/device, and looking for some -probably exceptionally newbee advice-. With the 2022.9 release I bought a ESP device → M5Stack Atom Lite

I today plugged it into my laptop and followed the instructions on ESPHome Bluetooth Proxy(i.e. I used the webbased installer). After it did it’s work it switched me to HA and it seemed to go very smoothly. I did of course not yet have ESPHome installed on HA (because I just started to click on the installer without thinking ahead!). So I actually did that after the Bluetooth proxy was already added.
So I did: run ESPProxy installer, it switched me to HA, I added it there. only THEN installed ESPHome.

What confuses me now is the following:

When adding the proxy I named it ‘bluetooth proxy’ in HA.

Screenshot 2022-09-09 at 16.51.35

But in ESPHome I see this:

This seems to be the same device twice. I could access the ‘atom-bluetooth-proxy-cf3eec’ when it was plugged into my laptop (and I ran the install with Wifi connect etc on it), but now the device is on Wifi it cannot find it anymore. yet it says the same device as ‘bluetooth-proxy’ is online (I also checked with my router, it’s found and happy in the network). When I try and validate it, I get an error eventually the wifi is not setup correctly. If I delete it, it’s immediately discovered again.

At this point I am a bit lost. Why do I see it twice? Why is one offline and cannot be found on wifi, yet if I remove it, it’s discovered? Sorry if these are really dumb questions. I’ve never used ESPHome before. I mainly want to see if I did it correctly and no idea if it’s actually working as intended.

(My aim is to have it extent for a switchbot, which is out of reach of HA normal Bluetooth adapter, but this proxy is sitting inbetween)

1 Like

Did you use the web based installer from ESP home inside Home Assistant itself? If so I do not understand what you did exactly. If not I would simply reflash form there with a fresh config from the wizard.

On a sidenote: If you intend to use the new BLE proxy from version 2022.9, the sitchbot probably won’t work until at least next month because for now only passive mode is supported, you won’t be able to connect to the device to control it. If you intend to use the ESPHome driver for the switchbot it should work as intended. But it won’t use the BLE proxy functionality.

1 Like

My start was from ESPHome Bluetooth Proxy so not inside HA itself. I didn’t realise it would emediatly try and add it to HA. So once it was done flashing it redirected me and offered to add the proxy. At that point I realised I didn’t actually have ESPHome installed in HA at all yet.

What do you mean the ESP driver? I noticed the Switchbot curtains (2 floors down from where my HA is) here are discovered but response is bad, and a switchbot I got for free with the curtains actually is discovered only if it’s on the same floor as HA server is. Do I understand there is a specific ESP driver for switchbot?

I’m guessing HA sees the device advertise but has no means to connect to it, so it falsely assumes it is not on wifi. You can flash an Esp32 from within HA itself and the wizard will add al the needed bits for HA to connect to it.

As for the driver: You can have software on the ESP32 that understands the switchbot and communicate with it. That software can then expose it as a device to HA (either through the HA api or MQTT. I hadn’t googled very long but did come across this (but it isn’t esphome i saw later):

The ble proxy is a clever, but device agnostic way. It just forwards all bluetooth broadcasts to HA, which then must use the device specific integration to process the messages. But for now, that’s just listening to passive broadcast. The driver wouldn’t be able to connect to interact with it. But they are continuing to add support for active mode too I read, which would open the door to a more fully featured proxy.

2 Likes

That looks very interesting!

I think I managed to fix the proxy. I have just one now and its online. But as you said, it may not do for me what I want at this time. Going to check that specific switchbot solution.

Can you run multiple projects on one ESP? I think I am starting to get it but not sure: basically you use esphome to load projects/code onto the esp?

You can run multiple things if memory and CPU load allow for it, but you need to build it into one firmware together. So you cannot simply mix tasmota or esphome solutions for example. Both are built on Arduino, so it should be possible to add an arduino library to ESPhome. But I have no experience with that, so I do not know if that is hard.

1 Like

@AldoQ

The “Offlne” entity is the name it was originally given when the script created it, and when you renamed it, the device got a new name, which is the Online version.

You can safely delete the Offline one as you have already said you only have the one device and you had never played with ESP’s before.

If a device comes online that is not in Home Assistant, ESPHome will offer to adopt it, so if you do have 2 devices, and the second comes back online, you can adopt it.

1 Like

I’ve checked out some video tutorials yesterday-evening and think I have a better grasp of it now. The route I went was to create a dedicated proxy without needing ESPHome. But I also understood you can just add 1 line of code to make any exisiting ESP a proxy (next to it’s original function).

Ordered a few more ESP’s as I noticed the one I had I really could not load the Switchbot on (may just be me) so ordered a few to play with (and identical to ones in tutoruals to rule that part out).

Help here has also been very insightful. Hoping to get that specific switchbot ESP setup soon.

1 Like

Thanks! I am getting a bit better grip on it (be it very beginner). Also watched and read a few tutorials. And ordered a few additional ESP’s just to play with. As this seems pretty cool :slight_smile:

1 Like

You can make any ESPHome programmed device a proxy by adding the bluetooth_proxy: line to existing ESPHome YAML. This does not work with all ESP32 code though, the device has to be an ESPHome device, or you write the ESPHome code and upload it to the device.
You won’t be able to add one line to a Tasmota device (as an example) for it to work as it is a different firmware.

1 Like

will this proxy work with Xiaomi BLE (MiFlora HHCCJCY01)?
Are there any logs to check?

1 Like

Is it possible to use a remote NUC running Linux as a proxy?

The NUC does not have HA on it but I can install esphome.

Yes,Yes… (10 char minimum for a post, quote not counted).

1 Like

The Bluetooth Proxy is part of ESPHome.
It only works with ESP32 chips.

I would suggest havinga read over the documentation on what devices are supported as this is very well documented on the ESPHome page as well as the current limitations.
:slightly_smiling_face:

You can use other ways to get extensio a on Bluetooth also. Have a look at the Bluetooth integration documentation.

Yeah I guess that makes sense due to the internal adapter not being an ESP device.

After reading the documentation a few times, I think the only way it would work is if there was a way to use a Linux pc as a remote adapter.

You could also see if USB/IP was an option. Not sure how to do it with a NUC, but it could be worth a look.
Bluetooth - Home Assistant (home-assistant.io)
USB/IP Project (sourceforge.net)

@Vio_Rel

Works great with Mi Flora. I use it with that. The only thing it wont grab at the moment is Battery status as this needs an active connection, but active proxy is coming up in the next couple of months hopefully.

I see bluetooth proxy messages in esphome, but I do not see some miflora in ha. how can I check in ha how device is detected (via bt adapter or esphome proxy)?

The way I confirmed my BT Proxy was working was to shutdown HA, remove the Bluetooth dongle from HA, restart it and watch the Mi flora devices still working. Then shutdown again, reinstall the BT Dongle and then reboot it again. Use the shutdown from the Hardware page to shutdown the host.
That said, if the Mi Flora devices are working, you don’t really need to worry. It doesn’t matter which device they are detected by. I did it more out of curiosity.
I run Home Assistant OS on a HA Blue, so bare that in mind.

If you need more help, it might be worth starting a new thread or joining one of the other Bluetooth threads as the OP for this thread has marked it resolved as their issue is addressed :slight_smile:

2 Likes

You could also just deactivate the bluetooth integration in HA. Saves people form desoldering components on their RPI :wink: