mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
32_withings: API endpoint change to Nokia servers - bugfix
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@17339 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
a8e459c3e1
commit
03cf54b8e3
@ -50,7 +50,7 @@ my %device_models = ( 1 => { 1 => "Smart Scale", 2 => "Wireless Scale", 3 => "S
|
|||||||
2 => { 21 => "Smart Baby Monitor", 22 => "Home", 22 => "Home v2", },
|
2 => { 21 => "Smart Baby Monitor", 22 => "Home", 22 => "Home v2", },
|
||||||
4 => { 41 => "iOS Blood Pressure Monitor", 42 => "Wireless Blood Pressure Monitor", 43 => "BPM", 44 => "BPM+", },
|
4 => { 41 => "iOS Blood Pressure Monitor", 42 => "Wireless Blood Pressure Monitor", 43 => "BPM", 44 => "BPM+", },
|
||||||
16 => { 51 => "Pulse Ox", 52 => "Activite", 53 => "Activite v2", 54 => "Go", 55 => "Steel HR", },
|
16 => { 51 => "Pulse Ox", 52 => "Activite", 53 => "Activite v2", 54 => "Go", 55 => "Steel HR", },
|
||||||
32 => { 60 => "Aura", 61 => "Sleep Sensor", 62 => "Sleep Mat", },
|
32 => { 60 => "Aura", 61 => "Sleep Sensor", 62 => "Sleep Mat", 63 => "Sleep", },
|
||||||
64 => { 70 => "Thermo", }, );
|
64 => { 70 => "Thermo", }, );
|
||||||
|
|
||||||
#Firmware files: cdnfw_withings_net
|
#Firmware files: cdnfw_withings_net
|
||||||
@ -873,13 +873,13 @@ sub withings_initDevice($) {
|
|||||||
$hash->{lastweighindate} = $device->{lastweighindate} if( defined($device->{lastweighindate}) );
|
$hash->{lastweighindate} = $device->{lastweighindate} if( defined($device->{lastweighindate}) );
|
||||||
|
|
||||||
|
|
||||||
if((defined($hash->{typeID}) && $hash->{typeID} == 16) or (defined($hash->{modelID}) && $hash->{modelID} == 61))
|
if((defined($hash->{typeID}) && $hash->{typeID} == 16) or (defined($hash->{typeID}) && $hash->{typeID} == 32 && defined($hash->{modelID}) && $hash->{modelID} != 60))
|
||||||
{
|
{
|
||||||
my $devicelink = withings_getDeviceLink( $hash );
|
my $devicelink = withings_getDeviceLink( $hash );
|
||||||
if(defined($devicelink->{userid}))
|
if(defined($devicelink) && defined($devicelink->{linkuserid}))
|
||||||
{
|
{
|
||||||
$hash->{User} = $devicelink->{userid};
|
$hash->{User} = $devicelink->{linkuserid};
|
||||||
$hash->{UserDevice} = $modules{$hash->{TYPE}}{defptr}{"U".$devicelink->{userid}} if defined($modules{$hash->{TYPE}}{defptr}{"U".$devicelink->{userid}});
|
$hash->{UserDevice} = $modules{$hash->{TYPE}}{defptr}{"U".$devicelink->{linkuserid}} if defined($modules{$hash->{TYPE}}{defptr}{"U".$devicelink->{linkuserid}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -979,7 +979,7 @@ sub withings_getDevices($) {
|
|||||||
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/association",
|
url => $hash->{'.https'}."://scalews.withings.com/cgi-bin/association",
|
||||||
timeout => 10,
|
timeout => 10,
|
||||||
noshutdown => 1,
|
noshutdown => 1,
|
||||||
data => {sessionid => $hash->{SessionKey}, accountid => $hash->{AccountID} , type => '-1', enrich => 't' , appname => 'my2', appliver=> $hash->{helper}{appliver}, apppfm => 'web', action => 'getbyaccountid'},
|
data => {sessionid => $hash->{SessionKey}, accountid => $hash->{AccountID} , type => '-1', enrich => 't' , appname => 'my2', appliver=> $hash->{helper}{appliver}, apppfm => 'web', action => 'getbyaccountid'},
|
||||||
@ -1067,10 +1067,10 @@ 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/index/service/v2/link",
|
url => $hash->{'.https'}."://scalews.health.nokia.com/cgi-bin/association",
|
||||||
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 => 'get'},
|
data => {sessionid => $hash->{IODev}->{SessionKey}, appname => 'hmw', appliver=> $hash->{IODev}->{helper}{appliver}, enrich => 't', action => 'getbyaccountid'},
|
||||||
});
|
});
|
||||||
|
|
||||||
#my $ua = LWP::UserAgent->new;
|
#my $ua = LWP::UserAgent->new;
|
||||||
@ -1087,7 +1087,13 @@ sub withings_getDeviceLink($) {
|
|||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $json->{body};
|
foreach my $association (@{$json->{body}{associations}}) {
|
||||||
|
next if( !defined($association->{deviceid}) );
|
||||||
|
next if( $association->{deviceid} ne $hash->{Device} );
|
||||||
|
return $association->{deviceproperties};
|
||||||
|
}
|
||||||
|
|
||||||
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1512,7 +1518,7 @@ sub withings_poll($;$) {
|
|||||||
withings_getDeviceProperties($hash) if($force > 1 || $lastProperties <= ($now - $intervalProperties));
|
withings_getDeviceProperties($hash) if($force > 1 || $lastProperties <= ($now - $intervalProperties));
|
||||||
withings_getDeviceReadingsBedside($hash) if($force || $lastData <= ($now - $intervalData));
|
withings_getDeviceReadingsBedside($hash) if($force || $lastData <= ($now - $intervalData));
|
||||||
}
|
}
|
||||||
elsif(defined($hash->{modelID}) && $hash->{modelID} eq '61') {
|
elsif(defined($hash->{modelID}) && ($hash->{modelID} eq '61' || $hash->{modelID} eq '62' || $hash->{modelID} eq '63')) {
|
||||||
withings_getDeviceProperties($hash) if($force > 1 || $lastProperties <= ($now - $intervalProperties));
|
withings_getDeviceProperties($hash) if($force > 1 || $lastProperties <= ($now - $intervalProperties));
|
||||||
withings_getUserReadingsSleep($hash) if($force || $lastData <= ($now - $intervalData));
|
withings_getUserReadingsSleep($hash) if($force || $lastData <= ($now - $intervalData));
|
||||||
withings_getUserReadingsSleepDebug($hash) if($force || $lastDebug <= ($now - $intervalDebug));
|
withings_getUserReadingsSleepDebug($hash) if($force || $lastDebug <= ($now - $intervalDebug));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user