sopelj / python-ember-mug

Python Library to Interact with Ember Mugs
MIT License
28 stars 4 forks source link

Could you add the Tumbler? #56

Closed a3rosol closed 10 months ago

a3rosol commented 11 months ago

Description

Could you add the new Ember Tumbler?

sopelj commented 11 months ago

Hi! I would love to support it. However, I do not have one and thus have no way of testing it. Superficially it looks like it probably has the same features as the standard Mug, so possibly just with the service UUID and/or the Bluetooth name it might work as is, by treating it as a mug. Do you know what name it shows up as on Bluetooth? If the device is paired with your phone or computer it should be displayed in the list of paired devices. Thanks!

dshokouhi commented 10 months ago

@sopelj mine shows up as Ember Mug 2

FWIW it gets detected by the Home Assistant custom integration however none of the sensors work

if you need me to grab anymore data please let me know :)

sopelj commented 10 months ago

@sopelj mine shows up as Ember Mug 2

FWIW it gets detected by the Home Assistant custom integration however none of the sensors work

if you need me to grab anymore data please let me know :)

Oh thanks! Your Tumbler gets detected as Ember Mug 2? Is this its Bluetooth name or in the name displayed in the Home Assistant integration? If it's the latter it might just be the fallback value.

That's strange none of the sensors work. I had hoped it would behave like a normal mug. Do you have any errors in your log? If not perhaps there would be some helpful output if you could enable debug logging. Although, if no values are displayed, I would hope some errors would be present even without debugging level logs.

Another option, if you are motivated, would be to output all raw data and attributes from the device. If you check the "Debug" option, when adding the device to the integration (if you did not initially, you might need to remove it and add it again). This will automatically output all attributes and values found on the device to the logs. It can be obtained either from the logs if debug logging is enabled or via the "Download Diagnostics" button in the device page in Home Assistant. image

dshokouhi commented 10 months ago

Is this its Bluetooth name

on device bluetooth name

image

in the name displayed in the Home Assistant integration? If it's the latter it might just be the fallback value.

integration also shows it as the same

image

Do you have any errors in your log

this what I see so far, mysetup includes 1 BT adapter and 2 BT ESPHome proxies

2023-12-10 09:43:34.915 WARNING (MainThread) [ember_mug.mug] Failed to subscribe to state attr: Timeout waiting for BluetoothGATTNotifyResponse, BluetoothGATTErrorResponse, BluetoothDeviceConnectionResponse after 10.0s

I don't see anything else nor do I see any of my recent attempts to reload the integration which feels strange

image

If not perhaps there would be some helpful output if you could enable debug logging. Although, if no values are displayed, I would hope some errors would be present even without debugging level logs.

debug logs from when I reload the integration

ate interval 0:00:10
2023-12-12 10:12:01.802 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540003-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'Y\x16')'
2023-12-12 10:12:02.211 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540002-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\xd6\x14')'
2023-12-12 10:12:02.827 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540004-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x01')'
2023-12-12 10:12:02.827 DEBUG (MainThread) [custom_components.ember_mug.coordinator] [Full Update] Changed: []
2023-12-12 10:12:06.472 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.den_shield_tv is taking over 10 seconds
2023-12-12 10:12:06.472 WARNING (MainThread) [homeassistant.components.media_player] Updating androidtv media_player took longer than the scheduled update interval 0:00:10
2023-12-12 10:12:17.730 WARNING (Recorder) [homeassistant.components.recorder.db_schema] State attributes for sensor.dannys_pixel_8_pro_active_notification_count exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored
2023-12-12 10:12:17.771 DEBUG (MainThread) [custom_components.ember_mug.coordinator] Updating
2023-12-12 10:12:17.771 DEBUG (MainThread) [ember_mug.mug] Updating the following attributes: {'liquid_level', 'led_colour', 'target_temp', 'current_temp', 'temperature_unit', 'name', 'battery', 'liquid_state'}
2023-12-12 10:12:18.381 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540005-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x10')'
2023-12-12 10:12:18.789 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540014-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x00\xf3\xff\xff')'
2023-12-12 10:12:19.199 DEBUG (MainThread) [ember_mug.mug] Push event received from Ember Mug 2 (5) - Data: bytearray(b'\x05').
2023-12-12 10:12:19.199 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540003-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'Y\x16')'
2023-12-12 10:12:19.608 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540002-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x9e\x14')'
2023-12-12 10:12:20.017 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540004-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x01')'
2023-12-12 10:12:20.017 DEBUG (MainThread) [custom_components.ember_mug.coordinator] [Full Update] Changed: []
2023-12-12 10:12:20.017 DEBUG (MainThread) [custom_components.ember_mug] Finished fetching ember-mug-f29c65df6e3a data in 2.247 seconds (success: True)
2023-12-12 10:12:33.115 DEBUG (MainThread) [ember_mug.mug] Expected disconnect called
2023-12-12 10:12:33.116 DEBUG (MainThread) [ember_mug.mug] Unsubscribe called
2023-12-12 10:12:33.252 DEBUG (MainThread) [ember_mug.mug] Disconnect callback called
2023-12-12 10:12:33.253 DEBUG (MainThread) [ember_mug.mug] New mug connection initialized.
2023-12-12 10:12:33.253 DEBUG (MainThread) [ember_mug.mug] Registered callback: <bound method MugDataUpdateCoordinator._async_handle_callback of <custom_components.ember_mug.coordinator.MugDataUpdateCoordinator object at 0x7f8b347b9150>>
2023-12-12 10:12:33.254 INFO (MainThread) [custom_components.ember_mug.coordinator] Ember Mug 2 ember-mug-f29c65df6e3a Setup
2023-12-12 10:12:33.254 DEBUG (MainThread) [ember_mug.mug] Registered callback: <function async_setup_entry.<locals>.<lambda> at 0x7f8b34f46f20>
2023-12-12 10:12:33.254 DEBUG (MainThread) [custom_components.ember_mug.coordinator] Bluetooth event. Service Info: <home_assistant_bluetooth.models.BluetoothServiceInfoBleak object at 0x7f8b348245c0>, change: BluetoothChange.ADVERTISEMENT
2023-12-12 10:12:33.256 DEBUG (MainThread) [ember_mug.mug] Set new device from F2:9C:65:DF:6E:3A: Ember Mug 2 to F2:9C:65:DF:6E:3A: Ember Mug 2
2023-12-12 10:12:33.256 DEBUG (MainThread) [ember_mug.mug] Callback <bound method MugDataUpdateCoordinator._async_handle_callback of <custom_components.ember_mug.coordinator.MugDataUpdateCoordinator object at 0x7f8b347b9150>> already registered
2023-12-12 10:12:33.256 DEBUG (MainThread) [custom_components.ember_mug.coordinator] Updating
2023-12-12 10:12:33.256 DEBUG (MainThread) [ember_mug.mug] Updating the following attributes: {'meta', 'firmware'}
2023-12-12 10:12:33.256 DEBUG (MainThread) [ember_mug.mug] Establishing a new connection from mug (ID: 140235883576208) to F2:9C:65:DF:6E:3A: Ember Mug 2
2023-12-12 10:12:33.256 DEBUG (MainThread) [bleak_retry_connector]  (F2:9C:65:DF:6E:3A) - F2:9C:65:DF:6E:3A: Connection attempt: 1
2023-12-12 10:12:33.256 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Connecting to device @ F2:9C:65:DF:6E:3A
2023-12-12 10:12:33.260 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Connecting to BlueZ path /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A
2023-12-12 10:12:33.620 DEBUG (MainThread) [bleak.backends.bluezdbus.client] _cleanup_all(/org/bluez/hci0/dev_F2_9C_65_DF_6E_3A)
2023-12-12 10:12:33.621 DEBUG (MainThread) [bleak_retry_connector]  (F2:9C:65:DF:6E:3A) - F2:9C:65:DF:6E:3A: Failed to connect: [org.bluez.Error.Failed] Software caused connection abort, device_missing: False, backing off: 0.25 (attempt: 1, last rssi: None)
2023-12-12 10:12:33.621 DEBUG (MainThread) [bleak_retry_connector.bluez] Ember Mug 2 - F2:9C:65:DF:6E:3A: Waited 0.0002745487727224827 seconds to disconnect
2023-12-12 10:12:33.872 DEBUG (MainThread) [bleak_retry_connector]  (F2:9C:65:DF:6E:3A) - F2:9C:65:DF:6E:3A: Connection attempt: 2
2023-12-12 10:12:33.872 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Connecting to device @ F2:9C:65:DF:6E:3A
2023-12-12 10:12:33.874 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Connecting to BlueZ path /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A
2023-12-12 10:12:34.306 DEBUG (MainThread) [bleak.backends.bluezdbus.client] _cleanup_all(/org/bluez/hci0/dev_F2_9C_65_DF_6E_3A)
2023-12-12 10:12:34.306 DEBUG (MainThread) [bleak_retry_connector]  (F2:9C:65:DF:6E:3A) - F2:9C:65:DF:6E:3A: Failed to connect: [org.bluez.Error.Failed] Software caused connection abort, device_missing: False, backing off: 0.25 (attempt: 2, last rssi: None)
2023-12-12 10:12:34.306 DEBUG (MainThread) [bleak_retry_connector.bluez] Ember Mug 2 - F2:9C:65:DF:6E:3A: Waited 0.0002844356931746006 seconds to disconnect
2023-12-12 10:12:34.557 DEBUG (MainThread) [bleak_retry_connector]  (F2:9C:65:DF:6E:3A) - F2:9C:65:DF:6E:3A: Connection attempt: 3
2023-12-12 10:12:34.793 DEBUG (MainThread) [bleak_retry_connector]  (F2:9C:65:DF:6E:3A) - F2:9C:65:DF:6E:3A: Connected after 3 attempts
2023-12-12 10:12:34.965 INFO (MainThread) [ember_mug.mug] Subscribe to Push Events
2023-12-12 10:12:35.164 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc54000d-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\xf2\x9ce\xdfn:XSLY34601579')'
2023-12-12 10:12:35.272 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc54000c-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'x\x00\x0c\x00x\x00')'
2023-12-12 10:12:35.272 DEBUG (MainThread) [ember_mug.mug] Firing callbacks: {<bound method MugDataUpdateCoordinator._async_handle_callback of <custom_components.ember_mug.coordinator.MugDataUpdateCoordinator object at 0x7f8b347b9150>>: <function EmberMug.register_callback.<locals>.unregister_callback at 0x7f8b9a5c4900>, <function async_setup_entry.<locals>.<lambda> at 0x7f8b34f46f20>: <function EmberMug.register_callback.<locals>.unregister_callback at 0x7f8b35e47100>}
2023-12-12 10:12:35.272 DEBUG (MainThread) [custom_components.ember_mug.coordinator] Callback called in Home Assistant
2023-12-12 10:12:35.273 DEBUG (MainThread) [custom_components.ember_mug] Manually updated ember-mug-f29c65df6e3a data
2023-12-12 10:12:35.273 DEBUG (MainThread) [ember_mug.mug] Attributes updated: [Change(attr='meta', old_value=None, new_value=MugMeta(mug_id='8pxl3246', serial_number='SLY34601579')), Change(attr='firmware', old_value=None, new_value=MugFirmwareInfo(version=120, hardware=12, bootloader=120))]
2023-12-12 10:12:35.273 DEBUG (MainThread) [ember_mug.mug] Updating the following attributes: {'liquid_level', 'led_colour', 'target_temp', 'current_temp', 'temperature_unit', 'name', 'battery', 'liquid_state'}
2023-12-12 10:12:35.367 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540005-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x10')'
2023-12-12 10:12:35.470 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540014-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x00\xf3\xff\xff')'
2023-12-12 10:12:35.572 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540003-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'Y\x16')'
2023-12-12 10:12:35.674 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540002-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x9e\x14')'
2023-12-12 10:12:35.778 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540004-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x01')'
2023-12-12 10:12:35.778 DEBUG (MainThread) [custom_components.ember_mug.coordinator] [Full Update] Changed: [Change(attr='meta', old_value=None, new_value=MugMeta(mug_id='8pxl3246', serial_number='SLY34601579')), Change(attr='firmware', old_value=None, new_value=MugFirmwareInfo(version=120, hardware=12, bootloader=120))]
2023-12-12 10:12:35.778 DEBUG (MainThread) [custom_components.ember_mug] Finished fetching ember-mug-f29c65df6e3a data in 2.522 seconds (success: True)
2023-12-12 10:12:35.778 DEBUG (MainThread) [ember_mug.mug] Unregistered callback: <function async_setup_entry.<locals>.<lambda> at 0x7f8b34f46f20>
2023-12-12 10:12:35.879 DEBUG (MainThread) [ember_mug.mug] Wrote 'bytearray(b'\x01')' to attribute 'fc540004-236c-4c94-8fa9-944a3e5353fa'
2023-12-12 10:12:50.672 DEBUG (MainThread) [custom_components.ember_mug.coordinator] Updating
2023-12-12 10:12:50.672 DEBUG (MainThread) [ember_mug.mug] Updating the following attributes: {'liquid_level', 'led_colour', 'target_temp', 'current_temp', 'temperature_unit', 'name', 'battery', 'liquid_state'}
2023-12-12 10:12:51.024 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540005-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x10')'
2023-12-12 10:12:51.434 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540014-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x00\xf3\xff\xff')'
2023-12-12 10:12:51.783 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540003-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'Y\x16')'
2023-12-12 10:12:52.182 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540002-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x9e\x14')'
2023-12-12 10:12:52.592 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540004-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x01')'
2023-12-12 10:12:52.592 DEBUG (MainThread) [custom_components.ember_mug.coordinator] [Full Update] Changed: []
2023-12-12 10:12:52.592 DEBUG (MainThread) [custom_components.ember_mug] Finished fetching ember-mug-f29c65df6e3a data in 1.920 seconds (success: True)

Another option, if you are motivated, would be to output all raw data and attributes from the device. If you check the "Debug" option, when adding the device to the integration (if you did not initially, you might need to remove it and add it again). This will automatically output all attributes and values found on the device to the logs. It can be obtained either from the logs if debug logging is enabled or via the "Download Diagnostics" button in the device page in Home Assistant.

I did not check that originally as I was trying my best to follow all the instructions in the readme (which looks like it got updated since I setup the ember :) ) Let me know if you would like me to try and add those extra attributes.

sopelj commented 10 months ago

@dshokouhi wow, thanks for all that information. It is very helpful!

That's super weird that the Tumbler is listed as an Ember Mug 2, I wonder if they just stuck the same software on there. On my Mug 2, the "Hardware" is listed as 10 and your Tumbler says 12, maybe that's a way we can tell them apart. It would be nice to be able to display the correct name in Home Assistant.

From the output, I notice it is connecting to the device and it can read the metadata no problem, but for the main attributes it's only updating the first five in the list: liquid_level, led_colour, target_temp, current_temp and temperature_unit and then it stops and displays no changes. I think the problem is it's trying to read the "name" and failing. I know the "Ember Cup" didn't have a name attribute, so that could be the case with the Tumbler as well. Either way, my try/except is clearly too intense and I will fix that.

Would you mind, possibly, removing the "mug" from Home Assistant and trying to add it again with the "Debug" option checked and dumping those characteristics? That will give the list of all attributes so we can confirm if there is one for the name or not. It may also tell us the service UUID and some extra ones so we can see perhaps if there is another difference we can use to distinguish this device from standard mugs.

dshokouhi commented 10 months ago

On my Mug 2, the "Hardware" is listed as 10 and your Tumbler says 12, maybe that's a way we can tell them apart. It would be nice to be able to display the correct name in Home Assistant.

maybe we need to go by model number? theres 4 for the Ember Mug which contains the guide I used

https://ember.com/pages/instruction-manuals

Would you mind, possibly, removing the "mug" from Home Assistant and trying to add it again with the "Debug" option checked and dumping those characteristics? That will give the list of all attributes so we can confirm if there is one for the name or not. It may also tell us the service UUID and some extra ones so we can see perhaps if there is another difference we can use to distinguish this device from standard mugs.

I assume the diagnostics are enough here?

config_entry-ember_mug-afcf86793d782132fa71f13d20ce79e1.json.txt

sopelj commented 10 months ago

maybe we need to go by model number? theres 4 for the Ember Mug which contains the guide I used

https://ember.com/pages/instruction-manuals

Oh, yes, good idea, thanks! So it is indeed a "Mug" for them. However, I do need to figure out how to decode that value. It is printed on the device, but I haven't been able to extract a readable value yet from it.

I assume the diagnostics are enough here?

config_entry-ember_mug-afcf86793d782132fa71f13d20ce79e1.json.txt

Amazing, thanks! So there is indeed no name. I just need to figure out how to detect the "model" from the encoded attributes so I can tell it apart from normal mugs. 🤔

dshokouhi commented 10 months ago

I wish I knew how to read these values lol, is there maybe an online converter 😅 ?

if you need me to get any data or test anything let me know happy to help :) and thanks for troubleshooting!

sopelj commented 10 months ago

I mean, I think it's somewhere in this string of bytes: \xf2\x9ce\xdfn:XSLY34601579. The last 11 characters seem to just be the serial number in ascii. So, I thought at least some part of the first bit would be the model, but I can't figure out what it means.

Thanks! Much appreciated.

sopelj commented 10 months ago

Ok, so, still no clue what that code is. However, it looks like the data is stored in the Bluetooth Advertisement under Manufacturer data. I'm not certain to what it looks like on the Tumbler and other new devices. Would it be possible to see yours? In order to facilitate things, I mage changes to the main branch of the home assistant integration. Would it be possible to you to update to the "main" release in HACS and restart Home Assistant? You can do this by going into the Ember Mug integration in HACS, choosing the three dots -> Redownload and choosing the release "main": image I think you need to check "Show Beta Releases".

IT should print the data on startup. Something like this:

Integration setup. Last service info: Device: C9:0F:59:D6:33:F9: Ember Ceramic Mug, Manufacturer Data: {961: b'\x81'}

Thanks!

You can revert back after if you would like as "main" isn't always stable.

dshokouhi commented 10 months ago

Followed the steps here are the debug logs with the main branch. The entities still show as unavailable

2023-12-18 08:11:20.900 DEBUG (MainThread) [custom_components.ember_mug] Discovered bluetooth device: <home_assistant_bluetooth.models.BluetoothServiceInfoBleak object at 0x7f1df714d9c0>
2023-12-18 08:11:20.901 DEBUG (MainThread) [custom_components.ember_mug] Discovered bluetooth device: <home_assistant_bluetooth.models.BluetoothServiceInfoBleak object at 0x7f1df70b3940>
2023-12-18 08:11:46.638 DEBUG (MainThread) [custom_components.ember_mug] Integration setup. Last service info: Device: F2:9C:65:DF:6E:3A: Ember Mug 2, Manufacturer Data: {961: b'\x01\t\x03\x0e'}
2023-12-18 08:11:46.639 DEBUG (MainThread) [ember_mug.mug] New mug connection initialized.
2023-12-18 08:11:46.639 DEBUG (MainThread) [ember_mug.mug] Registered callback: <bound method MugDataUpdateCoordinator._async_handle_callback of <custom_components.ember_mug.coordinator.MugDataUpdateCoordinator object at 0x7f1d8b9fac10>>
2023-12-18 08:11:46.640 INFO (MainThread) [custom_components.ember_mug.coordinator] Ember Mug 2 ember-mug-f29c65df6e3a Setup
2023-12-18 08:11:46.640 DEBUG (MainThread) [ember_mug.mug] Registered callback: <function async_setup_entry.<locals>.<lambda> at 0x7f1d89f84040>
2023-12-18 08:11:46.640 DEBUG (MainThread) [custom_components.ember_mug.coordinator] Bluetooth event. Service Info: <home_assistant_bluetooth.models.BluetoothServiceInfoBleak object at 0x7f1d8a8394c0>, change: BluetoothChange.ADVERTISEMENT
2023-12-18 08:11:46.640 DEBUG (MainThread) [custom_components.ember_mug.coordinator] Bluetooth Manufacturer Data: {961: b'\x01\t\x03\x0e'}
2023-12-18 08:11:46.640 DEBUG (MainThread) [ember_mug.mug] Set new device from F2:9C:65:DF:6E:3A: Ember Mug 2 to F2:9C:65:DF:6E:3A: Ember Mug 2
2023-12-18 08:11:46.640 DEBUG (MainThread) [ember_mug.mug] Callback <bound method MugDataUpdateCoordinator._async_handle_callback of <custom_components.ember_mug.coordinator.MugDataUpdateCoordinator object at 0x7f1d8b9fac10>> already registered
2023-12-18 08:11:46.640 DEBUG (MainThread) [custom_components.ember_mug.coordinator] Updating
2023-12-18 08:11:46.640 DEBUG (MainThread) [ember_mug.mug] Updating the following attributes: {'meta', 'udsk', 'date_time_zone', 'dsk', 'firmware'}
2023-12-18 08:11:46.640 DEBUG (MainThread) [ember_mug.mug] Establishing a new connection from mug (ID: 139764873276752) to F2:9C:65:DF:6E:3A: Ember Mug 2
2023-12-18 08:11:46.640 DEBUG (MainThread) [bleak_retry_connector]  (F2:9C:65:DF:6E:3A) - F2:9C:65:DF:6E:3A: Connection attempt: 1
2023-12-18 08:11:46.644 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Connecting to device @ F2:9C:65:DF:6E:3A
2023-12-18 08:11:46.649 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Connecting to BlueZ path /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A
2023-12-18 08:11:47.565 DEBUG (MainThread) [bleak_retry_connector]  (F2:9C:65:DF:6E:3A) - F2:9C:65:DF:6E:3A: Connected after 1 attempts
2023-12-18 08:11:47.565 INFO (MainThread) [ember_mug.utils] Logging all services that were discovered
2023-12-18 08:11:47.565 DEBUG (MainThread) [ember_mug.utils] [Service] fc543622-236c-4c94-8fa9-944a3e5353fa: Unknown
2023-12-18 08:11:47.709 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc540011-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char002c: bytearray(b'')
2023-12-18 08:11:47.709 DEBUG (MainThread) [ember_mug.utils]    [Characteristic] fc540011-236c-4c94-8fa9-944a3e5353fa: read,write | Description: Unknown | Value: 'b'''
2023-12-18 08:11:47.808 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc540006-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char001a: bytearray(b'\n\x9axe\xf8')
2023-12-18 08:11:47.808 DEBUG (MainThread) [ember_mug.utils]    [Characteristic] fc540006-236c-4c94-8fa9-944a3e5353fa: read,write | Description: Unknown | Value: 'b'\n\x9axe\xf8''
2023-12-18 08:11:47.958 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc540013-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0031: bytearray(b'\x05')
2023-12-18 08:11:47.958 DEBUG (MainThread) [ember_mug.utils]    [Characteristic] fc540013-236c-4c94-8fa9-944a3e5353fa: read,notify | Description: Unknown | Value: 'b'\x05''
2023-12-18 08:11:48.060 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Descriptor 52 | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0031/desc0034: bytearray(b'\xdb\x1c1\x9d\x88[\x11\x80\x92\xbaa\x0e\xdc\xc8\x9c\x182\xad\xdc\xc2')
2023-12-18 08:11:48.060 DEBUG (MainThread) [ember_mug.utils]        [Descriptor] 00002908-0000-1000-8000-00805f9b34fb: Handle: 52 | Value: 'b'\xdb\x1c1\x9d\x88[\x11\x80\x92\xbaa\x0e\xdc\xc8\x9c\x182\xad\xdc\xc2''
2023-12-18 08:11:48.258 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Descriptor 51 | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0031/desc0033: bytearray(b'\x00\x00')
2023-12-18 08:11:48.258 DEBUG (MainThread) [ember_mug.utils]        [Descriptor] 00002902-0000-1000-8000-00805f9b34fb: Handle: 51 | Value: 'b'\x00\x00''
2023-12-18 08:11:48.358 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc54000d-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0024: bytearray(b'\xf2\x9ce\xdfn:XSLY34601579')
2023-12-18 08:11:48.358 DEBUG (MainThread) [ember_mug.utils]    [Characteristic] fc54000d-236c-4c94-8fa9-944a3e5353fa: read | Description: Unknown | Value: 'b'\xf2\x9ce\xdfn:XSLY34601579''
2023-12-18 08:11:48.558 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc54000a-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0020: bytearray(b'<\xd5\t\x02^|\xef\xf8')
2023-12-18 08:11:48.558 DEBUG (MainThread) [ember_mug.utils]    [Characteristic] fc54000a-236c-4c94-8fa9-944a3e5353fa: read,write | Description: Unknown | Value: 'b'<\xd5\t\x02^|\xef\xf8''
2023-12-18 08:11:48.808 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc540014-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0010: bytearray(b'\x00\xf3\xff\xff')
2023-12-18 08:11:48.808 DEBUG (MainThread) [ember_mug.utils]    [Characteristic] fc540014-236c-4c94-8fa9-944a3e5353fa: read,write | Description: Unknown | Value: 'b'\x00\xf3\xff\xff''
2023-12-18 08:11:49.059 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc540003-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0014: bytearray(b'Y\x16')
2023-12-18 08:11:49.059 DEBUG (MainThread) [ember_mug.utils]    [Characteristic] fc540003-236c-4c94-8fa9-944a3e5353fa: read,write | Description: Unknown | Value: 'b'Y\x16''
2023-12-18 08:11:49.158 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc540005-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0018: bytearray(b'\x06')
2023-12-18 08:11:49.158 DEBUG (MainThread) [ember_mug.utils]    [Characteristic] fc540005-236c-4c94-8fa9-944a3e5353fa: read | Description: Unknown | Value: 'b'\x06''
2023-12-18 08:11:49.309 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc54000f-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0028: bytearray(b'H\xd3\x84\xd1\xfc\xda\xed|\x06}k\xa5\xd8\xf2n\xf9\xba\xb1T:')
2023-12-18 08:11:49.309 DEBUG (MainThread) [ember_mug.utils]    [Characteristic] fc54000f-236c-4c94-8fa9-944a3e5353fa: read,write | Description: Unknown | Value: 'b'H\xd3\x84\xd1\xfc\xda\xed|\x06}k\xa5\xd8\xf2n\xf9\xba\xb1T:''
2023-12-18 08:11:49.408 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc540008-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char001e: bytearray(b'\x01')
2023-12-18 08:11:49.408 DEBUG (MainThread) [ember_mug.utils]    [Characteristic] fc540008-236c-4c94-8fa9-944a3e5353fa: read | Description: Unknown | Value: 'b'\x01''
2023-12-18 08:11:49.559 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc54000c-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0022: bytearray(b'x\x00\x0c\x00x\x00')
2023-12-18 08:11:49.559 DEBUG (MainThread) [ember_mug.utils]    [Characteristic] fc54000c-236c-4c94-8fa9-944a3e5353fa: read | Description: Unknown | Value: 'b'x\x00\x0c\x00x\x00''
2023-12-18 08:11:49.658 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc540004-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0016: bytearray(b'\x01')
2023-12-18 08:11:49.658 DEBUG (MainThread) [ember_mug.utils]    [Characteristic] fc540004-236c-4c94-8fa9-944a3e5353fa: read,write | Description: Unknown | Value: 'b'\x01''
2023-12-18 08:11:51.008 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc54000e-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0026: bytearray(b'(\xa6N\xefY\xbf\x13d\x86K\x05Sja\xce\xc1W\xd8\x95\xcc')
2023-12-18 08:11:51.008 DEBUG (MainThread) [ember_mug.utils]    [Characteristic] fc54000e-236c-4c94-8fa9-944a3e5353fa: read | Description: Unknown | Value: 'b'(\xa6N\xefY\xbf\x13d\x86K\x05Sja\xce\xc1W\xd8\x95\xcc''
2023-12-18 08:11:51.208 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc540007-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char001c: bytearray(b'd\x00\xeb\t\x00\x00\x00\x00')
2023-12-18 08:11:51.208 DEBUG (MainThread) [ember_mug.utils]    [Characteristic] fc540007-236c-4c94-8fa9-944a3e5353fa: read | Description: Unknown | Value: 'b'd\x00\xeb\t\x00\x00\x00\x00''
2023-12-18 08:11:51.508 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc540010-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char002a: bytearray(b'\x00')
2023-12-18 08:11:51.508 DEBUG (MainThread) [ember_mug.utils]    [Characteristic] fc540010-236c-4c94-8fa9-944a3e5353fa: read,write | Description: Unknown | Value: 'b'\x00''
2023-12-18 08:11:51.709 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc540012-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char002e: bytearray(b'\x03')
2023-12-18 08:11:51.709 DEBUG (MainThread) [ember_mug.utils]    [Characteristic] fc540012-236c-4c94-8fa9-944a3e5353fa: read,notify | Description: Unknown | Value: 'b'\x03''
2023-12-18 08:11:51.808 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Descriptor 48 | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char002e/desc0030: bytearray(b'\x00\x00')
2023-12-18 08:11:51.808 DEBUG (MainThread) [ember_mug.utils]        [Descriptor] 00002902-0000-1000-8000-00805f9b34fb: Handle: 48 | Value: 'b'\x00\x00''
2023-12-18 08:11:52.208 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc540002-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0012: bytearray(b'\x8d\t')
2023-12-18 08:11:52.208 DEBUG (MainThread) [ember_mug.utils]    [Characteristic] fc540002-236c-4c94-8fa9-944a3e5353fa: read | Description: Unknown | Value: 'b'\x8d\t''
2023-12-18 08:11:52.208 DEBUG (MainThread) [ember_mug.utils] [Service] 00001801-0000-1000-8000-00805f9b34fb: Generic Attribute Profile
2023-12-18 08:11:52.208 DEBUG (MainThread) [ember_mug.utils] [Service] 0000fe59-0000-1000-8000-00805f9b34fb: Nordic Semiconductor ASA
2023-12-18 08:11:52.209 DEBUG (MainThread) [ember_mug.utils]    [Characteristic] 8ec90003-f315-4f60-9fb8-838830daea50: write,indicate | Description: Buttonless DFU | Value: 'None'
2023-12-18 08:11:52.458 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Descriptor 14 | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000b/char000c/desc000e: bytearray(b'\x00\x00')
2023-12-18 08:11:52.458 DEBUG (MainThread) [ember_mug.utils]        [Descriptor] 00002902-0000-1000-8000-00805f9b34fb: Handle: 14 | Value: 'b'\x00\x00''
2023-12-18 08:11:52.460 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Pairing to BLE device @ F2:9C:65:DF:6E:3A
2023-12-18 08:11:52.485 INFO (MainThread) [ember_mug.mug] Subscribe to Push Events
2023-12-18 08:11:54.465 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc54000d-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0024: bytearray(b'\xf2\x9ce\xdfn:XSLY34601579')
2023-12-18 08:11:54.465 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc54000d-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\xf2\x9ce\xdfn:XSLY34601579')'
2023-12-18 08:11:55.258 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc54000f-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0028: bytearray(b'H\xd3\x84\xd1\xfc\xda\xed|\x06}k\xa5\xd8\xf2n\xf9\xba\xb1T:')
2023-12-18 08:11:55.259 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc54000f-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'H\xd3\x84\xd1\xfc\xda\xed|\x06}k\xa5\xd8\xf2n\xf9\xba\xb1T:')'
2023-12-18 08:11:56.258 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc540006-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char001a: bytearray(b'\n\x9axe\xf8')
2023-12-18 08:11:56.258 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540006-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\n\x9axe\xf8')'
2023-12-18 08:11:56.866 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc54000e-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0026: bytearray(b'(\xa6N\xefY\xbf\x13d\x86K\x05Sja\xce\xc1W\xd8\x95\xcc')
2023-12-18 08:11:56.866 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc54000e-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'(\xa6N\xefY\xbf\x13d\x86K\x05Sja\xce\xc1W\xd8\x95\xcc')'
2023-12-18 08:11:57.658 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc54000c-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0022: bytearray(b'x\x00\x0c\x00x\x00')
2023-12-18 08:11:57.659 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc54000c-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'x\x00\x0c\x00x\x00')'
2023-12-18 08:11:57.659 DEBUG (MainThread) [ember_mug.mug] Firing callbacks: {<bound method MugDataUpdateCoordinator._async_handle_callback of <custom_components.ember_mug.coordinator.MugDataUpdateCoordinator object at 0x7f1d8b9fac10>>: <function EmberMug.register_callback.<locals>.unregister_callback at 0x7f1d919e0ae0>, <function async_setup_entry.<locals>.<lambda> at 0x7f1d89f84040>: <function EmberMug.register_callback.<locals>.unregister_callback at 0x7f1d89f85760>}
2023-12-18 08:11:57.659 DEBUG (MainThread) [custom_components.ember_mug.coordinator] Callback called in Home Assistant
2023-12-18 08:11:57.659 DEBUG (MainThread) [custom_components.ember_mug] Manually updated ember-mug-f29c65df6e3a data
2023-12-18 08:11:57.659 DEBUG (MainThread) [ember_mug.mug] Attributes updated: [Change(attr='meta', old_value=None, new_value=MugMeta(mug_id='8pxl3246', serial_number='SLY34601579')), Change(attr='udsk', old_value='', new_value='SNOE0fza7XwGfWul2PJu+bqxVDo='), Change(attr='date_time_zone', old_value=None, new_value=datetime.datetime(1975, 8, 21, 23, 25, 25, tzinfo=datetime.timezone.utc)), Change(attr='dsk', old_value='', new_value='KKZO71m/E2SGSwVTamHOwVfYlcw='), Change(attr='firmware', old_value=None, new_value=MugFirmwareInfo(version=120, hardware=12, bootloader=120))]
2023-12-18 08:11:57.659 DEBUG (MainThread) [ember_mug.mug] Updating the following attributes: {'temperature_unit', 'liquid_level', 'current_temp', 'name', 'led_colour', 'battery', 'target_temp', 'liquid_state'}
2023-12-18 08:11:58.658 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc540004-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0016: bytearray(b'\x01')
2023-12-18 08:11:58.658 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540004-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x01')'
2023-12-18 08:11:59.658 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc540005-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0018: bytearray(b'\x06')
2023-12-18 08:11:59.658 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540005-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x06')'
2023-12-18 08:12:00.858 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Read Characteristic fc540002-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0012: bytearray(b'\x8d\t')
2023-12-18 08:12:00.859 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540002-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x8d\t')'
2023-12-18 08:12:00.859 DEBUG (MainThread) [custom_components.ember_mug.coordinator] An error occurred trying to update the mug: Characteristic with UUID fc540001-236c-4c94-8fa9-944a3e5353fa could not be found!
2023-12-18 08:12:00.860 DEBUG (MainThread) [custom_components.ember_mug.coordinator] [Full Update] Changed: None
2023-12-18 08:12:00.860 DEBUG (MainThread) [custom_components.ember_mug] Finished fetching ember-mug-f29c65df6e3a data in 14.220 seconds (success: True)
2023-12-18 08:12:00.860 DEBUG (MainThread) [ember_mug.mug] Unregistered callback: <function async_setup_entry.<locals>.<lambda> at 0x7f1d89f84040>
2023-12-18 08:12:01.659 DEBUG (MainThread) [bleak.backends.bluezdbus.client] Write Characteristic fc540004-236c-4c94-8fa9-944a3e5353fa | /org/bluez/hci0/dev_F2_9C_65_DF_6E_3A/service000f/char0016: bytearray(b'\x01')
2023-12-18 08:12:01.659 DEBUG (MainThread) [ember_mug.mug] Wrote 'bytearray(b'\x01')' to attribute 'fc540004-236c-4c94-8fa9-944a3e5353fa'
dshokouhi commented 10 months ago

@sopelj saw that you pushed a beta update and decided to give it a shot, as of now I just updated the current integration and restarted HA. I can see some data, other entities I assume just need to be cleaned up by me :)

image image image

There are also some errors

2023-12-26 12:33:03.231 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform ember_mug
Traceback (most recent call last):
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity_platform.py", line 509, in async_add_entities
    await asyncio.gather(*tasks)
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity_platform.py", line 754, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity.py", line 1025, in add_to_platform_finish
    self.async_write_ha_state()
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity.py", line 745, in async_write_ha_state
    self._async_write_ha_state()
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity.py", line 845, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity.py", line 786, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity.py", line 751, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/components/sensor/__init__.py", line 501, in state
    value = self.native_value
            ^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/ember_mug/sensor.py", line 141, in native_value
    return liquid_level / self.max_level * 100
                          ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/functools.py", line 1001, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/ember_mug/sensor.py", line 129, in max_level
    if self.coordinator.mug.data.model_info.type == DeviceType.TRAVEL_MUG:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ModelInfo' object has no attribute 'type'
2023-12-26 12:33:03.238 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity.py", line 1163, in _async_registry_updated
    self.async_write_ha_state()
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity.py", line 745, in async_write_ha_state
    self._async_write_ha_state()
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity.py", line 845, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity.py", line 786, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity.py", line 751, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/components/sensor/__init__.py", line 501, in state
    value = self.native_value
            ^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/ember_mug/sensor.py", line 141, in native_value
    return liquid_level / self.max_level * 100
                          ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/functools.py", line 1001, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/ember_mug/sensor.py", line 129, in max_level
    if self.coordinator.mug.data.model_info.type == DeviceType.TRAVEL_MUG:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ModelInfo' object has no attribute 'type'
2023-12-26 12:33:03.241 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up ember_mug platform for sensor
Traceback (most recent call last):
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity_platform.py", line 369, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity_platform.py", line 509, in async_add_entities
    await asyncio.gather(*tasks)
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity_platform.py", line 754, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity.py", line 1025, in add_to_platform_finish
    self.async_write_ha_state()
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity.py", line 745, in async_write_ha_state
    self._async_write_ha_state()
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity.py", line 845, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity.py", line 786, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/helpers/entity.py", line 751, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/srv/homeassistant3.11/lib/python3.11/site-packages/homeassistant/components/sensor/__init__.py", line 501, in state
    value = self.native_value
            ^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/ember_mug/sensor.py", line 141, in native_value
    return liquid_level / self.max_level * 100
                          ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/functools.py", line 1001, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/ember_mug/sensor.py", line 129, in max_level
    if self.coordinator.mug.data.model_info.type == DeviceType.TRAVEL_MUG:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ModelInfo' object has no attribute 'type'
dshokouhi commented 10 months ago

just updated to b2 and the above error is now gone :) also I can see liquid level sensor :) although I will admit I just cleaned the cup and its hanging upside down 😂

image

sopelj commented 10 months ago

Hey! Thanks for testing so quickly. I didn't even have time to tell you. haha. Oh, ok. So, it says 57%, but the tumbler is empty? Sometimes if it's humid it thinks it still has stuff in it. If you have a chance, could you please try filling it and seeing what the level says? It might go above 100%. The "raw_liquid_value" value under "attributes" might be more helpful than the percentage if it doesn't work. The mug/cup seem to output between 0 and 30 and the Travel mug is between 0 and 100. image

dshokouhi commented 10 months ago

If you have a chance, could you please try filling it and seeing what the level says? It might go above 100%. The "raw_liquid_value" value under "attributes" might be more helpful than the percentage if it doesn't work. The mug/cup seem to output between 0 and 30 and the Travel mug is between 0 and 100.

just tried it and neither state nor liquid level update, I dont see any HA core errors. I do see the battery plugged status changing when I take it on and off the charger. The attributes for liquid level did not change either

2023-12-26 13:16:05.591 DEBUG (MainThread) [custom_components.ember_mug.coordinator] Updating
2023-12-26 13:16:05.591 DEBUG (MainThread) [ember_mug.mug] Updating the following attributes: {'current_temp', 'temperature_unit', 'led_colour', 'liquid_state', 'battery', 'target_temp', 'liquid_level'}
2023-12-26 13:16:05.949 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540002-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'g\x14')'
2023-12-26 13:16:06.343 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540004-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x01')'
2023-12-26 13:16:06.771 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540014-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x00\xf3\xff\xff')'
2023-12-26 13:16:07.953 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540008-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x01')'
2023-12-26 13:16:08.362 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540007-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'd\x00s\t\x00\x00\x00\x00')'
2023-12-26 13:16:09.181 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540003-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'Y\x16')'
2023-12-26 13:16:09.590 DEBUG (MainThread) [ember_mug.mug] Read attribute 'fc540005-236c-4c94-8fa9-944a3e5353fa' with value 'bytearray(b'\x11')'
2023-12-26 13:16:09.590 DEBUG (MainThread) [ember_mug.mug] Attributes updated: []
2023-12-26 13:16:09.590 DEBUG (MainThread) [custom_components.ember_mug.coordinator] [Full Update] Changed: []
2023-12-26 13:16:09.590 DEBUG (MainThread) [custom_components.ember_mug] Finished fetching ember-tumbler-f29c65df6e3a data in 3.999 seconds (success: True)

I filled it up about 5 minutes ago

image

dshokouhi commented 10 months ago

ok looks like I should test with HOT water instead of COLD water 😂

image

the state entity also updated in a strange way but I guess thats the date the mug is giving. Have seen empty > filing > cooling > empty > heating

sopelj commented 10 months ago

Oh perfect. Ok, it is 30 as well. That's great thanks! Yeah, it sometimes goes through some different states. That is what the device reports though.

dshokouhi commented 10 months ago

thank you so much for all the hard work :) please feel free to close this issue as its now resolved

sopelj commented 10 months ago

Thanks! I really appreciate your help in testing this and providing the necessary information. I'll leave this in beta for a week or so, in case there are issues introduced with other devices. But I'll close the issue. But, please feel free if you see any other issues or have any suggestions. Thanks again!