mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
32_withings: API endpoint changed back to Withings servers
git-svn-id: https://svn.fhem.de/fhem/trunk@17368 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
597c55f12c
commit
e9d9abb763
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||||
# Do not insert empty lines here, update check depends on it.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- change: 32_withings: API endpoint changed back to Withings servers
|
||||||
- bugfix: 93_DbLog: 3.12.0, SVG-select corrected
|
- bugfix: 93_DbLog: 3.12.0, SVG-select corrected
|
||||||
(forum.fhem.de/index.php/topic,65860.msg815640.html#msg815640)
|
(forum.fhem.de/index.php/topic,65860.msg815640.html#msg815640)
|
||||||
- bugfix: 88_HMCCU: Fixed device definition bug.
|
- bugfix: 88_HMCCU: Fixed device definition bug.
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
#
|
#
|
||||||
# 32_withings.pm
|
# 32_withings.pm
|
||||||
#
|
#
|
||||||
# 2017 Markus M.
|
# 2018 Markus M.
|
||||||
# Based on original code by justme1968
|
# Based on original code by justme1968
|
||||||
#
|
#
|
||||||
# https://forum.fhem.de/index.php/topic,64944.0.html
|
# https://forum.fhem.de/index.php/topic,64944.0.html
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Release 06 / 2018-09-13
|
# Release 07 / 2018-09-18
|
||||||
|
|
||||||
package main;
|
package main;
|
||||||
|
|
||||||
@ -386,7 +386,7 @@ sub withings_Define($$) {
|
|||||||
#CommandAttr(undef,"$name DbLogExclude .*");
|
#CommandAttr(undef,"$name DbLogExclude .*");
|
||||||
|
|
||||||
|
|
||||||
my $resolve = inet_aton("scalews.health.nokia.com");
|
my $resolve = inet_aton("scalews.withings.com");
|
||||||
if(!defined($resolve))
|
if(!defined($resolve))
|
||||||
{
|
{
|
||||||
$hash->{STATE} = "DNS error";
|
$hash->{STATE} = "DNS error";
|
||||||
@ -418,7 +418,7 @@ sub withings_InitWait($) {
|
|||||||
|
|
||||||
RemoveInternalTimer($hash);
|
RemoveInternalTimer($hash);
|
||||||
|
|
||||||
my $resolve = inet_aton("scalews.health.nokia.com");
|
my $resolve = inet_aton("scalews.withings.com");
|
||||||
if(!defined($resolve))
|
if(!defined($resolve))
|
||||||
{
|
{
|
||||||
$hash->{STATE} = "DNS error";
|
$hash->{STATE} = "DNS error";
|
||||||
@ -448,7 +448,7 @@ sub withings_Notify($$) {
|
|||||||
return if(!grep(m/^INITIALIZED|REREADCFG$/, @{$dev->{CHANGED}}));
|
return if(!grep(m/^INITIALIZED|REREADCFG$/, @{$dev->{CHANGED}}));
|
||||||
Log3 "withings", 5, "withings: notify";
|
Log3 "withings", 5, "withings: notify";
|
||||||
|
|
||||||
my $resolve = inet_aton("scalews.health.nokia.com");
|
my $resolve = inet_aton("scalews.withings.com");
|
||||||
if(!defined($resolve))
|
if(!defined($resolve))
|
||||||
{
|
{
|
||||||
$hash->{STATE} = "DNS error";
|
$hash->{STATE} = "DNS error";
|
||||||
@ -523,7 +523,7 @@ sub withings_getSessionKey($) {
|
|||||||
|
|
||||||
return if( $hash->{SessionKey} && $hash->{SessionTimestamp} && gettimeofday() - $hash->{SessionTimestamp} < (60*60*24*7-3600) );
|
return if( $hash->{SessionKey} && $hash->{SessionTimestamp} && gettimeofday() - $hash->{SessionTimestamp} < (60*60*24*7-3600) );
|
||||||
|
|
||||||
my $resolve = inet_aton("account.health.nokia.com");
|
my $resolve = inet_aton("account.withings.com");
|
||||||
if(!defined($resolve))
|
if(!defined($resolve))
|
||||||
{
|
{
|
||||||
$hash->{SessionTimestamp} = 0;
|
$hash->{SessionTimestamp} = 0;
|
||||||
@ -537,7 +537,7 @@ sub withings_getSessionKey($) {
|
|||||||
# if( !defined($hash->{helper}{appliver}) || !defined($hash->{helper}{csrf_token}) || !defined($hash->{SessionTimestamp}) || gettimeofday() - $hash->{SessionTimestamp} > (30*60) )#!defined($hash->{helper}{appliver}) || !defined($hash->{helper}{csrf_token}))
|
# if( !defined($hash->{helper}{appliver}) || !defined($hash->{helper}{csrf_token}) || !defined($hash->{SessionTimestamp}) || gettimeofday() - $hash->{SessionTimestamp} > (30*60) )#!defined($hash->{helper}{appliver}) || !defined($hash->{helper}{csrf_token}))
|
||||||
# {
|
# {
|
||||||
# my($err0,$data0) = HttpUtils_BlockingGet({
|
# my($err0,$data0) = HttpUtils_BlockingGet({
|
||||||
# url => $hash->{'.https'}."://scalews.health.nokia.com/",
|
# url => $hash->{'.https'}."://account.withings.com/",
|
||||||
# timeout => 10,
|
# timeout => 10,
|
||||||
# noshutdown => 1,
|
# noshutdown => 1,
|
||||||
# });
|
# });
|
||||||
@ -577,7 +577,7 @@ sub withings_getSessionKey($) {
|
|||||||
#$request->content($get_data);
|
#$request->content($get_data);
|
||||||
#my $response = $ua->request($request);
|
#my $response = $ua->request($request);
|
||||||
|
|
||||||
# $resolve = inet_aton("account.health.nokia.com");
|
# $resolve = inet_aton("account.withings.com");
|
||||||
# if(!defined($resolve))
|
# if(!defined($resolve))
|
||||||
# {
|
# {
|
||||||
# Log3 "withings", 1, "$name: DNS error on getSessionKey.";
|
# Log3 "withings", 1, "$name: DNS error on getSessionKey.";
|
||||||
@ -585,11 +585,11 @@ sub withings_getSessionKey($) {
|
|||||||
# }
|
# }
|
||||||
|
|
||||||
my $datahash = {
|
my $datahash = {
|
||||||
url => $hash->{'.https'}."://account.health.nokia.com/connectionwou/account_login?r=https://dashboard.health.nokia.com/",
|
url => $hash->{'.https'}."://account.withings.com/connectionwou/account_login?r=https://healthmate.withings.com/",
|
||||||
timeout => 10,
|
timeout => 10,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
ignoreredirects => 1,
|
ignoreredirects => 1,
|
||||||
data => { email=> withings_decrypt($hash->{helper}{username}), password => withings_decrypt($hash->{helper}{password}), is_admin => '' },
|
data => { email=> withings_decrypt($hash->{helper}{username}), password => withings_decrypt($hash->{helper}{password}), is_admin => 'f' },
|
||||||
};
|
};
|
||||||
|
|
||||||
my($err,$data) = HttpUtils_BlockingGet($datahash);
|
my($err,$data) = HttpUtils_BlockingGet($datahash);
|
||||||
@ -623,10 +623,10 @@ sub withings_getSessionKey($) {
|
|||||||
if( !$hash->{AccountID} || length($hash->{AccountID} < 2 ) ) {
|
if( !$hash->{AccountID} || length($hash->{AccountID} < 2 ) ) {
|
||||||
|
|
||||||
($err,$data) = HttpUtils_BlockingGet({
|
($err,$data) = HttpUtils_BlockingGet({
|
||||||
url => $hash->{'.https'}."://scalews.withings.com/index/service/account",
|
url => $hash->{'.https'}."://scalews.withings.com/cgi-bin/v2/account",
|
||||||
timeout => 10,
|
timeout => 10,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {sessionid => $hash->{SessionKey}, appname => 'my2', appliver=> $hash->{helper}{appliver}, apppfm => 'web', action => 'get'},
|
data => {sessionid => $hash->{SessionKey}, appname => 'my2', appliver=> $hash->{helper}{appliver}, apppfm => 'web', action => 'get', enrich => 't'},
|
||||||
});
|
});
|
||||||
return undef if(!defined($data));
|
return undef if(!defined($data));
|
||||||
|
|
||||||
@ -941,7 +941,7 @@ sub withings_getUsers($) {
|
|||||||
withings_getSessionKey($hash);
|
withings_getSessionKey($hash);
|
||||||
|
|
||||||
my ($err,$data) = HttpUtils_BlockingGet({
|
my ($err,$data) = HttpUtils_BlockingGet({
|
||||||
url => $hash->{'.https'}."://scalews.health.nokia.com/index/service/account",
|
url => $hash->{'.https'}."://scalews.withings.com/cgi-bin/account",
|
||||||
timeout => 10,
|
timeout => 10,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {sessionid => $hash->{SessionKey}, accountid => $hash->{AccountID} , recurse_use => '1', recurse_devtype => '1', listmask => '5', allusers => 't' , appname => 'my2', appliver=> $hash->{helper}{appliver}, apppfm => 'web', action => 'getuserslist'},
|
data => {sessionid => $hash->{SessionKey}, accountid => $hash->{AccountID} , recurse_use => '1', recurse_devtype => '1', listmask => '5', allusers => 't' , appname => 'my2', appliver=> $hash->{helper}{appliver}, apppfm => 'web', action => 'getuserslist'},
|
||||||
@ -989,7 +989,7 @@ sub withings_getDevices($) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
#my $ua = LWP::UserAgent->new;
|
#my $ua = LWP::UserAgent->new;
|
||||||
#my $request = HTTP::Request->new(POST => $hash->{'.https'}.'://healthmate.withings.com/index/service/association');
|
#my $request = HTTP::Request->new(POST => $hash->{'.https'}.'://scalews.withings.com/cgi-bin/association');
|
||||||
#my $get_data = 'sessionid='.$hash->{SessionKey}.'&accountid='.$hash->{AccountID}.'&type=-1&enrich=t&appname=my2&appliver='.$hash->{helper}{appliver}.'&apppfm=web&action=getbyaccountid';
|
#my $get_data = 'sessionid='.$hash->{SessionKey}.'&accountid='.$hash->{AccountID}.'&type=-1&enrich=t&appname=my2&appliver='.$hash->{helper}{appliver}.'&apppfm=web&action=getbyaccountid';
|
||||||
#$request->content($get_data);
|
#$request->content($get_data);
|
||||||
#my $response = $ua->request($request);
|
#my $response = $ua->request($request);
|
||||||
@ -1024,7 +1024,7 @@ sub withings_getDeviceDetail($) {
|
|||||||
withings_getSessionKey( $hash->{IODev} );
|
withings_getSessionKey( $hash->{IODev} );
|
||||||
|
|
||||||
my ($err,$data) = HttpUtils_BlockingGet({
|
my ($err,$data) = HttpUtils_BlockingGet({
|
||||||
url => $hash->{'.https'}."://scalews.health.nokia.com/index/service/device",
|
url => $hash->{'.https'}."://scalews.withings.com/cgi-bin/device",
|
||||||
timeout => 10,
|
timeout => 10,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {sessionid => $hash->{IODev}->{SessionKey}, deviceid => $hash->{Device} , appname => 'my2', appliver=> $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getproperties'},
|
data => {sessionid => $hash->{IODev}->{SessionKey}, deviceid => $hash->{Device} , appname => 'my2', appliver=> $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getproperties'},
|
||||||
@ -1072,7 +1072,7 @@ sub withings_getDeviceLink($) {
|
|||||||
withings_getSessionKey( $hash->{IODev} );
|
withings_getSessionKey( $hash->{IODev} );
|
||||||
|
|
||||||
my ($err,$data) = HttpUtils_BlockingGet({
|
my ($err,$data) = HttpUtils_BlockingGet({
|
||||||
url => $hash->{'.https'}."://scalews.health.nokia.com/cgi-bin/association",
|
url => $hash->{'.https'}."://scalews.withings.com/cgi-bin/association",
|
||||||
timeout => 10,
|
timeout => 10,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {sessionid => $hash->{IODev}->{SessionKey}, appname => 'hmw', appliver=> $hash->{IODev}->{helper}{appliver}, enrich => 't', action => 'getbyaccountid'},
|
data => {sessionid => $hash->{IODev}->{SessionKey}, appname => 'hmw', appliver=> $hash->{IODev}->{helper}{appliver}, enrich => 't', action => 'getbyaccountid'},
|
||||||
@ -1117,7 +1117,7 @@ sub withings_getDeviceProperties($) {
|
|||||||
withings_getSessionKey( $hash->{IODev} );
|
withings_getSessionKey( $hash->{IODev} );
|
||||||
|
|
||||||
HttpUtils_NonblockingGet({
|
HttpUtils_NonblockingGet({
|
||||||
url => "https://scalews.health.nokia.com/index/service/device",
|
url => "https://scalews.withings.com/cgi-bin/device",
|
||||||
timeout => 30,
|
timeout => 30,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {sessionid => $hash->{IODev}->{SessionKey}, deviceid=> $hash->{Device}, appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getproperties'},
|
data => {sessionid => $hash->{IODev}->{SessionKey}, deviceid=> $hash->{Device}, appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getproperties'},
|
||||||
@ -1153,7 +1153,7 @@ sub withings_getDeviceReadingsScale($) {
|
|||||||
$enddate = $now if ($enddate > $now);
|
$enddate = $now if ($enddate > $now);
|
||||||
|
|
||||||
HttpUtils_NonblockingGet({
|
HttpUtils_NonblockingGet({
|
||||||
url => "https://scalews.health.nokia.com/cgi-bin/v2/measure",
|
url => "https://scalews.withings.com/cgi-bin/v2/measure",
|
||||||
timeout => 30,
|
timeout => 30,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {sessionid => $hash->{IODev}->{SessionKey}, deviceid=> $hash->{Device}, meastype => '12,35', startdate => int($lastupdate), enddate => int($enddate), devicetype => '16', appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getmeashf'},
|
data => {sessionid => $hash->{IODev}->{SessionKey}, deviceid=> $hash->{Device}, meastype => '12,35', startdate => int($lastupdate), enddate => int($enddate), devicetype => '16', appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getmeashf'},
|
||||||
@ -1188,7 +1188,7 @@ sub withings_getDeviceReadingsBedside($) {
|
|||||||
$enddate = $now if ($enddate > $now);
|
$enddate = $now if ($enddate > $now);
|
||||||
|
|
||||||
HttpUtils_NonblockingGet({
|
HttpUtils_NonblockingGet({
|
||||||
url => "https://scalews.health.nokia.com/cgi-bin/v2/measure",
|
url => "https://scalews.withings.com/cgi-bin/v2/measure",
|
||||||
timeout => 30,
|
timeout => 30,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {sessionid => $hash->{IODev}->{SessionKey}, deviceid=> $hash->{Device}, meastype => '12,13,14,15,56', startdate => int($lastupdate), enddate => int($enddate), devicetype => '16', appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getmeashf'},
|
data => {sessionid => $hash->{IODev}->{SessionKey}, deviceid=> $hash->{Device}, meastype => '12,13,14,15,56', startdate => int($lastupdate), enddate => int($enddate), devicetype => '16', appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getmeashf'},
|
||||||
@ -1223,7 +1223,7 @@ sub withings_getDeviceReadingsHome($) {
|
|||||||
$enddate = $now if ($enddate > $now);
|
$enddate = $now if ($enddate > $now);
|
||||||
|
|
||||||
HttpUtils_NonblockingGet({
|
HttpUtils_NonblockingGet({
|
||||||
url => "https://scalews.health.nokia.com/cgi-bin/v2/measure",
|
url => "https://scalews.withings.com/cgi-bin/v2/measure",
|
||||||
timeout => 30,
|
timeout => 30,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {sessionid => $hash->{IODev}->{SessionKey}, deviceid=> $hash->{Device}, meastype => '12,13,14,15,58', startdate => int($lastupdate), enddate => int($enddate), devicetype => '16', appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getmeashf'},
|
data => {sessionid => $hash->{IODev}->{SessionKey}, deviceid=> $hash->{Device}, meastype => '12,13,14,15,58', startdate => int($lastupdate), enddate => int($enddate), devicetype => '16', appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getmeashf'},
|
||||||
@ -1257,7 +1257,7 @@ sub withings_getDeviceEventsBaby($) {
|
|||||||
|
|
||||||
|
|
||||||
HttpUtils_NonblockingGet({
|
HttpUtils_NonblockingGet({
|
||||||
url => "https://scalews.health.nokia.com/index/service/event",
|
url => "https://scalews.withings.com/index/service/event",
|
||||||
timeout => 30,
|
timeout => 30,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {activated => '0', action => 'get', sessionid => $hash->{IODev}->{SessionKey}, deviceid=> $hash->{Device}, type => '10,11,12,13,14,15,20', begindate => int($lastupdate)},
|
data => {activated => '0', action => 'get', sessionid => $hash->{IODev}->{SessionKey}, deviceid=> $hash->{Device}, type => '10,11,12,13,14,15,20', begindate => int($lastupdate)},
|
||||||
@ -1291,7 +1291,7 @@ sub withings_getDeviceAlertsHome($) {
|
|||||||
$lastupdate = $hash->{lastsessiondate} if(defined($hash->{lastsessiondate}) and $hash->{lastsessiondate} < $lastupdate);
|
$lastupdate = $hash->{lastsessiondate} if(defined($hash->{lastsessiondate}) and $hash->{lastsessiondate} < $lastupdate);
|
||||||
|
|
||||||
HttpUtils_NonblockingGet({
|
HttpUtils_NonblockingGet({
|
||||||
url => "https://scalews.withings.net/cgi-bin/v2/timeline",
|
url => "https://scalews.withings.com/cgi-bin/v2/timeline",
|
||||||
timeout => 30,
|
timeout => 30,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {type => '1', callctx => 'foreground', action => 'getbydeviceid', appname => 'HomeMonitor', apppfm => 'ios', appliver => '20000', sessionid => $hash->{IODev}->{SessionKey}, deviceid=> $hash->{Device}, lastupdate => int($lastupdate) },
|
data => {type => '1', callctx => 'foreground', action => 'getbydeviceid', appname => 'HomeMonitor', apppfm => 'ios', appliver => '20000', sessionid => $hash->{IODev}->{SessionKey}, deviceid=> $hash->{Device}, lastupdate => int($lastupdate) },
|
||||||
@ -1324,7 +1324,7 @@ sub withings_getDeviceAlertsBaby($) {
|
|||||||
$lastupdate = $hash->{lastsessiondate} if(defined($hash->{lastsessiondate}) and $hash->{lastsessiondate} < $lastupdate);
|
$lastupdate = $hash->{lastsessiondate} if(defined($hash->{lastsessiondate}) and $hash->{lastsessiondate} < $lastupdate);
|
||||||
|
|
||||||
HttpUtils_NonblockingGet({
|
HttpUtils_NonblockingGet({
|
||||||
url => "https://scalews.health.nokia.com/index/service/event",
|
url => "https://scalews.withings.com/index/service/event",
|
||||||
timeout => 30,
|
timeout => 30,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {activated => '1', action => 'get', sessionid => $hash->{IODev}->{SessionKey}, deviceid=> $hash->{Device}, type => '10,11,12,13,14,15,20', begindate => int($lastupdate)},
|
data => {activated => '1', action => 'get', sessionid => $hash->{IODev}->{SessionKey}, deviceid=> $hash->{Device}, type => '10,11,12,13,14,15,20', begindate => int($lastupdate)},
|
||||||
@ -1389,7 +1389,7 @@ sub withings_getS3Credentials($) {
|
|||||||
withings_getSessionKey( $hash->{IODev} );
|
withings_getSessionKey( $hash->{IODev} );
|
||||||
|
|
||||||
my ($err,$data) = HttpUtils_BlockingGet({
|
my ($err,$data) = HttpUtils_BlockingGet({
|
||||||
url => $hash->{'.https'}."://scalews.withings.net/cgi-bin/v2/device",
|
url => $hash->{'.https'}."://scalews.withings.com/cgi-bin/v2/device",
|
||||||
timeout => 10,
|
timeout => 10,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {callctx => 'foreground', action => 'getsts', deviceid => $hash->{Device}, appname => 'HomeMonitor', apppfm => 'ios' , appliver => '20000', sessionid => $hash->{IODev}->{SessionKey}},
|
data => {callctx => 'foreground', action => 'getsts', deviceid => $hash->{Device}, appname => 'HomeMonitor', apppfm => 'ios' , appliver => '20000', sessionid => $hash->{IODev}->{SessionKey}},
|
||||||
@ -1451,7 +1451,7 @@ sub withings_getUserDetail($) {
|
|||||||
withings_getSessionKey( $hash->{IODev} );
|
withings_getSessionKey( $hash->{IODev} );
|
||||||
|
|
||||||
my ($err,$data) = HttpUtils_BlockingGet({
|
my ($err,$data) = HttpUtils_BlockingGet({
|
||||||
url => $hash->{'.https'}."://scalews.health.nokia.com/index/service/user",
|
url => $hash->{'.https'}."://scalews.withings.com/index/service/user",
|
||||||
timeout => 10,
|
timeout => 10,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {sessionid => $hash->{IODev}->{SessionKey}, userid => $hash->{User} , appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getbyuserid'},
|
data => {sessionid => $hash->{IODev}->{SessionKey}, userid => $hash->{User} , appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getbyuserid'},
|
||||||
@ -1481,7 +1481,7 @@ sub withings_poll($;$) {
|
|||||||
return undef if(IsDisabled($name));
|
return undef if(IsDisabled($name));
|
||||||
|
|
||||||
|
|
||||||
#my $resolve = inet_aton("scalews.health.nokia.com");
|
#my $resolve = inet_aton("scalews.withings.com");
|
||||||
#if(!defined($resolve))
|
#if(!defined($resolve))
|
||||||
#{
|
#{
|
||||||
# $hash->{STATE} = "DNS error";
|
# $hash->{STATE} = "DNS error";
|
||||||
@ -1577,7 +1577,7 @@ sub withings_getUserReadingsDaily($) {
|
|||||||
my $enddateymd = strftime("%Y-%m-%d", localtime($enddate));
|
my $enddateymd = strftime("%Y-%m-%d", localtime($enddate));
|
||||||
|
|
||||||
HttpUtils_NonblockingGet({
|
HttpUtils_NonblockingGet({
|
||||||
url => "https://scalews.health.nokia.com/cgi-bin/v2/aggregate",
|
url => "https://scalews.withings.com/cgi-bin/v2/aggregate",
|
||||||
timeout => 60,
|
timeout => 60,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {sessionid => $hash->{IODev}->{SessionKey}, userid=> $hash->{User}, range => '1', meastype => '36,37,38,40,41,49,50,51,52,53,87', startdateymd => $startdateymd, enddateymd => $enddateymd, appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getbyuserid'},
|
data => {sessionid => $hash->{IODev}->{SessionKey}, userid=> $hash->{User}, range => '1', meastype => '36,37,38,40,41,49,50,51,52,53,87', startdateymd => $startdateymd, enddateymd => $enddateymd, appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getbyuserid'},
|
||||||
@ -1595,7 +1595,7 @@ sub withings_getUserReadingsDaily($) {
|
|||||||
$enddateymd = strftime("%Y-%m-%d", localtime($enddate));
|
$enddateymd = strftime("%Y-%m-%d", localtime($enddate));
|
||||||
|
|
||||||
HttpUtils_NonblockingGet({
|
HttpUtils_NonblockingGet({
|
||||||
url => "https://scalews.health.nokia.com/cgi-bin/v2/activity",
|
url => "https://scalews.withings.com/cgi-bin/v2/activity",
|
||||||
timeout => 60,
|
timeout => 60,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {sessionid => $hash->{IODev}->{SessionKey}, userid=> $hash->{User}, subcategory => '37', startdateymd => $startdateymd, enddateymd => $enddateymd, appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getbyuserid'},
|
data => {sessionid => $hash->{IODev}->{SessionKey}, userid=> $hash->{User}, subcategory => '37', startdateymd => $startdateymd, enddateymd => $enddateymd, appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getbyuserid'},
|
||||||
@ -1606,7 +1606,7 @@ sub withings_getUserReadingsDaily($) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
# HttpUtils_NonblockingGet({
|
# HttpUtils_NonblockingGet({
|
||||||
# url => "https://scalews.health.nokia.com/cgi-bin/v2/activity",
|
# url => "https://scalews.withings.com/cgi-bin/v2/activity",
|
||||||
# timeout => 60,
|
# timeout => 60,
|
||||||
# noshutdown => 1,
|
# noshutdown => 1,
|
||||||
# data => {sessionid => $hash->{IODev}->{SessionKey}, userid=> $hash->{User}, startdateymd => $startdateymd, enddateymd => $enddateymd, appname => 'hmw', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getbyuserid'},
|
# data => {sessionid => $hash->{IODev}->{SessionKey}, userid=> $hash->{User}, startdateymd => $startdateymd, enddateymd => $enddateymd, appname => 'hmw', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getbyuserid'},
|
||||||
@ -1641,7 +1641,7 @@ sub withings_getUserReadingsCommon($) {
|
|||||||
$enddate = $now if ($enddate > $now);
|
$enddate = $now if ($enddate > $now);
|
||||||
|
|
||||||
HttpUtils_NonblockingGet({
|
HttpUtils_NonblockingGet({
|
||||||
url => "https://scalews.health.nokia.com/index/service/measure",
|
url => "https://scalews.withings.com/cgi-bin/measure",
|
||||||
timeout => 60,
|
timeout => 60,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {sessionid => $hash->{IODev}->{SessionKey}, category => '1', userid=> $hash->{User}, offset => '0', limit => '400', startdate => int($lastupdate), enddate => int($enddate), appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getmeas'},
|
data => {sessionid => $hash->{IODev}->{SessionKey}, category => '1', userid=> $hash->{User}, offset => '0', limit => '400', startdate => int($lastupdate), enddate => int($enddate), appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getmeas'},
|
||||||
@ -1679,7 +1679,7 @@ sub withings_getUserReadingsSleep($) {
|
|||||||
# data => {sessionid => $hash->{IODev}->{SessionKey}, userid=> $hash->{User}, meastype => '43,44,11,57,59,60,61,62,63,64,65,66,67,68,69,70', startdate => int($lastupdate), enddate => int($enddate), devicetype => '32', appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getvasistas'},
|
# data => {sessionid => $hash->{IODev}->{SessionKey}, userid=> $hash->{User}, meastype => '43,44,11,57,59,60,61,62,63,64,65,66,67,68,69,70', startdate => int($lastupdate), enddate => int($enddate), devicetype => '32', appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getvasistas'},
|
||||||
|
|
||||||
HttpUtils_NonblockingGet({
|
HttpUtils_NonblockingGet({
|
||||||
url => "https://scalews.health.nokia.com/cgi-bin/v2/measure",
|
url => "https://scalews.withings.com/cgi-bin/v2/measure",
|
||||||
timeout => 60,
|
timeout => 60,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {sessionid => $hash->{IODev}->{SessionKey}, userid=> $hash->{User}, meastype => '11,39,41,43,44,57,59,87', startdate => int($lastupdate), enddate => int($enddate), devicetype => '32', appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getvasistas'},
|
data => {sessionid => $hash->{IODev}->{SessionKey}, userid=> $hash->{User}, meastype => '11,39,41,43,44,57,59,87', startdate => int($lastupdate), enddate => int($enddate), devicetype => '32', appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getvasistas'},
|
||||||
@ -1713,7 +1713,7 @@ sub withings_getUserReadingsSleepDebug($) {
|
|||||||
$enddate = $now if ($enddate > $now);
|
$enddate = $now if ($enddate > $now);
|
||||||
|
|
||||||
HttpUtils_NonblockingGet({
|
HttpUtils_NonblockingGet({
|
||||||
url => "https://scalews.health.nokia.com/cgi-bin/v2/measure",
|
url => "https://scalews.withings.com/cgi-bin/v2/measure",
|
||||||
timeout => 60,
|
timeout => 60,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {sessionid => $hash->{IODev}->{SessionKey}, userid=> $hash->{User}, meastype => '60,61,62,63,64,65,66,67,68,69,70', startdate => int($lastupdate), enddate => int($enddate), devicetype => '32', appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getvasistas'},
|
data => {sessionid => $hash->{IODev}->{SessionKey}, userid=> $hash->{User}, meastype => '60,61,62,63,64,65,66,67,68,69,70', startdate => int($lastupdate), enddate => int($enddate), devicetype => '32', appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getvasistas'},
|
||||||
@ -1751,7 +1751,7 @@ sub withings_getUserReadingsActivity($) {
|
|||||||
Log3 "withings", 5, "$name: getactivityreadings ".$lastupdate." to ".$enddate;
|
Log3 "withings", 5, "$name: getactivityreadings ".$lastupdate." to ".$enddate;
|
||||||
|
|
||||||
HttpUtils_NonblockingGet({
|
HttpUtils_NonblockingGet({
|
||||||
url => "https://scalews.health.nokia.com/cgi-bin/v2/measure",
|
url => "https://scalews.withings.com/cgi-bin/v2/measure",
|
||||||
timeout => 60,
|
timeout => 60,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {sessionid => $hash->{IODev}->{SessionKey}, userid=> $hash->{User}, meastype => '36,37,38,39,40,41,42,43,44,59,70,87,90', startdate => int($lastupdate), enddate => int($enddate), devicetype => '16', appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getvasistas'},
|
data => {sessionid => $hash->{IODev}->{SessionKey}, userid=> $hash->{User}, meastype => '36,37,38,39,40,41,42,43,44,59,70,87,90', startdate => int($lastupdate), enddate => int($enddate), devicetype => '16', appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getvasistas'},
|
||||||
@ -1831,6 +1831,7 @@ sub withings_parseMeasureGroups($$) {
|
|||||||
readingsBulkUpdate( $hash, $reading, $value, 1 );
|
readingsBulkUpdate( $hash, $reading, $value, 1 );
|
||||||
$hash->{CHANGETIME}[0] = FmtDateTime($measuregrp->{date});
|
$hash->{CHANGETIME}[0] = FmtDateTime($measuregrp->{date});
|
||||||
readingsEndUpdate($hash,1);
|
readingsEndUpdate($hash,1);
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1910,7 +1911,7 @@ sub withings_parseMeasurements($$) {
|
|||||||
readingsBulkUpdate( $hash, $reading->[1], $reading->[2], 1 );
|
readingsBulkUpdate( $hash, $reading->[1], $reading->[2], 1 );
|
||||||
$hash->{CHANGETIME}[0] = FmtDateTime($reading->[0]);;
|
$hash->{CHANGETIME}[0] = FmtDateTime($reading->[0]);;
|
||||||
readingsEndUpdate($hash,1);
|
readingsEndUpdate($hash,1);
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2032,7 +2033,7 @@ sub withings_parseAggregate($$) {
|
|||||||
readingsBulkUpdate( $hash, $reading->[1], $reading->[2], 1 );
|
readingsBulkUpdate( $hash, $reading->[1], $reading->[2], 1 );
|
||||||
$hash->{CHANGETIME}[0] = FmtDateTime($reading->[0]);
|
$hash->{CHANGETIME}[0] = FmtDateTime($reading->[0]);
|
||||||
readingsEndUpdate($hash,1);
|
readingsEndUpdate($hash,1);
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2129,7 +2130,7 @@ sub withings_parseActivity($$) {
|
|||||||
readingsBulkUpdate( $hash, $reading->[1], $reading->[2], 1 );
|
readingsBulkUpdate( $hash, $reading->[1], $reading->[2], 1 );
|
||||||
$hash->{CHANGETIME}[0] = FmtDateTime($reading->[0]);
|
$hash->{CHANGETIME}[0] = FmtDateTime($reading->[0]);
|
||||||
readingsEndUpdate($hash,1);
|
readingsEndUpdate($hash,1);
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2249,6 +2250,7 @@ sub withings_parseVasistas($$;$) {
|
|||||||
|
|
||||||
if($updatetype ne "unknown") {
|
if($updatetype ne "unknown") {
|
||||||
$newlastupdate = $readingsdate if($readingsdate > $newlastupdate);
|
$newlastupdate = $readingsdate if($readingsdate > $newlastupdate);
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2344,7 +2346,7 @@ sub withings_parseTimeline($$) {
|
|||||||
readingsBulkUpdate( $hash, $reading, $value, 1 );
|
readingsBulkUpdate( $hash, $reading, $value, 1 );
|
||||||
$hash->{CHANGETIME}[0] = FmtDateTime($event->{epoch});
|
$hash->{CHANGETIME}[0] = FmtDateTime($event->{epoch});
|
||||||
readingsEndUpdate($hash,1);
|
readingsEndUpdate($hash,1);
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
if(AttrVal($name,"videoLinkEvents",0) eq "1")
|
if(AttrVal($name,"videoLinkEvents",0) eq "1")
|
||||||
{
|
{
|
||||||
@ -2449,7 +2451,7 @@ sub withings_parseEvents($$) {
|
|||||||
|
|
||||||
|
|
||||||
readingsEndUpdate($hash,1);
|
readingsEndUpdate($hash,1);
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($newlastupdate == $lastupdate and $i == 0)
|
if($newlastupdate == $lastupdate and $i == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user