Adding Withing Scale via IFTTT

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

Moderator: leecollings

Post Reply
User avatar
felix63
Posts: 244
Joined: Monday 07 December 2015 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Gouda
Contact:

Adding Withing Scale via IFTTT

Post by felix63 »

Although Withing has an API making the data from the scale available I found the following very simple yet effective.

Make a virtual sensor with type scale:

Code: Select all

http://IPADDRESS:8080/json.htm?type=createvirtualsensor&idx=29&sensortype=93
Make a recipe (replace IP address, user, password and idx):

IF Withings New Body Scale measurement by user THEN Maker Make a web request.

URL:

Code: Select all

http://user:password@EXTERNALIP:8080/json.htm?type=command&param=udevice&idx=100&nvalue=0&svalue={{WeightKg}}
METHODE: get
TYPE: application/json
BODY: empty

Every time I step on the scale (with a significant delay, but who cares) the script is triggered and the sensor is updated.

Enjoy..
Last edited by felix63 on Friday 01 January 2016 12:57, edited 1 time in total.
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Adding Withing Scale via IFTTT

Post by Derik »

mmm great news have a scale to...
Only i do have 1 login....
For multiple user?


Please some more info?
I do not understand your methode?

Where do i have to place ....
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
dynasticorpheus
Posts: 115
Joined: Monday 12 October 2015 15:26
Target OS: Linux
Domoticz version: 2.3295
Location: NL
Contact:

Re: Adding Withing Scale via IFTTT

Post by dynasticorpheus »

I have been working on a Python script which pulls the CO2 and temperature data from the Withings site (not available through official api) and commits it directly to the Domoticz DB so original date/time is kept. Note that due to way the scale syncs its data there is a minimal delay of 14 hours. WS-50 only.

If anyone is interested let me know so I can refine the script a bit for wider use.

/Dynasticorpheus

Image
djgodlike
Posts: 32
Joined: Wednesday 27 January 2016 16:37
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Adding Withing Scale via IFTTT

Post by djgodlike »

dynasticorpheus wrote:I have been working on a Python script which pulls the CO2 and temperature data from the Withings site (not available through official api) and commits it directly to the Domoticz DB so original date/time is kept. Note that due to way the scale syncs its data there is a minimal delay of 14 hours. WS-50 only.

If anyone is interested let me know so I can refine the script a bit for wider use.

/Dynasticorpheus
Hi Dynasticorpheus,

I'm seriously interested in a python script for Air quality and weight.
Thanks! Keep up the good work!

Wouter
Aeon Labs Gen5 USB
Greenwave Powernode 6 NS310
2x Greenwave Powernode 1 NS310
Philips Hue
Logitech media Server
Plugwise Smile P1
alexando
Posts: 1
Joined: Thursday 28 January 2016 20:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Contact:

Re: Adding Withing Scale via IFTTT

Post by alexando »

dynasticorpheus - I'd appreciate getting getting some more details on your script, can you PM me?
javaboon
Posts: 1
Joined: Friday 29 January 2016 23:42
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Adding Withing Scale via IFTTT

Post by javaboon »

I would love the script also :-)
dynasticorpheus
Posts: 115
Joined: Monday 12 October 2015 15:26
Target OS: Linux
Domoticz version: 2.3295
Location: NL
Contact:

Re: Adding Withing Scale via IFTTT

Post by dynasticorpheus »

Ok let me work on it a bit more and make it suited for wider usage. Will report back.
dynasticorpheus
Posts: 115
Joined: Monday 12 October 2015 15:26
Target OS: Linux
Domoticz version: 2.3295
Location: NL
Contact:

Re: Adding Withing Scale via IFTTT

Post by dynasticorpheus »

The first version of the script is now available via github, let me know if it also works for you guys. Be smart and make a backup of your DB before doing anything else first!

As we are writing to the DB directly note that any issues from this should not be addressed to the domoticz devs!

There is a --noaction option which allows for a dry-run to confirm if everything works as expected before doing any actual update to the DB. I would also recommend to do the initial update (potentially a lot of data hence blocking the DB for other writes) whilst domoticz is not running.


https://github.com/dynasticorpheus/ws50-sync

Code: Select all

Withings WS-50 Syncer by [email protected]

optional arguments:
  -h, --help            show this help message and exit
  -u USERNAME, --username USERNAME
                        username (email) in use with account.withings.com
  -p PASSWORD, --password PASSWORD
                        password in use with account.withings.com
  -c CO2, --co2 CO2     co2 idx
  -t TEMPERATURE, --temperature TEMPERATURE
                        temperature idx
  -d DATABASE, --database DATABASE
                        fully qualified name of database-file
  -n, --noaction        do not update database
djgodlike
Posts: 32
Joined: Wednesday 27 January 2016 16:37
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Adding Withing Scale via IFTTT

Post by djgodlike »

dynasticorpheus wrote:The first version of the script is now available via github, let me know if it also works for you guys. Be smart and make a backup of your DB before doing anything else first!

As we are writing to the DB directly note that any issues from this should not be addressed to the domoticz devs!

There is a --noaction option which allows for a dry-run to confirm if everything works as expected before doing any actual update to the DB. I would also recommend to do the initial update (potentially a lot of data hence blocking the DB for other writes) whilst domoticz is not running.


https://github.com/dynasticorpheus/ws50-sync

Code: Select all

Withings WS-50 Syncer by [email protected]

optional arguments:
  -h, --help            show this help message and exit
  -u USERNAME, --username USERNAME
                        username (email) in use with account.withings.com
  -p PASSWORD, --password PASSWORD
                        password in use with account.withings.com
  -c CO2, --co2 CO2     co2 idx
  -t TEMPERATURE, --temperature TEMPERATURE
                        temperature idx
  -d DATABASE, --database DATABASE
                        fully qualified name of database-file
  -n, --noaction        do not update database
Hi!

Thanks!!!
I'm trying to get it to work.
This is the output, is this normal?

DISKSTATION> /volume2/homes/admin/DomoticzScripts/ws50-sync.py -u ********* -p ********** -c 103 -t 104 -d /volume2/@appstore/domoticz/var/domoticz.db -n

Withings WS-50 Syncer Version 0.2.0

[-] Database /volume2/@appstore/domoticz/var/domoticz.db
[-] Authenticating at account.withings.com
[-] Downloading data newer than 2016-02-05 22:35:00
[-] Updating database with 0 CO2 measurements [FALSE]
[-] Updating database with 0 TEMPERATURE measurements [FALSE]

This was the first run with --noaction. Is it safe to run without -n? Sorry im kinda new :)
And what do you mean with the initial update?

Thanks for your work!
Aeon Labs Gen5 USB
Greenwave Powernode 6 NS310
2x Greenwave Powernode 1 NS310
Philips Hue
Logitech media Server
Plugwise Smile P1
dynasticorpheus
Posts: 115
Joined: Monday 12 October 2015 15:26
Target OS: Linux
Domoticz version: 2.3295
Location: NL
Contact:

Re: Adding Withing Scale via IFTTT

Post by dynasticorpheus »

With initial update I mean the first time you run it against the 2 (empty!) meters. As it cannot find any entries yet it will try to update the meter will all data available from the website. If successful, any run after that will only download data from the website that is not in the DB yet.

I would keep the --noaction until you get some sensible data before running it without this option however as long as it's updating with 0 measurements it still would not write to the DB anyway. Once you get more than 0 measurements you can remove the --noaction option.

Your output shows it is downloading data newer than 2016-02-05 22:35:00 so I wonder if the meters are cleared of all data before trying? My first suggestion would be to either clear the meters you are now using from all data or create 2 new ones.
djgodlike
Posts: 32
Joined: Wednesday 27 January 2016 16:37
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Adding Withing Scale via IFTTT

Post by djgodlike »

dynasticorpheus wrote:With initial update I mean the first time you run it against the 2 (empty!) meters. As it cannot find any entries yet it will try to update the meter will all data available from the website. If successful, any run after that will only download data from the website that is not in the DB yet.

I would keep the --noaction until you get some sensible data before running it without this option however as long as it's updating with 0 measurements it still would not write to the DB anyway. Once you get more than 0 measurements you can remove the --noaction option.

Your output shows it is downloading data newer than 2016-02-05 22:35:00 so I wonder if the meters are cleared of all data before trying? My first suggestion would be to either clear the meters you are now using from all data or create 2 new ones.
Sorry for my ignorance but by clearing the 2 meters, i assume you mean the virtual sensors in domoticz? I did not clear anything yet..
I did not have to change anything in the script itself, right?
Attachments
Screen Shot 2016-02-06 at 11.47.58.gif
Screen Shot 2016-02-06 at 11.47.58.gif (22.51 KiB) Viewed 5429 times
Aeon Labs Gen5 USB
Greenwave Powernode 6 NS310
2x Greenwave Powernode 1 NS310
Philips Hue
Logitech media Server
Plugwise Smile P1
dynasticorpheus
Posts: 115
Joined: Monday 12 October 2015 15:26
Target OS: Linux
Domoticz version: 2.3295
Location: NL
Contact:

Re: Adding Withing Scale via IFTTT

Post by dynasticorpheus »

djgodlike wrote:
dynasticorpheus wrote:With initial update I mean the first time you run it against the 2 (empty!) meters. As it cannot find any entries yet it will try to update the meter will all data available from the website. If successful, any run after that will only download data from the website that is not in the DB yet.

I would keep the --noaction until you get some sensible data before running it without this option however as long as it's updating with 0 measurements it still would not write to the DB anyway. Once you get more than 0 measurements you can remove the --noaction option.

Your output shows it is downloading data newer than 2016-02-05 22:35:00 so I wonder if the meters are cleared of all data before trying? My first suggestion would be to either clear the meters you are now using from all data or create 2 new ones.
Sorry for my ignorance but by clearing the 2 meters, i assume you mean the virtual sensors in domoticz? I did not clear anything yet..
I did not have to change anything in the script itself, right?
Virtual sensors indeed. Creating 2 new ones would be my recommendation.
dynasticorpheus
Posts: 115
Joined: Monday 12 October 2015 15:26
Target OS: Linux
Domoticz version: 2.3295
Location: NL
Contact:

Re: Adding Withing Scale via IFTTT

Post by dynasticorpheus »

I gave the script it's own thread viewtopic.php?f=38&t=10441
djgodlike
Posts: 32
Joined: Wednesday 27 January 2016 16:37
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Adding Withing Scale via IFTTT

Post by djgodlike »

I got some data on the air quality graph! It doesn't fill the temperature graph though..
Which results does it download? It downloaded data from 7-02-16 18:00 till 8-02-16 05:00.
Is it wise to make a cron script every 12 hours, or not in this stage yet?

Code: Select all

DISKSTATION> /volume2/homes/admin/DomoticzScripts/ws50-sync.py -u ********* -p ********** -c 103 -t 104 -d /volume2/@appstore/domoticz/var/domoticz.db -n

Withings WS-50 Syncer Version 0.2.0

[-] Database /volume2/@appstore/domoticz/var/domoticz.db
[-] Authenticating at account.withings.com
[-] Downloading data newer than 2016-02-07 09:45:00
[-] Updating database with 39 CO2 measurements [FALSE]
[-] Updating database with 39 TEMPERATURE measurements [FALSE]

DISKSTATION> /volume2/homes/admin/DomoticzScripts/ws50-sync.py -u -u ********* -p ********** -c 103 -t 104 -d /volume2/@appstore/domoticz/var/domoticz.db   

Withings WS-50 Syncer Version 0.2.0

[-] Database /volume2/@appstore/domoticz/var/domoticz.db
[-] Authenticating at account.withings.com
[-] Downloading data newer than 2016-02-07 09:45:00
[-] Updating database with 39 CO2 measurements [TRUE]
[-] Updating database with 39 TEMPERATURE measurements [TRUE]
[-] Committing and closing database
Thanks for working on this!!
Attachments
Screen Shot 2016-02-08 at 17.48.09.gif
Screen Shot 2016-02-08 at 17.48.09.gif (69.6 KiB) Viewed 5371 times
Aeon Labs Gen5 USB
Greenwave Powernode 6 NS310
2x Greenwave Powernode 1 NS310
Philips Hue
Logitech media Server
Plugwise Smile P1
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Adding Withing Scale via IFTTT

Post by Derik »

i will give it a next try...

Only where in domoticz can i ad a scale.??
Or what type of sensor i need?
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
manuloup
Posts: 31
Joined: Sunday 23 November 2014 16:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Adding Withing Scale via IFTTT

Post by manuloup »

Hi,

I just ordered a ws-50 today. I will give it a try too :)

Thanks,

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
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Adding Withing Scale via IFTTT

Post by Derik »

Please....
A Wiki....

I think there is something wrong...
I can not find a Scale type.....
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
dynasticorpheus
Posts: 115
Joined: Monday 12 October 2015 15:26
Target OS: Linux
Domoticz version: 2.3295
Location: NL
Contact:

Re: Adding Withing Scale via IFTTT

Post by dynasticorpheus »

Derik wrote:Please....
A Wiki....

I think there is something wrong...
I can not find a Scale type.....
Are you trying to use my script or IFTTT? For my script please go to this thread

viewtopic.php?f=38&t=10441
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Adding Withing Scale via IFTTT

Post by Derik »

dynasticorpheus wrote:
Derik wrote:Please....
A Wiki....

I think there is something wrong...
I can not find a Scale type.....
Are you trying to use my script or IFTTT? For my script please go to this thread

viewtopic.php?f=38&t=10441
MM

My first option was to add the weight....
The Co etc.. is my second..
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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest