Git Product home page Git Product logo

Comments (18)

zweckj avatar zweckj commented on July 3, 2024

Hi,
I assume you already tried enabling/disabling the is_new_style scale during configuration?

If that doesn't help you would really need to dig into the client library unfortunately... pyacaia_async which itself is built on pyacaia. If pyacaia works but async doesn't you got a lead.
I suspect it has something to do with the notifications the library requests from the scale https://github.com/zweckj/pyacaia_async/blob/main/pyacaia_async/acaiascale.py#L168

The only thing I can offer is guidance, as I don't own such a scale 😔

from acaia.

jpaju avatar jpaju commented on July 3, 2024

Forgot to mention that I tried with the is_new_style selected and unselected with equal results.

I'm not too fluent with Python but I can take a look. I'll have the time probably in the weekend or next week.

Is there a API docs for the BLE communication somewhere or does it have to be reverse-engineered?

from acaia.

zweckj avatar zweckj commented on July 3, 2024

I'm not aware about any docs, but as I said, I would start with pyacaia as I suspect that that works and I only messed up the migration to pyacaia_async

from acaia.

jpaju avatar jpaju commented on July 3, 2024

Hi!

I tested the pyacaia_async library directly by configuring the MAC address in run.py and running the file. I had to use is_new_style_scale=False when creating the AcaiaClient. The example program in run.py was able to connect to the scale, read the weight, tare the scale and start/stop/restart the timer. I also made sure that the integration passes the MAC address and is_new_style_scale flag correctly to the AcaiaClient.

I tested this with both Windows and Mac, but unfortunately I have no linux machine available.

In my understanding this means that the issue is not in the pyacaia_async but maybe in the way that the integration uses the client? What are your thoughts on this?

from acaia.

zweckj avatar zweckj commented on July 3, 2024

Huh. Very interesting, never would have expected that...

I also made sure that the integration passes the MAC address and is_new_style_scale flag correctly to the AcaiaClient.

How did you do that?

from acaia.

jpaju avatar jpaju commented on July 3, 2024

I added logging statements in the python files located in the custom_components folder. Then from home assistant I enabled debug logging for the Acaia integration and checked the home assistant logs.

Do you have any ideas how to further fix the issue with the integration? I'd really like to get this integration working!

from acaia.

zweckj avatar zweckj commented on July 3, 2024

I see. I don't have any immediate ideas. The current pyacaia_async is more recent than the version shipped with HA. I published a beta release with the current version this morning, but didn't have time to test anything, so it might be broken in other places.

Otherwise I'll probably add some more logging statements in a next pyacaia_async version to better understand what the issue actually is. It looks like it's crashing when sending the callback function to the scale, but I got no idea as to why and only when it's done through HA.

from acaia.

zweckj avatar zweckj commented on July 3, 2024

v01.1b2 is still untested but should in theory have improved logging for your error.

from acaia.

darzism avatar darzism commented on July 3, 2024

Hi zweckj,
here is the log for initialization using b2:
2023-11-21 20:58:09.602 DEBUG (MainThread) [custom_components.acaia.coordinator] Update coordinator: Connecting...
2023-11-21 20:58:12.337 WARNING (MainThread) [custom_components.acaia.acaiaclient] Couldn't connect to device dScale with MAC 00:1C:97:1D:42:64
2023-11-21 20:58:12.337 DEBUG (MainThread) [custom_components.acaia.coordinator] Finished fetching Acaia API coordinator data in 2.735 seconds (success: True)

It now connects when selecting not new model, and it shows its connected but no functionality and the scale did indicate bluetooth connection for a moment but then turned off.

from acaia.

darzism avatar darzism commented on July 3, 2024

Quick update, it is partially working.
HA Status continues to indicate connected
Scale Bluetooth connection indicates connected this time
Tare works fine
Weight was displayed once, but didn't update again.
Start/stop/reset timer caused error
Timer status = not running

Log below

2023-11-22 08:42:19.604 DEBUG (MainThread) [custom_components.acaia.coordinator] Finished fetching Acaia API coordinator data in 0.000 seconds (success: True) 2023-11-22 08:42:30.831 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547063247296] 'AcaiaClient' object has no attribute 'startStopTimer' Traceback (most recent call last): File
"/usr/src/homeassistant/homeassistant/components/websocket_api/commands.p y", line 230, in handle_call_service await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 2035, in async_call
response_data = await coro ^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2072, in _execute_service
return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 876, in entity_service_call
response_data = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call result = await task ^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/button/init.py", line 124, in _async_press_actionawait self.async_press() File "/config/custom_components/acaia/button.py", line 75, in async_press
await self.entity_description.async_press_fn(self._scale) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/acaia/button.py", line 50, in
async_press_fn=lambda scale: scale.startStopTimer(), ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'AcaiaClient' object has no attribute 'startStopTimer' 2023-11-22 08:42:39.960 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547063247296] 'AcaiaClient' object has no attribute 'startStopTimer' Traceback (most recent call last): File
"/usr/src/homeassistant/homeassistant/components/websocket_api/commands.p y", line 230, in handle_call_service await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 2035, in async_call
response_data = await coro ^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2072, in _execute_service
return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 876, in entity_service_call
response_data = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call result = await task ^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/button/init.py", line 124, in _async_press_action await self.async_press()

from acaia.

zweckj avatar zweckj commented on July 3, 2024

@darzism that one is on me, that should be gone in latest beta

from acaia.

darzism avatar darzism commented on July 3, 2024

Thanks @zweckj! Looking better, now timer functions work. But still not getting weight or battery status. Log below of initial setup and button tests, seems like no issues there.

2023-11-23 12:32:43.463 DEBUG (MainThread) [custom_components.acaia.acaiaclient] Initializing AcaiaClient with name dScale and MAC 00:1C:97:1D:42:64
2023-11-23 12:32:43.463 DEBUG (MainThread) [custom_components.acaia.acaiaclient] Is new style scale: False
2023-11-23 12:32:43.464 DEBUG (MainThread) [custom_components.acaia.coordinator] Update coordinator: Connecting
2023-11-23 12:32:43.974 DEBUG (MainThread) [custom_components.acaia.coordinator] Finished fetching Acaia API coordinator data in 0.511 seconds (success: True)

from acaia.

jpaju avatar jpaju commented on July 3, 2024

I updated the integration to the latest commit and it worked! 🙏🏼 I played around a bit and found couple of (possible) issues:

  1. If the timer is stopped by pressing the button on the scales, it is not shown in home assistant.
  2. The battery percentage shows always 0%

from acaia.

zweckj avatar zweckj commented on July 3, 2024
1. If the timer is stopped by pressing the button on the scales, it is not shown in home assistant.

I'm currently not tracking any changes cmoming from the scale regarding timer running

2. The battery percentage shows always 0%

True, that should be fixed with the latest release.

from acaia.

darzism avatar darzism commented on July 3, 2024

For Lunar 2020, I am now getting some weight readings (see screenshot) , but it's quite irregular.
And battery is "unknown"
Screenshot_20231128_215831_Home Assistant

from acaia.

jpaju avatar jpaju commented on July 3, 2024

I can confirm that the battery level is now reported correctly for me as well! Obviously no value is reported when the scales is offline though. What is the situation with reporting the timer value?

from acaia.

zweckj avatar zweckj commented on July 3, 2024

What is the situation with reporting the timer value?

Limited time on my side. It works (although it feels a bit flakey) in b5.

from acaia.

jpaju avatar jpaju commented on July 3, 2024

Huge thanks for making this happen!! 🥳

from acaia.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.