Withings Scales

I’d love to help. If I could learn along the way (commented code would be appreciated) maybe I can help collaborate with this and finally learn some python basics. With a documented API it can’t be too hard.

OK great! This CC is a starting point but we need to address this issue first

@robmarkcole yes that’s right. I did see an email with the changes. I’ll have a look this weekend and see what I can figure out. Fell free to DM me as well

2 Likes

Any updates? It would be great to have sensors for the withings scales!

+1
Auth2 in HA is a challenge :frowning:

There has been a fork of the python-withings / nokia to include OAuth2 support https://github.com/orcasgit/python-nokia I don’t know if that makes it easier to support devices such as the Scales and Sleep into Home Assistant?

I am interested in the sleep product.

Hi all
Any success to integrate this withings component with HA ?
Cheers

Is it done ? Auth2 is there with release 1.1.0 ?
Thanks

Ok for me :slight_smile:

Any progress? I can try to help if needed. I own the scale.

I’d love to see this also since I own both the scale and sleep sensor. Both of these devices would significantly improve any bedtime / morning routines. For example turning off the lights when you get in bed at night, or requiring to step on the scale to start your morning routine. I have a bunch of neat ideas for automations.

I don’t know any programming but I’d be happy to help beta test this etc.

One issue I see now is Withings requirement for a functioning callback URL - so it might mean having to open home assistant up to the world to get access to the API.

This is broken for me on 0.88.1 any ideas ?

With the current implementation is it possible to access more than one user - I have more than one user in the withings account that I’d like to access?

Is this your pull request? It’s exciting to see this making progress!
https://github.com/home-assistant/home-assistant/pull/21625

I hope this does get added, looking forward to using it with my scales and sleep

3 Likes

Getting this error

Error while setting up platform withings
Traceback (most recent call last):
  File "/config/deps/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 330, in request
    http_method=method, body=data, headers=headers)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 198, in add_token
    raise TokenExpiredError()
oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired) 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/config/custom_components/withings/sensor.py", line 107, in async_setup_platform
    yield from _add_device(creds)
  File "/config/custom_components/withings/sensor.py", line 92, in _add_device
    withings = WithingsSensor(hass, client)
  File "/config/custom_components/withings/sensor.py", line 177, in __init__
    r = self._client.request('user', 'getdevice', version='v2')
  File "/config/deps/lib/python3.7/site-packages/nokia/__init__.py", line 202, in request
    r = self.client.request(method, '/'.join(url_parts), params=params)
  File "/config/deps/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 343, in request
    self.auto_refresh_url, auth=auth, **kwargs
  File "/config/deps/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 309, in refresh_token
    self.token = self._client.parse_request_body_response(r.text, scope=self.scope)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 415, in parse_request_body_response
    self.token = parse_token_response(body, scope=scope)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 425, in parse_token_response
    validate_token_parameters(params)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 435, in validate_token_parameters
    raise MissingTokenError(description="Missing access token parameter.")
oauthlib.oauth2.rfc6749.errors.MissingTokenError: (missing_token) Missing access token parameter.

Is the any news concerning Withings Scale integration. Where can I download Vangorra´s code to test?

He submitted some code for updated configuration flows a few days back. It looks like there are still a few bugs. You can check out his code at the github link above.

I can find the Github page but not the code. Can you direct me?