2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

32_withings: web token fix

git-svn-id: https://svn.fhem.de/fhem/trunk@13811 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
moises 2017-03-26 18:10:40 +00:00
parent ad9fcb3197
commit d4bfcb6119
2 changed files with 17 additions and 16 deletions

View File

@ -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.
- bugfix: 32_withings: web token fix
- bugfix: 93_DbRep: switch wintertime to summertime, minor fixes - bugfix: 93_DbRep: switch wintertime to summertime, minor fixes
- update: 32_withings: account data encryption - update: 32_withings: account data encryption
- update: 38_netatmo: dynamic interval, various fixes, logging changes - update: 38_netatmo: dynamic interval, various fixes, logging changes

View File

@ -10,7 +10,7 @@
# #
# #
############################################################################## ##############################################################################
# Release 03 / 2017-03-26 # Release 02 / 2017-02-27
package main; package main;
@ -991,7 +991,7 @@ sub withings_getDeviceDetail($) {
url => $hash->{'.https'}."://healthmate.withings.com/index/service/device", url => $hash->{'.https'}."://healthmate.withings.com/index/service/device",
timeout => 10, timeout => 10,
noshutdown => 1, noshutdown => 1,
data => {sessionid => $hash->{IODev}->{SessionKey}, deviceid => $hash->{Device} , appname => 'my2', appliver=> $hash->{IODev}->{appliver}, apppfm => 'web', action => 'getproperties'}, data => {sessionid => $hash->{IODev}->{SessionKey}, deviceid => $hash->{Device} , appname => 'my2', appliver=> $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getproperties'},
}); });
#Log3 "withings", 5, "$name: getdevicedetaildata ".Dumper($data); #Log3 "withings", 5, "$name: getdevicedetaildata ".Dumper($data);
@ -1034,12 +1034,12 @@ sub withings_getDeviceLink($) {
url => $hash->{'.https'}."://healthmate.withings.com/index/service/v2/link", url => $hash->{'.https'}."://healthmate.withings.com/index/service/v2/link",
timeout => 10, timeout => 10,
noshutdown => 1, noshutdown => 1,
data => {sessionid => $hash->{IODev}->{SessionKey}, deviceid => $hash->{Device} , appname => 'my2', appliver=> $hash->{IODev}->{appliver}, apppfm => 'web', action => 'get'}, data => {sessionid => $hash->{IODev}->{SessionKey}, deviceid => $hash->{Device} , appname => 'my2', appliver=> $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'get'},
}); });
#my $ua = LWP::UserAgent->new; #my $ua = LWP::UserAgent->new;
#my $request = HTTP::Request->new(POST => $hash->{'.https'}.'://healthmate.withings.com/index/service/v2/link'); #my $request = HTTP::Request->new(POST => $hash->{'.https'}.'://healthmate.withings.com/index/service/v2/link');
#my $get_data = 'sessionid='.$hash->{IODev}->{SessionKey}.'&deviceid='.$hash->{Device}.'&appname=my2&appliver='.$hash->{IODev}->{appliver}.'&apppfm=web&action=get'; #my $get_data = 'sessionid='.$hash->{IODev}->{SessionKey}.'&deviceid='.$hash->{Device}.'&appname=my2&appliver='.$hash->{IODev}->{helper}{appliver}.'&apppfm=web&action=get';
#$request->content($get_data); #$request->content($get_data);
#my $response = $ua->request($request); #my $response = $ua->request($request);
return undef if(!defined($data)); return undef if(!defined($data));
@ -1068,7 +1068,7 @@ sub withings_getDeviceProperties($) {
url => "https://healthmate.withings.com/index/service/device", url => "https://healthmate.withings.com/index/service/device",
timeout => 30, timeout => 30,
noshutdown => 1, noshutdown => 1,
data => {sessionid => $hash->{IODev}->{SessionKey}, deviceid=> $hash->{Device}, appname => 'my2', appliver => $hash->{IODev}->{appliver}, apppfm => 'web', action => 'getproperties'}, data => {sessionid => $hash->{IODev}->{SessionKey}, deviceid=> $hash->{Device}, appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getproperties'},
hash => $hash, hash => $hash,
type => 'deviceProperties', type => 'deviceProperties',
callback => \&withings_Dispatch, callback => \&withings_Dispatch,
@ -1104,7 +1104,7 @@ sub withings_getDeviceReadingsScale($) {
url => "https://healthmate.withings.com/index/service/v2/measure", url => "https://healthmate.withings.com/index/service/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}->{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'},
hash => $hash, hash => $hash,
type => 'deviceReadingsScale', type => 'deviceReadingsScale',
enddate => int($enddate), enddate => int($enddate),
@ -1139,7 +1139,7 @@ sub withings_getDeviceReadingsBedside($) {
url => "https://healthmate.withings.com/index/service/v2/measure", url => "https://healthmate.withings.com/index/service/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}->{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'},
hash => $hash, hash => $hash,
type => 'deviceReadingsBedside', type => 'deviceReadingsBedside',
enddate => int($enddate), enddate => int($enddate),
@ -1174,7 +1174,7 @@ sub withings_getDeviceReadingsHome($) {
url => "https://healthmate.withings.com/index/service/v2/measure", url => "https://healthmate.withings.com/index/service/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}->{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'},
hash => $hash, hash => $hash,
type => 'deviceReadingsHome', type => 'deviceReadingsHome',
enddate => int($enddate), enddate => int($enddate),
@ -1392,7 +1392,7 @@ sub withings_getUserDetail($) {
url => $hash->{'.https'}."://healthmate.withings.com/index/service/user", url => $hash->{'.https'}."://healthmate.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}->{appliver}, apppfm => 'web', action => 'getbyuserid'}, data => {sessionid => $hash->{IODev}->{SessionKey}, userid => $hash->{User} , appname => 'my2', appliver => $hash->{IODev}->{helper}{appliver}, apppfm => 'web', action => 'getbyuserid'},
}); });
return undef if(!defined($data)); return undef if(!defined($data));
@ -1513,7 +1513,7 @@ sub withings_getUserReadingsDaily($) {
url => "https://healthmate.withings.com/index/service/v2/aggregate", url => "https://healthmate.withings.com/index/service/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}->{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'},
hash => $hash, hash => $hash,
type => 'userDailyAggregate', type => 'userDailyAggregate',
enddate => int($enddate), enddate => int($enddate),
@ -1531,7 +1531,7 @@ sub withings_getUserReadingsDaily($) {
url => "https://healthmate.withings.com/index/service/v2/activity", url => "https://healthmate.withings.com/index/service/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}->{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'},
hash => $hash, hash => $hash,
type => 'userDailyActivity', type => 'userDailyActivity',
enddate => int($enddate), enddate => int($enddate),
@ -1566,7 +1566,7 @@ sub withings_getUserReadingsCommon($) {
url => "https://healthmate.withings.com/index/service/measure", url => "https://healthmate.withings.com/index/service/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}->{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'},
hash => $hash, hash => $hash,
type => 'userReadingsCommon', type => 'userReadingsCommon',
enddate => int($enddate), enddate => int($enddate),
@ -1598,13 +1598,13 @@ sub withings_getUserReadingsSleep($) {
$lastupdate = $hash->{lastsessiondate} if(defined($hash->{lastsessiondate}) and $hash->{lastsessiondate} < $lastupdate); $lastupdate = $hash->{lastsessiondate} if(defined($hash->{lastsessiondate}) and $hash->{lastsessiondate} < $lastupdate);
my $enddate = ($lastupdate+(8*60*60)); my $enddate = ($lastupdate+(8*60*60));
$enddate = $now if ($enddate > $now); $enddate = $now if ($enddate > $now);
# 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}->{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://healthmate.withings.com/index/service/v2/measure", url => "https://healthmate.withings.com/index/service/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}->{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'},
hash => $hash, hash => $hash,
type => 'userReadingsSleep', type => 'userReadingsSleep',
enddate => int($enddate), enddate => int($enddate),
@ -1638,7 +1638,7 @@ sub withings_getUserReadingsSleepDebug($) {
url => "https://healthmate.withings.com/index/service/v2/measure", url => "https://healthmate.withings.com/index/service/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}->{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'},
hash => $hash, hash => $hash,
type => 'userReadingsSleepDebug', type => 'userReadingsSleepDebug',
enddate => int($enddate), enddate => int($enddate),
@ -1676,7 +1676,7 @@ sub withings_getUserReadingsActivity($) {
url => "https://healthmate.withings.com/index/service/v2/measure", url => "https://healthmate.withings.com/index/service/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}->{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'},
hash => $hash, hash => $hash,
type => 'userReadingsActivity', type => 'userReadingsActivity',
enddate => int($enddate), enddate => int($enddate),