Withings Scales


#1

Can this be done? Sorry, not sure if they have an open API or anything.


#2

There is not direct support but I use the IFTTT integration to step on the scale and then turn all the lights off at night. Works great.


#3

Yeah, I’ve tried using IFTTT but it just takes way too long and is very unreliable.


#4

Yeah … for me, since it just triggers my shutdown routine (good night events), then the timing doesn’t matter - as long as it eventually happens.

for direct support though, there definitely is an open API.


#5

I would be nice to have temperature and co2 from Withings.


#6

That’s true! Didn’t think of that. That would be great, actually. If your air quality is poor, then automatically send you a push notification? open a window? etc… Would be cool


#7

Last time when I went through their API, it didn’t look like it exposed air quality, temp etc. I’m not sure why they didn’t but I doubt it would be available :frowning:


#8

Oh no!!! Way to crush my dreams… :cry:


#9

I’m not sure if the scale transfers air quality measures immediately to cloud. So it might not work fast enough for controlling like a fan.
But it would be nice to get those measurements also to my database.


#10

The last reverse engineering of a Withings scale I saw was this to capture values: http://www.prolixium.com/mynews?id=915


#11

Hi All,

Here is my config and how I managed to script some scraping off the WS-50 for co2 and temperature sensors. I am no developer, so consider my scripts ‘hacky’ but it works!

Note:

  1. That I have a csv file called secrets.txt with my username and password in csv format.
  2. Ensure jq 1.5, some repos are a little behind. On my pi I had to manually compile 1.5 (pretty easy via the googles)

Hope that helps!

Scripts are here: https://github.com/jtscott/hass-config/tree/master/withings , check the sensors.yaml for the HA config.

Edit: I did also look into the actual withings developer API to do this first. I had to resort to scraping the user interface apis instead because the official developer APIs at this time only provide health/body information.


#12

What are the values in your secret.txt file?
I cant get it to work with:

email, password, email once more, mac-address of my scale


#13

my format is email,password,userid,deviceid. the userid and deviceid are two different 7 digit identifiers withings uses. Here is how I grabbed those using chrome:

  1. Open up a new chrome tab, and the developer tab (tools, more tools, developer settings)
  2. Click the ‘network’ tab
  3. Load up withings healthmate website, login
  4. watch for the “measure” POSTs to go by.
  5. The annoying part, find the right ‘measure’. Click each measure and look at the response tab. You need to find the right measure that returned the CO2 sensor data. It looks like
    {"status":0,"body":{"series":[{"type":12,"data":[{"date":1477128613,"value":24.4},{"date":1477126812,"value":24.4},{"date":1477125013,"value":24.4},{"date":1477123212,"value":24.4},{"date":1477121413,"value":24.5},{"date":1477119612,"value":24.5},{"date":1477117813,"value":24.5},{"date":1477116012,"value":24.5}]},{"type":35,"data":[{"date":1477128613,"value":545},{"date":1477126812,"value":545},{"date":1477125013,"value":576},{"date":1477123212,"value":542},{"date":1477121413,"value":565},{"date":1477119612,"value":575},{"date":1477117813,"value":552},{"date":1477116012,"value":614}]}]}}
  6. right click the measure, copy as curl (bash)
  7. paste into notepad, you should see your userid and deviceid at the end in the --data section
  8. worst case scenario, keep searching each of the POSTs, your userid will be in the ‘account’ post for sure.

Hope that helps!


#14

Thank you so much for your time and your effort!!

For others who want to read sensor values from their Withings as well here are some things I had to do:

  1. The user id in question is not the 8-digit number I reciecved when registering as a Withings developer at their site, but indeed a 7 digit number in the ‘account’ post mentioned in the post above. However it was listed as “accountid”, and not userid.

  2. Any jq version other than 1.5 will not work.
    I had some difficulty finding some clear instructions, so here is what worked for me in the end:

wget https://github.com/stedolan/jq/releases/download/jq-1.5/jq-1.5.tar.gz
tar -zxvf jq-1.5.tar.gz
rm jq-1.5.tar.gz
cd jq-1.5
./configure
make
sudo make install


#15

Yeah < jq 1.5 has a bug reading the value at the end of the array “[-1]” which is where the latest temperature (series 0) or co2 (series 1) measurement is:

.body.series[1].data[-1].value


#16

I get

17-03-05 17:11:49 ERROR (Thread-8) [homeassistant.components.sensor.command_line] Command failed: bash /withings/withings_battery.sh

How can i find out that the sh file is found and executed correctly?

Edit: now i know my files get executed but it seems that i can’t login correctly (i get a question for a cookie.txt-File). Mhmm… not easy to find out whats wrong with my secrets.txt…


#17

I tried userid and deviceid and as @ohjay93 mentioned above the accountid and deviceid. Same result. No cookies.txt and sensor state “null”.


#18

ok. found it. The Withings-login shouldn’t have any special characters. now it works. Thanks for your work.

For me it works with deviceid,accountid.

BTW: is there a way to force the scale to sync more often? Mine syncs only after measuring. But it would help me to get more data if it would do it once per hour or so…


#19

Remember that syncing more might take a toll on the battery of the scale.


#20

Has any more development gone into this integration?
It would be nice to hook up the scale :slight_smile: