sopelj / hass-ember-mug-component

Ember Mug Integration for Home Assistant
MIT License
111 stars 4 forks source link

New ember mug does not connect #39

Open csilv opened 9 months ago

csilv commented 9 months ago

Description

I've been using this integration successfully for a while now. Unfortunately, my Ember Mug died, so after looking at the market I got a new one (Ember Mug 2) since this is the (only?) coffee mug that integrates with HA. (so thank you for this integration!)

Unfortunately, I can't seem to get my new mug working, after repeated tries and debugging steps.

What I Did

Starting from a restart with the ember mug not added yet, I see the newly discovered mug. I tap configure, and get to the configuration screen where I change the unit to F, and then Submit. This takes a while, and then eventually reports "Success!". However, the success dialog does not show any new devices found which differs from the expected experience.

At this point, the Ember integration is listed, but it just keeps erroring repeatedly. I've tried putting the device into pairing mode, but that doesn't help. (I don't think pairing mode should be needed since I can confirm with bluetoothctl that the device is actually paired.

Logs / Errors

First, here's some out from bluetoothctl that shows the device as paired:

➜  ~ bluetoothctl devices Paired        
Device F3:BB:7F:08:D1:EF Ember Ceramic Mug
➜  ~ bluetoothctl info f3:bb:7f:08:d1:ef
Device F3:BB:7F:08:D1:EF (random)
        Name: Ember Ceramic Mug
        Alias: Ember Ceramic Mug
        Paired: yes
        Bonded: yes
        Trusted: yes
        Blocked: no
        Connected: no
        LegacyPairing: no
        UUID: Vendor specific           (00001530-1212-efde-1523-785feabcd123)
        UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
        UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
        UUID: Vendor specific           (fc543622-236c-4c94-8fa9-944a3e5353fa)

And here's logging from Home Assistant. I've trimmed the log to just keep relevant lines from Ember.

2023-11-29 08:42:43.133 DEBUG (MainThread) [bleak.backends.bluezdbus.manager] initial properties: {'/org/bluez': {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.AgentManager1': {}, 'org.bluez.ProfileManager1': {}}, '/org/bluez/hci0': {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.Adapter1': {'Address': 'C0:FB:F9:60:3C:76', 'AddressType': 'public', 'Name': 'homeassistant', 'Alias': 'homeassistant', 'Class': 7077888, 'Powered': True, 'PowerState': 'on', 'Discoverable': False, 'DiscoverableTimeout': 180, 'Pairable': False, 'PairableTimeout': 0, 'Discovering': False, 'UUIDs': ['0000110e-0000-1000-8000-00805f9b34fb', '00001200-0000-1000-8000-00805f9b34fb', '0000111f-0000-1000-8000-00805f9b34fb', '0000110b-0000-1000-8000-00805f9b34fb', '00001108-0000-1000-8000-00805f9b34fb', '0000110c-0000-1000-8000-00805f9b34fb', '0000184f-0000-1000-8000-00805f9b34fb', '00001800-0000-1000-8000-00805f9b34fb', '00001801-0000-1000-8000-00805f9b34fb', '00001844-0000-1000-8000-00805f9b34fb', '0000180a-0000-1000-8000-00805f9b34fb', '0000184d-0000-1000-8000-00805f9b34fb', '00001845-0000-1000-8000-00805f9b34fb', '0000110a-0000-1000-8000-00805f9b34fb'], 'Modalias': 'usb:v1D6Bp0246d0546', 'Roles': ['central', 'peripheral']}, 'org.freedesktop.DBus.Properties': {}, 'org.bluez.BatteryProviderManager1': {}, 'org.bluez.GattManager1': {}, 'org.bluez.AdvertisementMonitorManager1': {'SupportedMonitorTypes': ['or_patterns'], 'SupportedFeatures': []}, 'org.bluez.Media1': {'SupportedUUIDs': ['0000110a-0000-1000-8000-00805f9b34fb', '0000110b-0000-1000-8000-00805f9b34fb']}, 'org.bluez.NetworkServer1': {}, 'org.bluez.LEAdvertisingManager1': {'ActiveInstances': 0, 'SupportedInstances': 5, 'SupportedIncludes': ['tx-power', 'appearance', 'local-name'], 'SupportedFeatures': [], 'SupportedCapabilities': {'MaxAdvLen': 31, 'MaxScnRspLen': 31}}}, '/org/bluez/hci0/dev_F3_BB_7F_08_D1_EF': {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.Device1': {'Address': 'F3:BB:7F:08:D1:EF', 'AddressType': 'random', 'Name': 'Ember Ceramic Mug', 'Alias': 'Ember Ceramic Mug', 'Paired': True, 'Bonded': True, 'Trusted': True, 'Blocked': False, 'LegacyPairing': False, 'Connected': False, 'UUIDs': ['00001530-1212-efde-1523-785feabcd123', '00001800-0000-1000-8000-00805f9b34fb', '00001801-0000-1000-8000-00805f9b34fb', 'fc543622-236c-4c94-8fa9-944a3e5353fa'], 'Adapter': '/org/bluez/hci0', 'ServicesResolved': False}, 'org.freedesktop.DBus.Properties': {}}}
2023-11-29 08:42:44.962 DEBUG (MainThread) [bleak_retry_connector] Restored 1 discoveries for hci0
2023-11-29 08:42:44.967 DEBUG (MainThread) [bleak.backends.bluezdbus.advertisement_monitor] Activate
2023-11-29 08:46:20.249 DEBUG (MainThread) [ember_mug.mug] New mug connection initialized.
2023-11-29 08:46:20.249 DEBUG (MainThread) [ember_mug.mug] Registered callback: <bound method MugDataUpdateCoordinator._async_handle_callback of <custom_components.ember_mug.coordinator.MugDataUpdateCoordinator object at 0xffff6b121390>>
2023-11-29 08:46:20.250 INFO (MainThread) [custom_components.ember_mug.coordinator] Ember Ceramic Mug ember-mug-f3bb7f08d1ef Setup
2023-11-29 08:46:20.250 DEBUG (MainThread) [ember_mug.mug] Registered callback: <function async_setup_entry.<locals>.<lambda> at 0xffff51430040>
2023-11-29 08:46:20.250 DEBUG (MainThread) [custom_components.ember_mug.coordinator] Bluetooth event. Service Info: <home_assistant_bluetooth.models.BluetoothServiceInfoBleak object at 0xffff72e389c0>, change: BluetoothChange.ADVERTISEMENT
2023-11-29 08:46:20.250 DEBUG (MainThread) [ember_mug.mug] Set new device from F3:BB:7F:08:D1:EF: Ember Ceramic Mug to F3:BB:7F:08:D1:EF: Ember Ceramic Mug
2023-11-29 08:46:20.250 DEBUG (MainThread) [ember_mug.mug] Callback <bound method MugDataUpdateCoordinator._async_handle_callback of <custom_components.ember_mug.coordinator.MugDataUpdateCoordinator object at 0xffff6b121390>> already registered
2023-11-29 08:46:20.251 DEBUG (MainThread) [custom_components.ember_mug.coordinator] Updating
2023-11-29 08:46:20.251 DEBUG (MainThread) [ember_mug.mug] Updating the following attributes: {'firmware', 'meta'}
2023-11-29 08:46:20.251 DEBUG (MainThread) [ember_mug.mug] Establishing a new connection from mug (ID: 281472152281680) to F3:BB:7F:08:D1:EF: Ember Ceramic Mug
2023-11-29 08:46:20.251 DEBUG (MainThread) [bleak_retry_connector]  (F3:BB:7F:08:D1:EF) - F3:BB:7F:08:D1:EF: Connection attempt: 1
2023-11-29 08:46:20.256 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Connecting to device @ F3:BB:7F:08:D1:EF
2023-11-29 08:46:20.280 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Connecting to BlueZ path /org/bluez/hci0/dev_F3_BB_7F_08_D1_EF
2023-11-29 08:46:40.280 DEBUG (MainThread) [bleak.backends.bluezdbus.client] _cleanup_all(/org/bluez/hci0/dev_F3_BB_7F_08_D1_EF)
2023-11-29 08:46:40.280 DEBUG (MainThread) [bleak_retry_connector]  (F3:BB:7F:08:D1:EF) - F3:BB:7F:08:D1:EF: Timed out trying to connect (attempt: 1, last rssi: None)
2023-11-29 08:46:40.281 DEBUG (MainThread) [bleak_retry_connector.bluez] Ember Ceramic Mug - F3:BB:7F:08:D1:EF: Waited 7.654493674635887e-05 seconds to disconnect
2023-11-29 08:46:40.532 DEBUG (MainThread) [bleak_retry_connector]  (F3:BB:7F:08:D1:EF) - F3:BB:7F:08:D1:EF: Connection attempt: 2
2023-11-29 08:46:40.532 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Connecting to device @ F3:BB:7F:08:D1:EF
2023-11-29 08:46:40.535 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Connecting to BlueZ path /org/bluez/hci0/dev_F3_BB_7F_08_D1_EF
2023-11-29 08:47:00.535 DEBUG (MainThread) [bleak.backends.bluezdbus.client] _cleanup_all(/org/bluez/hci0/dev_F3_BB_7F_08_D1_EF)
2023-11-29 08:47:00.535 DEBUG (MainThread) [bleak_retry_connector]  (F3:BB:7F:08:D1:EF) - F3:BB:7F:08:D1:EF: Timed out trying to connect (attempt: 2, last rssi: None)
2023-11-29 08:47:00.535 DEBUG (MainThread) [bleak_retry_connector.bluez] Ember Ceramic Mug - F3:BB:7F:08:D1:EF: Waited 9.150430560112e-05 seconds to disconnect
2023-11-29 08:47:00.786 DEBUG (MainThread) [bleak_retry_connector]  (F3:BB:7F:08:D1:EF) - F3:BB:7F:08:D1:EF: Connection attempt: 3
2023-11-29 08:47:00.787 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Connecting to device @ F3:BB:7F:08:D1:EF
2023-11-29 08:47:00.789 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Connecting to BlueZ path /org/bluez/hci0/dev_F3_BB_7F_08_D1_EF
2023-11-29 08:47:20.789 DEBUG (MainThread) [bleak_retry_connector]  (F3:BB:7F:08:D1:EF) - F3:BB:7F:08:D1:EF: Timed out trying to connect (attempt: 3, last rssi: None)
2023-11-29 08:47:20.789 DEBUG (MainThread) [bleak_retry_connector.bluez] Ember Ceramic Mug - F3:BB:7F:08:D1:EF: Waited 8.537899702787399e-05 seconds to disconnect
2023-11-29 08:47:21.041 DEBUG (MainThread) [bleak_retry_connector]  (F3:BB:7F:08:D1:EF) - F3:BB:7F:08:D1:EF: Connection attempt: 4
2023-11-29 08:47:21.041 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Connecting to device @ F3:BB:7F:08:D1:EF
2023-11-29 08:47:21.044 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Connecting to BlueZ path /org/bluez/hci0/dev_F3_BB_7F_08_D1_EF
2023-11-29 08:47:41.044 DEBUG (MainThread) [bleak.backends.bluezdbus.client] _cleanup_all(/org/bluez/hci0/dev_F3_BB_7F_08_D1_EF)
2023-11-29 08:47:41.044 DEBUG (MainThread) [bleak_retry_connector]  (F3:BB:7F:08:D1:EF) - F3:BB:7F:08:D1:EF: Timed out trying to connect (attempt: 4, last rssi: None)
2023-11-29 08:47:41.044 DEBUG (MainThread) [bleak_retry_connector.bluez] Ember Ceramic Mug - F3:BB:7F:08:D1:EF: Waited 8.142134174704552e-05 seconds to disconnect

This issue is probably the same as some of the other issues, but I wanted to create a new issue just in case it is different. Please dupe if appropriate. Happy to provide any additional information on request. I'm just out of ideas on what to try next.

sopelj commented 9 months ago

Hey, thank you very much for all this information. Much appreciated! I think it's probably the same issue as #38 , but information is great. So, I won't close it right away just in case. Are you using Home Assistant OS 11.X as well?

csilv commented 9 months ago

Are you using Home Assistant OS 11.X as well?

Yes, Home Assistant OS 11.1, running on a Home Assistant Blue. Thanks for the quick response, I'll keep an eye on both issues and don't hesitate to request more info. Once v12 is available as a stable release I'll upgrade and try again.

sopelj commented 9 months ago

Yes, Home Assistant OS 11.1, running on a Home Assistant Blue. Thanks for the quick response, I'll keep an eye on both issues and don't hesitate to request more info. Once v12 is available as a stable release I'll upgrade and try again.

Oh interesting, those look like nice little machines. Thanks to you too! Yeah, I tried the 11.2rc but it doesn't seem to change anything. Maybe the 12 will. If I remove the Bluetooth integration (for the dongle) and use my Bluetooth proxies it seems to work no problem. So, I think it's either related to Home Assistant OS or maybe an update to one of the libraries that it uses for local dongles. I'll do some more investigating, but might not be able to much until this weekend.

sopelj commented 9 months ago

Hi! Out of curiosity, does removing the device via bluetoothctl, factory resetting the mug and reloading the integration work for you?

borodaaaaa commented 8 months ago

I also have similar issue. It sees the mug amd its mac, connects to it and say success. No choose area menu. In integrations i see the addon but dont have any entities or devices and reload does nothing. Did factory reset(14sec button press) forgot on the phone. Tried both normal -white light and pairing -blinking blue light … IMG_0501 IMG_0502 IMG_0503 IMG_0504

That was in logs when i tried to connect ita few times

Log details (ERROR)

Logger: homeassistant.config_entries Source: config_entries.py:406 First occurred: 13:19:50 (5 occurrences) Last logged: 18:35:27

Error setting up entry Ember Ceramic Mug for ember_mug Error setting up entry cup27364825158 for ember_mug Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 406, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/ember_mug/init.py", line 97, in async_setup_entry await mug_coordinator.async_config_entry_first_refresh() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in async_config_entry_first_refresh await self._async_refresh( File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/ember_mug/coordinator.py", line 67, in _async_update_data changed = await self.mug.update_initial() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/ember_mug/mug.py", line 377, in update_initial return await self._update_multiple(INITIAL_ATTRS) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/ember_mug/mug.py", line 388, in _update_multiple await self._ensure_connection() File "/usr/local/lib/python3.11/site-packages/ember_mug/mug.py", line 135, in _ensure_connection client = await establish_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/bleak_retry_connector/init.py", line 363, in establish_connection await client.connect( File "/usr/local/lib/python3.11/site-packages/habluetooth/wrappers.py", line 295, in connect connected = await super().connect(kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/bleak/init.py", line 605, in connect return await self._backend.connect(kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/bleak/backends/bluezdbus/client.py", line 209, in connect reply = await self._bus.call( ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/dbus_fast/aio/message_bus.py", line 375, in call await future asyncio.exceptions.CancelledError

sopelj commented 8 months ago

I also have similar issue. It sees the mug amd its mac, connects to it and say success. No choose area menu. In integrations i see the addon but dont have any entities or devices and reload does nothing. Did factory reset(14sec button press) forgot on the phone. Tried both normal -white light and pairing -blinking blue light

Hey! That's a bit strange. It looks like it can't perform the initial connection to the device. It definitely shouldn't display a stack trace though. Is your device a Mug or a cup? It says Mug, but in the error it seems to say "cup27364825158". Are you using built-in Bluetooth, a dongle (a supported one?) or a proxy? Also, which version of this integration are you using? It might be worth tring the beta of 0.9.0. Did you try any of the troubleshooting steps? Thanks!

borodaaaaa commented 8 months ago

Not sure how to find that out, it say ember mug when it finds it. I tried renaming it to something else, hence the name cup27364825158. Tried two bt adapters, inbuilt as well as one of the recommended by HA CSR8510. No proxy. Using 0.9.0 beta-2. Will try 0.8.0 and let you know, i think i tried it before with no luck

sopelj commented 8 months ago

Not sure how to find that out, it say ember mug when it finds it. I tried renaming it to something else, hence the name cup27364825158. Tried two bt adapters, inbuilt as well as one of the recommended by HA CSR8510. No proxy. Using 0.9.0 beta-2. Will try 0.8.0 and let you know, i think i tried it before with no luck

Oh OK. Well, it's just the type of device you have. It should say on the box. If it has a handle it's mug. Hmm, OK. Well, proxies are definitely more reliable, built-in ones can be hit or miss, but at least one should work. Ideally just one at a time though or you might get connection issues as they could be fighting each other. If you could try enabling debug logging you may get a more helpful message in the log. Also, the troubleshooting steps like opening bluetoothctl and such and moving the device close to the adapter may help as well.

orywig commented 7 months ago

I've got the same issue with the mug I got my wife for Christmas. It is a Mug 2. I am using a BT dongle, running the latest versions of HAOS, supervisor, core, etc. I am looking to get a ESPHome BT relay soon.. curious if that will work better, like what you said previously.

sopelj commented 7 months ago

@orywig if you are comfortable accessing the command line you can try opening bluetoothctl and either leaving it open during the integration setup or manually pairing it. There is an example in the Idasen Desk integration If not, this limitation does not seem to apply to Bluetooth proxies.