Setting up coffee machine via bluetooth

I’m using a custom integration to add my coffee machine via bluetooth. I’m using a Shelly Plug as a bluetooth gateway.

In HA there is a bleak error saying the Mac address can’t be found. However, when I look at what Mac addresses bluetooth is finding right at the top with the strongest signal is the Mac address I’m trying to connect to. I’ve tried with upper case, lower case and no semi colons in the Mac address but always the same result. Any idea how to troubleshoot this further?

The code from the integration that is throwing the error.

if self._client is None or not self._client.is_connected:
                    self._device = bluetooth.async_ble_device_from_address(
                        self._hass, self.mac, connectable=True
                    )
                    if not self._device:
                        raise BleakError(
                            (
                                f"A device with address {self.mac}"
                                " could not be found."
                            )
                        )

What integration? What coffee machine?

Is your MAC address expressed as colon delimited, or hyphen delimited for each hex value? Any residual spaces you have overlooked in string comparison? How is the value stored?

Variable declaration: Are you comparing like for like?

What does the debug log say? Are you able to step through your code to see the current variable values? What do the return codes from the various layers and subroutines tell you?

Maybe post a little more of your code if you want more hints.

Is the device transmitting at the time you look for it?

It’s this integration GitHub - Arbuzov/home_assistant_delonghi_primadonna: Home assistant integration for the Delonghi coffee machine

The MAC address is colon delimited. What seems odd to me is that HA is seeing the MAC address of the device in the bluetooth proxy list of the shelly yet the below doesn’t return the device

self._device = bluetooth.async_ble_device_from_address(self._hass, self.mac, connectable=True)

For now I went ahead and configured a raspberry pie where I use the same code but not relying on the HA bluetooth implementation. I’m starting to wonder if the bluetooth proxy solution via the shelly integration is throwing a wrench into this.

The debug logs just show the error that a device with the Mac address could not be found. I have not yet stepped through the code live

Possibly, yes: Shelly - Home Assistant

Can you get your hands on a cheap ESP32 device & set it up as a bluetooth proxy to see whether this allows you to connect to your machine?

Enable Debug logging on your integrations (Shelly and DeLonghi) and post the log [correctly formatted please]

Is this related?

@IOT7712 That issue is for a different model but if the firmware works in the same way it could be related. That issue also doesn’t mention using Shelly bluetooth proxy which I believe is where the problem lies

@ShadowFist I set up a raspberry pie and now I just have HA send a trigger to the raspberry over the network and then the raspberry sends the bluetooth request and that works.

I’ll do some experimenting with debug logs and report back

Shellies don’t allow for active (back and forth communication) BT connections. Just skimmed your post but this seems like it would be necessary for your use-case and I’m guessing is your issue. A generic ESP32 setup as a BT Proxy can handle an active connection.

1 Like