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

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 »

Can you additionally run the below, should fix the warnings

sudo pip install requests[security]

EDIT:

Think the date stamp itself does not have an issue but only how the update info is printed onto the screen... it does not show the whole line .. will look into that as well why you have this. For now you can add --quiet

What program do you use to telnet/ssh your machine? If on windows I recommend putty

http://www.chiark.greenend.org.uk/~sgta ... nload.html
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:Can you additionally run the below, should fix the warnings

sudo pip install requests[security]

EDIT:

Think the date stamp itself does not have an issue but only how the update info is printed onto the screen... it does not show the whole line .. will look into that as well why you have this. For now you can add --quiet

What program do you use to telnet/ssh your machine? If on windows I recommend putty

http://www.chiark.greenend.org.uk/~sgta ... nload.html
I'm currently using just the terminal in OSX although I've also installed iTerm. But yes now when looking more carefully I can see that the line goes "behind" the terminal window so all's good in that sense I suppose :)

Tried to install requests[security] but that did not go so well:

Code: Select all

pi@raspberrypi ~ $ sudo pip install requests[security]
Requirement already satisfied (use --upgrade to upgrade): requests[security] in /usr/local/lib/python2.7/dist-packages
  Installing extra requirements: 'security'
Downloading/unpacking pyOpenSSL>=0.13 (from requests[security])
  Downloading pyOpenSSL-0.15.1.tar.gz (149Kb): 149Kb downloaded
  Running setup.py egg_info for package pyOpenSSL
    
    warning: no files found matching 'OpenSSL/RATIONALE'
    warning: no previously-included files found matching 'leakcheck'
    warning: no previously-included files matching '*.py' found under directory 'leakcheck'
    warning: no previously-included files matching '*.pem' found under directory 'leakcheck'
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    no previously-included directories found matching 'doc/_build'
Downloading/unpacking ndg-httpsclient (from requests[security])
  Downloading ndg_httpsclient-0.4.0.tar.gz
  Running setup.py egg_info for package ndg-httpsclient
    
Downloading/unpacking pyasn1 (from requests[security])
  Downloading pyasn1-0.1.9.tar.gz (75Kb): 75Kb downloaded
  Running setup.py egg_info for package pyasn1
    
Downloading/unpacking cryptography>=0.7 (from pyOpenSSL>=0.13->requests[security])
  Downloading cryptography-1.2.3.tar.gz (373Kb): 373Kb downloaded
  Running setup.py egg_info for package cryptography
    
    no previously-included directories found matching 'docs/_build'
    warning: no previously-included files matching '*' found under directory 'vectors'
Downloading/unpacking six>=1.5.2 (from pyOpenSSL>=0.13->requests[security])
  Downloading six-1.10.0.tar.gz
  Running setup.py egg_info for package six
    
    no previously-included directories found matching 'documentation/_build'
Downloading/unpacking idna>=2.0 (from cryptography>=0.7->pyOpenSSL>=0.13->requests[security])
  Downloading idna-2.0.tar.gz (135Kb): 135Kb downloaded
  Running setup.py egg_info for package idna
    
    warning: no previously-included files matching '*.pyc' found under directory 'tools'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
Requirement already satisfied (use --upgrade to upgrade): setuptools>=1.0 in /usr/local/lib/python2.7/dist-packages/setuptools-18.5-py2.7.egg (from cryptography>=0.7->pyOpenSSL>=0.13->requests[security])
Downloading/unpacking enum34 (from cryptography>=0.7->pyOpenSSL>=0.13->requests[security])
  Downloading enum34-1.1.2.tar.gz (46Kb): 46Kb downloaded
  Running setup.py egg_info for package enum34
    
Downloading/unpacking ipaddress (from cryptography>=0.7->pyOpenSSL>=0.13->requests[security])
  Downloading ipaddress-1.0.16.tar.gz
  Running setup.py egg_info for package ipaddress
    
Downloading/unpacking cffi>=1.4.1 (from cryptography>=0.7->pyOpenSSL>=0.13->requests[security])
  Downloading cffi-1.5.2.tar.gz (388Kb): 388Kb downloaded
  Running setup.py egg_info for package cffi
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    
Downloading/unpacking pycparser (from cffi>=1.4.1->cryptography>=0.7->pyOpenSSL>=0.13->requests[security])
  Downloading pycparser-2.14.tar.gz (223Kb): 223Kb downloaded
  Running setup.py egg_info for package pycparser
    
    warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
    warning: no previously-included files matching 'lextab.*' found under directory 'tests'
    warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
    warning: no previously-included files matching 'lextab.*' found under directory 'examples'
Installing collected packages: pyOpenSSL, ndg-httpsclient, pyasn1, cryptography, six, idna, enum34, ipaddress, cffi, pycparser
  Running setup.py install for pyOpenSSL
    
    warning: no files found matching 'OpenSSL/RATIONALE'
    warning: no previously-included files found matching 'leakcheck'
    warning: no previously-included files matching '*.py' found under directory 'leakcheck'
    warning: no previously-included files matching '*.pem' found under directory 'leakcheck'
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    no previously-included directories found matching 'doc/_build'
  Running setup.py install for ndg-httpsclient
    Skipping installation of /usr/local/lib/python2.7/dist-packages/ndg/__init__.py (namespace package)
    
    Installing /usr/local/lib/python2.7/dist-packages/ndg_httpsclient-0.4.0-py2.7-nspkg.pth
    Installing ndg_httpclient script to /usr/local/bin
  Running setup.py install for pyasn1
    
  Running setup.py install for cryptography
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
    compilation terminated.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/pi/build/cryptography/setup.py", line 335, in <module>
        **keywords_with_side_effects(sys.argv)
      File "/usr/lib/python2.7/distutils/core.py", line 112, in setup
        _setup_distribution = dist = klass(attrs)
      File "build/bdist.linux-armv7l/egg/setuptools/dist.py", line 268, in __init__
      File "build/bdist.linux-armv7l/egg/setuptools/dist.py", line 313, in fetch_build_eggs
      File "build/bdist.linux-armv7l/egg/pkg_resources/__init__.py", line 843, in resolve
      File "build/bdist.linux-armv7l/egg/pkg_resources/__init__.py", line 1088, in best_match
      File "build/bdist.linux-armv7l/egg/pkg_resources/__init__.py", line 1100, in obtain
      File "build/bdist.linux-armv7l/egg/setuptools/dist.py", line 380, in fetch_build_egg
      File "build/bdist.linux-armv7l/egg/setuptools/command/easy_install.py", line 638, in easy_install
    
      File "build/bdist.linux-armv7l/egg/setuptools/command/easy_install.py", line 668, in install_item
    
      File "build/bdist.linux-armv7l/egg/setuptools/command/easy_install.py", line 851, in install_eggs
    
      File "build/bdist.linux-armv7l/egg/setuptools/command/easy_install.py", line 1079, in build_and_install
    
      File "build/bdist.linux-armv7l/egg/setuptools/command/easy_install.py", line 1067, in run_setup
    
    distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/home/pi/build/cryptography/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-UhIkJp-record/install-record.txt:
    Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory

compilation terminated.

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/home/pi/build/cryptography/setup.py", line 335, in <module>

    **keywords_with_side_effects(sys.argv)

  File "/usr/lib/python2.7/distutils/core.py", line 112, in setup

    _setup_distribution = dist = klass(attrs)

  File "build/bdist.linux-armv7l/egg/setuptools/dist.py", line 268, in __init__

  File "build/bdist.linux-armv7l/egg/setuptools/dist.py", line 313, in fetch_build_eggs

  File "build/bdist.linux-armv7l/egg/pkg_resources/__init__.py", line 843, in resolve

  File "build/bdist.linux-armv7l/egg/pkg_resources/__init__.py", line 1088, in best_match

  File "build/bdist.linux-armv7l/egg/pkg_resources/__init__.py", line 1100, in obtain

  File "build/bdist.linux-armv7l/egg/setuptools/dist.py", line 380, in fetch_build_egg

  File "build/bdist.linux-armv7l/egg/setuptools/command/easy_install.py", line 638, in easy_install



  File "build/bdist.linux-armv7l/egg/setuptools/command/easy_install.py", line 668, in install_item



  File "build/bdist.linux-armv7l/egg/setuptools/command/easy_install.py", line 851, in install_eggs



  File "build/bdist.linux-armv7l/egg/setuptools/command/easy_install.py", line 1079, in build_and_install



  File "build/bdist.linux-armv7l/egg/setuptools/command/easy_install.py", line 1067, in run_setup



distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1

----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/home/pi/build/cryptography/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-UhIkJp-record/install-record.txt failed with error code 1 in /home/pi/build/cryptography
Storing complete log in /root/.pip/pip.log
Based on short googling I guess I'd need python 2.7.9. (now 2.7.3)? But with the warning I can surely live with...:)
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 »

Just to understand the logic a bit better a couple of further questions :)

1. The script checks the timestamp of last value in db and only checks new data logged after this time? But the furthest the scripts will look for values is from the past 24 hours? Could this be somehow (temporarily) extended (maybe even a new switch for number of days to be used with the initial run, for loading some history)?
2. Is there something I could do to get the sensors to show the last value from db as the current? Now I only get the initial (0) value and the "Last seen" also shows just the create date.
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 »

Add the options --remove --full

This will fill the 24 hour graph as it normally does but also download the whole history, calculate the daily min/max/avg and add those to a different table which fills the yearly/monthly graph. You should only need to do this once, going forward just schedule a daily run of the script without these additional options. Domoticz itself will fill the history based on the info from the 24h graph.

I also added option --warning to the script with which should suppress the urllib3/SSL warnings

To avoid lines being cut check in iTerm the default window size in rows and columns. The setting can be found in iTerm > Preferences > Profiles > Window. Set it to at least 160 columns.

Hope this helps :)
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:Add the options --remove --full

This will fill the 24 hour graph as it normally does but also download the whole history, calculate the daily min/max/avg and add those to a different table which fills the yearly/monthly graph. You should only need to do this once, going forward just schedule a daily run of the script without these additional options. Domoticz itself will fill the history based on the info from the 24h graph.

I also added option --warning to the script with which should suppress the urllib3/SSL warnings

To avoid lines being cut check in iTerm the default window size in rows and columns. The setting can be found in iTerm > Preferences > Profiles > Window. Set it to at least 160 columns.

Hope this helps :)
Ah, so that was the purpose of "--remove --full" - I somehow thought it was just for some sort of "reset" to start over after significant changes. But yes, this worked out fine and I have now some history as well, warnings also suppressed now. Only very minor downside was that I had a couple of days of short log but that was now replaced by the last 24 hours (I have setup my short log to 3 days). Anyhow, nothing interesting lost there and soon it would've been cleared anyhow :)

Thanks a lot!

Btw, do you have the sensors showing the last value from db as the current? Mine just shows zero although the graph is there according to what is in the db...
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:
dynasticorpheus wrote:Add the options --remove --full

This will fill the 24 hour graph as it normally does but also download the whole history, calculate the daily min/max/avg and add those to a different table which fills the yearly/monthly graph. You should only need to do this once, going forward just schedule a daily run of the script without these additional options. Domoticz itself will fill the history based on the info from the 24h graph.

I also added option --warning to the script with which should suppress the urllib3/SSL warnings

To avoid lines being cut check in iTerm the default window size in rows and columns. The setting can be found in iTerm > Preferences > Profiles > Window. Set it to at least 160 columns.

Hope this helps :)
Ah, so that was the purpose of "--remove --full" - I somehow thought it was just for some sort of "reset" to start over after significant changes. But yes, this worked out fine and I have now some history as well, warnings also suppressed now. Only very minor downside was that I had a couple of days of short log but that was now replaced by the last 24 hours (I have setup my short log to 3 days). Anyhow, nothing interesting lost there and soon it would've been cleared anyhow :)

Thanks a lot!

Btw, do you have the sensors showing the last value from db as the current? Mine just shows zero although the graph is there according to what is in the db...
Just did another update and added option --length which allows you to specify the number of days for the short log. Was not aware of this option in domoticz so good that you mentioned this!
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:
Just did another update and added option --length which allows you to specify the number of days for the short log. Was not aware of this option in domoticz so good that you mentioned this!
Great, thanks again!

I was thinking this sensor "current value / last seen" issue. If this is not just me, then maybe the script could be modified so that it takes the last value from Withings api and updates that with a json call to Domoticz? This would at least update the sensor as well. Although in this case the script should then check what is the second to last value (as the last value is when the script is run, not the last value available from Withings) in db and update after that - which sounds kinda stupid, I know :) But somehow it would be nice to get the sensor showing the last valid values as the current.
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:
dynasticorpheus wrote:
Just did another update and added option --length which allows you to specify the number of days for the short log. Was not aware of this option in domoticz so good that you mentioned this!
Great, thanks again!

I was thinking this sensor "current value / last seen" issue. If this is not just me, then maybe the script could be modified so that it takes the last value from Withings api and updates that with a json call to Domoticz? This would at least update the sensor as well. Although in this case the script should then check what is the second to last value (as the last value is when the script is run, not the last value available from Withings) in db and update after that - which sounds kinda stupid, I know :) But somehow it would be nice to get the sensor showing the last valid values as the current.
Let me investigate how we can have last seen match the last value from the Withings download as I also don't like it. JSON call to domoticz does not allow setting a date/time hence the reason why we are writing to the DB directly in the first place.

EDIT: It's just a matter of updating another table, will implement this asap.
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:
Let me investigate how we can have last seen match the last value from the Withings download as I also don't like it. JSON call to domoticz does not allow setting a date/time hence the reason why we are writing to the DB directly in the first place.

EDIT: It's just a matter of updating another table, will implement this asap.
Sounds great, thanks again! :)
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:
dynasticorpheus wrote:
Let me investigate how we can have last seen match the last value from the Withings download as I also don't like it. JSON call to domoticz does not allow setting a date/time hence the reason why we are writing to the DB directly in the first place.

EDIT: It's just a matter of updating another table, will implement this asap.
Sounds great, thanks again! :)
Updated version updates last seen and last value ... however the last value is not shown if more than a hour has passed. Running the script within an hour of the last update should solve this I guess.
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:
Updated version updates last seen and last value ... however the last value is not shown if more than a hour has passed. Running the script within an hour of the last update should solve this I guess.
Works for me at least! I scheduled the script to run once per hour as there does not seem to be consistent update times between the scale and the Withings service.
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 »

Nautilus wrote:
Works for me at least! I scheduled the script to run once per hour as there does not seem to be consistent update times between the scale and the Withings service.
Hmm, noticed something (potentially) strange. Last CO2 value in Withings service is recorded at 20:30. In Domoticz the chart shows logical values up to this point but there are also additional values coming after this time (equal to the value recorded at 20:30):
Screen Shot 2016-03-09 at 23.14.16.png
Screen Shot 2016-03-09 at 23.14.16.png (330.67 KiB) Viewed 4516 times
The script runs and xx:40 (each hour) and Domoticz is showing the the "extra" records from 21:40 to 22:30 and there is data recorded every five minutes during this interval. Any idea where this could be coming from? Sensor is currently showing last seen as 20:30 and value 0:
Screen Shot 2016-03-09 at 23.23.03.png
Screen Shot 2016-03-09 at 23.23.03.png (200.68 KiB) Viewed 4516 times
edit: upon closer look this has happened with all updates since the first (that worked fine) that was done with the latest script. It fills the graph with correct data up to the point of last value in Withings, then repeats this data on 5 min interval for roughly the next 1-2 hours.
manuloup
Posts: 31
Joined: Sunday 23 November 2014 16:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

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

Post by manuloup »

Hi,

I just installed and setup my withings ws-50 device. Now I'd like to integrate in my domoticz :
- my weight
- the temperature of the room
- the CO2 measure

I don't want this script to update the domoticz.db directly, I prefer to run some html json command for the update of the idx values. I would prefer to do it in ksh which is much easier for me. I know I can only parse the result from wbs.php to get the results, but I did not find how to get these results.

Any help would be appreciated.

Manu
Rapberry PI B+ (RaspBian), RFXtrx433E USB 433.92MHz Transceiver, AEON LABS Controler Z-Wave, Aeon Labs Z-Stick S2, Everspring ST814 Temperature Sensor, Everspring SF812 Smoke Detector, 2x Fibaro Wallplug, Aeon Zwave Miniremote , Xbee Teleinfo USB
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:
Nautilus wrote:
Works for me at least! I scheduled the script to run once per hour as there does not seem to be consistent update times between the scale and the Withings service.
Hmm, noticed something (potentially) strange. Last CO2 value in Withings service is recorded at 20:30. In Domoticz the chart shows logical values up to this point but there are also additional values coming after this time (equal to the value recorded at 20:30):
Screen Shot 2016-03-09 at 23.14.16.png
The script runs and xx:40 (each hour) and Domoticz is showing the the "extra" records from 21:40 to 22:30 and there is data recorded every five minutes during this interval. Any idea where this could be coming from? Sensor is currently showing last seen as 20:30 and value 0:
Screen Shot 2016-03-09 at 23.23.03.png
edit: upon closer look this has happened with all updates since the first (that worked fine) that was done with the latest script. It fills the graph with correct data up to the point of last value in Withings, then repeats this data on 5 min interval for roughly the next 1-2 hours.
I think is just the graph logic using last value until it get's updated again hence this get's automatically corrected once an update takes place which actually contains new measurements. Note that my scale only sends data after weighing and because I activated step count (I think) also during the night. So in total twice a day only which is a shame for us but for normal usage a smart thing to do as it is running on batteries :)
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 »

manuloup wrote:Hi,

I just installed and setup my withings ws-50 device. Now I'd like to integrate in my domoticz :
- my weight
- the temperature of the room
- the CO2 measure

I don't want this script to update the domoticz.db directly, I prefer to run some html json command for the update of the idx values. I would prefer to do it in ksh which is much easier for me. I know I can only parse the result from wbs.php to get the results, but I did not find how to get these results.

Any help would be appreciated.

Manu
Note that the scale only sends it data once or twice a day to the withing's server hence we doing retrospective updates and since JSON (at least for now) lacks the possibility to specify date/time per measurement we need to do direct DB writes. Never the preferred solution but that's all we can do atm I am afraid.

Don't know ksh but if it is anything like bash I wonder if you would ever be able to get it working due to it's limited functionality compared to python. Replicating authentication and data pulls in my script with curl would be the first thing to get sorted I guess?
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:
I think is just the graph logic using last value until it get's updated again hence this get's automatically corrected once an update takes place which actually contains new measurements. Note that my scale only sends data after weighing and because I activated step count (I think) also during the night. So in total twice a day only which is a shame for us but for normal usage a smart thing to do as it is running on batteries :)
Hi - I don't think it is just that. And in fact it seems that something got changed a few weeks ago, no idea what (daylight savings?) :) Now the graph is just populating a flat line and it almost looks as if there is the most recent value available to the "future" as it is generating this flat line at five minutes intervals starting from the last real update (which are 30 minutes apart) - if I run the script every hour. If I run it at longer intervals there is the "flat line" start 2:30 before the script is run and continues from there, not yet sure until how long (I'll check now). So currently I can only update it with --full --remove (which works still ok)...
zerounleashednl
Posts: 1
Joined: Sunday 12 June 2016 12:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by zerounleashednl »

Installed the script for the first time and running it successful (after installing PIP and the Request module).

DRY RUN 1:

Withings WS-50 Syncer Version 0.4.6

[-] Dry run mode enabled, no changes to the database will be made
[-] Attaching database domoticz.db [version 101]
[-] Authenticating at account.withings.com
[-] Downloading all measurements recorded after 2016-06-11 12:23:47 (1 day limit)
[-] Updating CO2 HOURLY table with 38 measurements [FALSE]
[-] Downloading all measurements recorded after 2016-06-11 12:23:47 (1 day limit)
[-] Updating TEMPERATURE HOURLY table with 38 measurements [FALSE]
[-] Nothing to commit, closing database

DRY RUN 2:

Withings WS-50 Syncer Version 0.4.6

[-] Dry run mode enabled, no changes to the database will be made
[-] Attaching database domoticz.db [version 101]
[-] Authenticating at account.withings.com
[-] Downloading all measurements recorded after 2016-06-12 12:25:04
[-] Updating CO2 HOURLY table with 0 measurements [FALSE]
[-] Downloading all measurements recorded after 2016-06-12 12:25:04
[-] Updating TEMPERATURE HOURLY table with 0 measurements [FALSE]
[-] Nothing to commit, closing database

ACTIVE RUN:

Withings WS-50 Syncer Version 0.4.6

[-] Attaching database /home/pi/domoticz/domoticz.db [version 101]
[-] Authenticating at account.withings.com
[-] Downloading all measurements recorded after 2016-06-12 12:40:02
[-] Updating CO2 HOURLY table with 0 measurements [TRUE]
[-] Downloading all measurements recorded after 2016-06-12 12:40:02
[-] Updating TEMPERATURE HOURLY table with 0 measurements [TRUE]
[-] Nothing to commit, closing database

So, in DRY RUN 1 it got 38 measurements, but the next few RUN's no measurements anymore...?
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 »

zerounleashednl wrote:Installed the script for the first time and running it successful (after installing PIP and the Request module).

DRY RUN 1:

Withings WS-50 Syncer Version 0.4.6

[-] Dry run mode enabled, no changes to the database will be made
[-] Attaching database domoticz.db [version 101]
[-] Authenticating at account.withings.com
[-] Downloading all measurements recorded after 2016-06-11 12:23:47 (1 day limit)
[-] Updating CO2 HOURLY table with 38 measurements [FALSE]
[-] Downloading all measurements recorded after 2016-06-11 12:23:47 (1 day limit)
[-] Updating TEMPERATURE HOURLY table with 38 measurements [FALSE]
[-] Nothing to commit, closing database

DRY RUN 2:

Withings WS-50 Syncer Version 0.4.6

[-] Dry run mode enabled, no changes to the database will be made
[-] Attaching database domoticz.db [version 101]
[-] Authenticating at account.withings.com
[-] Downloading all measurements recorded after 2016-06-12 12:25:04
[-] Updating CO2 HOURLY table with 0 measurements [FALSE]
[-] Downloading all measurements recorded after 2016-06-12 12:25:04
[-] Updating TEMPERATURE HOURLY table with 0 measurements [FALSE]
[-] Nothing to commit, closing database

ACTIVE RUN:

Withings WS-50 Syncer Version 0.4.6

[-] Attaching database /home/pi/domoticz/domoticz.db [version 101]
[-] Authenticating at account.withings.com
[-] Downloading all measurements recorded after 2016-06-12 12:40:02
[-] Updating CO2 HOURLY table with 0 measurements [TRUE]
[-] Downloading all measurements recorded after 2016-06-12 12:40:02
[-] Updating TEMPERATURE HOURLY table with 0 measurements [TRUE]
[-] Nothing to commit, closing database

So, in DRY RUN 1 it got 38 measurements, but the next few RUN's no measurements anymore...?
Is the script is the only one writing to the virtual device(s) ? Try to do a full update with first clearing the device by adding below two options:

Code: Select all

 --full --remove
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 »

Somehow I don't get any values. If I look at the date&time that doesn't surprise me. What am I doing wrong? I didn't install PIP. Is that a requirement?

Code: Select all

pi@domus:~/domoticz/scripts/python$ ls -la
total 32
drwxr-xr-x 2 pi pi  4096 Aug  1 01:14 .
drwxr-xr-x 7 pi pi  4096 Jun 27 09:57 ..
-rw-r--r-- 1 pi pi  3887 Jan 22  2016 domoticz.py
-rw-r--r-- 1 pi pi  1116 Jan 22  2016 reloader.py
-rw-r--r-- 1 pi pi  1206 Jan 22  2016 script_device_PIRsmarter.py
-rwxr-xr-x 1 pi pi 11553 Aug  1 01:15 ws50-sync.py
pi@domus:~/domoticz/scripts/python$ date
[color=#BF0000]Mon  1 Aug 11:56:01 CEST 2016[/color]
pi@domus:~/domoticz/scripts/python$ python ws50-sync.py -u [email protected] -p xxxxx -c 339 -t 340 -d /home/pi/domoticz/domoticz.db --full --remove

Withings WS-50 Syncer Version 0.4.6

[-] Attaching database /home/pi/domoticz/domoticz.db [version 101]
[-] Authenticating at account.withings.com
[-] Removing existing data from table METER
[-] [color=#BF0000]Downloading all measurements recorded after 2016-07-31 11:56:19[/color] (1 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 2016-07-31 11:56:19 (1 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
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 »

Actually I've tried follow these steps. But that didn't work and became bit messy.
dynasticorpheus wrote:
hmmm this really seems like a requests issue. Please try:

1) uninstall current version of requests: apt-get remove python-requests
2a) read pip install instructions https://pip.pypa.io/en/stable/installing
2b) download pip install file: wget https://bootstrap.pypa.io/get-pip.py
3) install pip: python get-pip.py
4) install requests: (sudo) pip install requests
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest