Withings WS-50 Scale Syncer - Temperature & CO2

In this subforum you can show projects you have made, or you are busy with. Please create your own topic.

Moderator: leecollings

Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Withings WS-50 Scale Syncer - Temperature & CO2

Post by Derik »

kick....

dear all..
Does some have the weigt options implement in Domoticz...
The temp and co is nice, only the scale is what i mis..
There is a api..
http://oauth.withings.com/api/doc

Only i do not understand a &^%&^of all that data....

Looks that this nice hardware have more potention in domoticz..
My wife weight rising....
Eveyday a mail to ... you are to,,,,,
when she lost some weight, send a mail, good job love..

Some one?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Withings WS-50 Scale Syncer - Temperature & CO2

Post by Nautilus »

Any idea what changed in the api around 31.1.2017? Now getting just:

Code: Select all

Withings WS-50 Syncer Version 0.4.6

[-] Attaching database /home/pi/domoticz/domoticz.db [version 110]
[-] Authenticating at account.withings.com
HTTP ERROR 500
I'll try to check it but if someone knows already...:)
dynasticorpheus
Posts: 115
Joined: Monday 12 October 2015 15:26
Target OS: Linux
Domoticz version: 2.3295
Location: NL
Contact:

Re: Withings WS-50 Scale Syncer - Temperature & CO2

Post by dynasticorpheus »

Nautilus wrote:Any idea what changed in the api around 31.1.2017? Now getting just:

Code: Select all

Withings WS-50 Syncer Version 0.4.6

[-] Attaching database /home/pi/domoticz/domoticz.db [version 110]
[-] Authenticating at account.withings.com
HTTP ERROR 500
I'll try to check it but if someone knows already...:)

They implemented protection against cross-site request forgery (CSRF) hence a csrf_token needed to be added to the authentication request. Should be fixed through latest commit dd74fce. Please confirm this is also working on your end.
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Withings WS-50 Scale Syncer - Temperature & CO2

Post by Nautilus »

Indeed it works, thanks a lot! :)

edit: for reference to others, I first ran:

Code: Select all

sudo apt-get install libxml2-dev libxslt-dev python-dev
sudo pip install lxml
Last edited by Nautilus on Friday 10 February 2017 12:31, edited 1 time in total.
dynasticorpheus
Posts: 115
Joined: Monday 12 October 2015 15:26
Target OS: Linux
Domoticz version: 2.3295
Location: NL
Contact:

Re: Withings WS-50 Scale Syncer - Temperature & CO2

Post by dynasticorpheus »

Nautilus wrote:Indeed it works, thanks a lot! :)

edit: for reference to others, I first run

Code: Select all

sudo apt-get install libxml2-dev libxslt-dev python-dev
sudo pip install lxml
I added a requirements.txt file to repository to clarify the required depandancies ;)
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Withings WS-50 Scale Syncer - Temperature & CO2

Post by Derik »

Dear all.

Is there somebody that have the weight working in Domoticz....
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Withings WS-50 Scale Syncer - Temperature & CO2

Post by Nautilus »

Derik wrote:Dear all.

Is there somebody that have the weight working in Domoticz....
I think there was someone here who had a working IFTTT example on how to update the weights. See viewtopic.php?f=38&t=9482&p=74115&hilit ... ttt#p66051
dynasticorpheus
Posts: 115
Joined: Monday 12 October 2015 15:26
Target OS: Linux
Domoticz version: 2.3295
Location: NL
Contact:

Re: Withings WS-50 Scale Syncer - Temperature & CO2

Post by dynasticorpheus »

Code has been updated and is now working again after Withings became part of the Nokia company.
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Withings WS-50 Scale Syncer - Temperature & CO2

Post by Derik »

Thanks...

Only is there perhaps a option to read the weight of the scale??
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Withings WS-50 Scale Syncer - Temperature & CO2

Post by Nautilus »

dynasticorpheus wrote:Code has been updated and is now working again after Withings became part of the Nokia company.
Works great, thanks! :D
User avatar
felix63
Posts: 244
Joined: Monday 07 December 2015 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Gouda
Contact:

Re: Withings WS-50 Scale Syncer - Temperature & CO2

Post by felix63 »

Hi,

I thought to give it another try. Still not getting any data. Request has been (re)installed. Would you have any other suggestions?
Spoiler: show
pi@viola:~ $ sudo pip install requests --upgrade
Downloading/unpacking requests from https://files.pythonhosted.org/packages ... 193a40a38b
Downloading requests-2.18.4-py2.py3-none-any.whl (88kB): 88kB downloaded
Downloading/unpacking certifi>=2017.4.17 (from requests)
Downloading certifi-2018.4.16-py2.py3-none-any.whl (150kB): 150kB downloaded
Downloading/unpacking idna>=2.5,<2.7 (from requests)
Downloading idna-2.6-py2.py3-none-any.whl (56kB): 56kB downloaded
Downloading/unpacking chardet>=3.0.2,<3.1.0 (from requests)
Downloading chardet-3.0.4-py2.py3-none-any.whl (133kB): 133kB downloaded
Downloading/unpacking urllib3>=1.21.1,<1.23 (from requests)
Downloading urllib3-1.22-py2.py3-none-any.whl (132kB): 132kB downloaded
Installing collected packages: requests, certifi, idna, chardet, urllib3
Found existing installation: requests 2.4.3
Not uninstalling requests at /usr/lib/python2.7/dist-packages, owned by OS
Found existing installation: chardet 2.3.0
Not uninstalling chardet at /usr/lib/python2.7/dist-packages, owned by OS
Found existing installation: urllib3 1.9.1
Not uninstalling urllib3 at /usr/lib/python2.7/dist-packages, owned by OS
Successfully installed requests certifi idna chardet urllib3
Cleaning up...
but running the script still yields no results:

Code: Select all

pi@viola:~/domoticz/scripts/python $ ./ws50-sync.py -u [email protected] -p yyyyyyy -d /home/pi/domoticz/domoticz.db -t 441 -c 440 -l 7 -f -r

Withings WS-50 Syncer Version 0.4.9

[-] Attaching database /home/pi/domoticz/domoticz.db [version 118]
[-] Authenticating at scalews.withings.net
[-] Removing existing data from table METER
[-] Downloading all measurements recorded after 2018-04-14 17:43:47 (7 day limit)
[-] Updating CO2 HOURLY table with 0 measurements [TRUE]
[-] Removing existing data from table MULTIMETER_CALENDAR
[-] Updating CO2 YEARLY table with 0 measurements [TRUE]
[-] Calculating daily MIN, MAX & AVG values
[-] Removing existing data from table TEMPERATURE
[-] Downloading all measurements recorded after 2018-04-14 17:43:47 (7 day limit)
[-] Updating TEMPERATURE HOURLY table with 0 measurements [TRUE]
[-] Removing existing data from table TEMPERATURE_CALENDAR
[-] Updating TEMPERATURE YEARLY table with 0 measurements [TRUE]
[-] Calculating daily MIN, MAX & AVG values
[-] Nothing to commit, closing database

pi@viola:~/domoticz/scripts/python $ 
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Withings WS-50 Scale Syncer - Temperature & CO2

Post by Nautilus »

dynasticorpheus wrote: Monday 03 July 2017 15:50 Code has been updated and is now working again after Withings became part of the Nokia company.
I guess they've done another change. I'm getting some authentication related errors:

Code: Select all

Withings WS-50 Syncer Version 0.4.8

[-] Dry run mode enabled, no changes to the database will be made
[-] Attaching database /home/pi/domoticz/domoticz.db [version 129]
From cffi callback <function _verify_callback at 0x75f09130>:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 309, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
Traceback (most recent call last):
  File "/home/pi/domoticz/scripts/ws50-sync.py", line 258, in <module>
    main()
  File "/home/pi/domoticz/scripts/ws50-sync.py", line 221, in main
    deviceid, sessionkey = authenticate_withings(args.username, args.password)
  File "/home/pi/domoticz/scripts/ws50-sync.py", line 125, in authenticate_withings
    requests.head(URL_USAGE, timeout=3, headers=HEADER, allow_redirects=True, verify=pem)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 98, in head
    return request('head', url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 506, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='goo.gl', port=443): Max retries exceeded with url: /z6NNlH (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))
It seems that at least Oauth1.0 is now deprecated (http://developer.health.nokia.com/oauth2/).
kimhav
Posts: 148
Joined: Tuesday 01 October 2013 8:31
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Sweden
Contact:

Re: Withings WS-50 Scale Syncer - Temperature & CO2

Post by kimhav »

dynasticorpheus wrote: Monday 03 July 2017 15:50Code has been updated and is now working again after Withings became part of the Nokia company.
Guess that we can expect this to change again as Nokia sold of the Withings section back to the founder again and that end of this year Withings will be fully separated once again.
kimhav
Posts: 148
Joined: Tuesday 01 October 2013 8:31
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Sweden
Contact:

Re: Withings WS-50 Scale Syncer - Temperature & CO2

Post by kimhav »

Derik wrote: Saturday 29 October 2016 10:35There is a api..http://oauth.withings.com/api/doc
Following notification is provided at the above API documentation page:

This documentation is deprecated.
The Health Mate API is now fully functional with OAuth 2.0 authentication protocol.
Therefore, the OAuth 1.0 process will no longer be supported beginning:
November 30, 2018
Please refer to the new documentation for migrating to OAuth 2.0.
Please have a look at our other important non-backward-compatible changes in our release note.
dynasticorpheus
Posts: 115
Joined: Monday 12 October 2015 15:26
Target OS: Linux
Domoticz version: 2.3295
Location: NL
Contact:

Re: Withings WS-50 Scale Syncer - Temperature & CO2

Post by dynasticorpheus »

A bit late to the party as I a moved over to Home Assistant. Just did a full update and it is still working for me so am I missing something? :? Please note I am not using their official API as they do not support the temperature / CO2 part. (Basically the main reason for building this script)

Code: Select all

Withings WS-50 Syncer Version 0.4.9

[-] Dry run mode enabled, no changes to the database will be made
[-] Attaching database /home/dynasticorpheus/x-tools/builds/domoticz-x64/domoticz.db [version 129]
[-] Authenticating at scalews.withings.net
[-] Removing existing data from table METER
[-] Downloading all measurements recorded after 2018-09-08 11:53:24 (1 day limit)
[-] Updating CO2 HOURLY table with 0 measurements [FALSE]
[-] Removing existing data from table MULTIMETER_CALENDAR
[-] Updating CO2 YEARLY table with 44707 measurements [FALSE]
[-] Calculating daily MIN, MAX & AVG values
[-] Removing existing data from table TEMPERATURE
[-] Downloading all measurements recorded after 2018-09-08 11:53:24 (1 day limit)
[-] Updating TEMPERATURE HOURLY table with 0 measurements [FALSE]
[-] Removing existing data from table TEMPERATURE_CALENDAR
[-] Updating TEMPERATURE YEARLY table with 44707 measurements [FALSE]
[-] Calculating daily MIN, MAX & AVG values
[-] Nothing to commit, closing database
Nautilus wrote: Tuesday 24 July 2018 23:42
dynasticorpheus wrote: Monday 03 July 2017 15:50 Code has been updated and is now working again after Withings became part of the Nokia company.
I guess they've done another change. I'm getting some authentication related errors:

Code: Select all

Withings WS-50 Syncer Version 0.4.8

[-] Dry run mode enabled, no changes to the database will be made
[-] Attaching database /home/pi/domoticz/domoticz.db [version 129]
From cffi callback <function _verify_callback at 0x75f09130>:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 309, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
Traceback (most recent call last):
  File "/home/pi/domoticz/scripts/ws50-sync.py", line 258, in <module>
    main()
  File "/home/pi/domoticz/scripts/ws50-sync.py", line 221, in main
    deviceid, sessionkey = authenticate_withings(args.username, args.password)
  File "/home/pi/domoticz/scripts/ws50-sync.py", line 125, in authenticate_withings
    requests.head(URL_USAGE, timeout=3, headers=HEADER, allow_redirects=True, verify=pem)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 98, in head
    return request('head', url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 506, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='goo.gl', port=443): Max retries exceeded with url: /z6NNlH (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))
It seems that at least Oauth1.0 is now deprecated (http://developer.health.nokia.com/oauth2/).
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Withings WS-50 Scale Syncer - Temperature & CO2

Post by Nautilus »

dynasticorpheus wrote: Sunday 09 September 2018 11:57 A bit late to the party as I a moved over to Home Assistant. Just did a full update and it is still working for me so am I missing something? :? Please note I am not using their official API as they do not support the temperature / CO2 part. (Basically the main reason for building this script)

Indeed, works fine after switching to Python 3 :D Sorry for the false alarm...
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest