Open jamesshannon opened 23 hours ago
This is my first attempt at using the esphome bluetooth proxy, but I believe I'm doing everything correct. Other integrations seem to be detecting bluetooth devices (for example, ibeacon popped up as an integration, and etekcity successfully sees the various MAC addresses).
However, I continue to get the "no adapters found" error from etekcity integration.
I note in the stack trace that bleak is called by this integration directly (as opposed to via a HA API). I suspect that the HA Bluetooth API, which also appears to use Bleak, maybe does some extra abstraction to support proxies?
Maybe the etekcity_esf551_ble
package should be using the HA APIs instead? Which brings up an interesting point because, AFAIK, HA wants integrations to be a thin layer on top of a "generic" package (which is exactly what etekcity_fitness_scale_ble
+ etekcity_esf551_ble
is). However, requiring the use of HA's implementation of Bleak would make the underlying package non-generic.
Hi @jamesshannon,
I'm not really familiar with the bluetooth proxy feature, so I don't know if it would work with my integration. Is it just straightforward plain proxying of BT traffic from devices to ESPHome to Home Assistant over BT as is? I mean, is HA just oblivious to it being a proxy, seeing it just as if it's the actual device? Otherwise I don't think it would work with the integration, as it wasn't designed for that but for direct BT connection to the scale.
Did you try it without the proxy?
If you sniff and capture the relevant BT traffic between the scale and the VeSync app on your phone, then I can give it a look and see if the protocol your model uses is similar to the one used by the ESF-551. If it is then we can rule that out and if not then I can try to see if and how I can maybe add support for it too.
Regarding the HA APIs - I don't really like that solution because just like you said it would make the underlying package non-generic and I don't want it to be tied to HA specifically. It's just a client for communicating and working with the scale. This integration uses it for HA, but the way I see it there's no reason for it to not be used for other platforms or projects or whatever anyone might want to use it for.
Hi.
the way I see it there's no reason for it to not be used for other platforms or projects or whatever anyone might want to use it for.
Yeah. It totally appreciate that perspective. That's the way I'd do it, and I believe it's a HA requirement for integrations (though wouldn't apply to yours as it's via HACS).
Which is why the need to use their bleak BT wrapper is so interesting. Because if you use it, then you're not making a generic package. (I say need because I assume at this point that it's required, and the source of the problem.)
Though I guess you could create etekcity_esf551_ble
to do dependency injection? (Ie, when you instantiate the client you first get the HA BT wrapper and then pass that in instantiation; if it's not passed then the connection is established normally.
As for the other questions -- my HA instance is virtualized on a NAS, which doesn't have onboard BT. I could plug in a bluetooth dongle to the single USB port (after getting a hub), but the server is in the basement. The bluetooth proxy is just a proxy via ESPHome. I think that at most layers, HA is oblivious, though I'm sure there is some code at the lower levels that specifically interacts with ESPHome proxies -- proxy support is built-in to HA and I assume it presents most of the BT API stack with a combined view of BT traffic. THat's probably some of the reasoning for the wrapper.
Considering the error, I'm don't think decoding the scale traffic adds anything at this point. I need to solve the error first. I'll try tweaking with the code and see if it suddenly works... or at least gets beyond the error.
Hi,
I have the EFS-A591S-KUS scale which I assumed would work with this integration. It is bluetooth + Wifi (ie, scale -> cloud -> cloud account - app) and works with ve sync app.
Your integration successfully created the device* but both sensors are permanently "Unknown".
I thought that this might just be a matter of sniffing the BLE traffic and figuring out in which format the data is being sent and doing a PR, but now that I'm looking at the logs, I see
No Bluetooth adapters found
, so maybe I'm actually doing something wrong with the bluetooth proxy setup?* I'm using an esp32 bluetooth proxy and the initial setup flow showed all possible BLE MAC addresses. When I initially set up with the incorrect device I got "Unknown error occurred", so I assumed that this was due to trying to read attributes from a device that didn't support them. Then "turned the scale on" and chose the correct MAC address and it worked. However, further testing shows that the "Unknown error occurred" was due to selecting "Calculate body composition metrics" and occurred even with the Etekcity scale, and that I'm able to set a scale device with any BLE device.
48:E7:29:33:21:BE
.