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

32_withings: updated oauth endpoint

git-svn-id: https://svn.fhem.de/fhem/trunk@25580 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
moises 2022-01-29 03:37:52 +00:00
parent 336a51baed
commit 6951a71d72
2 changed files with 16 additions and 7 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.
- change: 32_withings: updated oauth endpoint
- feature: 31_HUEDevice: added v2effect command - feature: 31_HUEDevice: added v2effect command
- bugfix: 14_Hideki.pm: fix match regex - forum:#125679 - bugfix: 14_Hideki.pm: fix match regex - forum:#125679
- bugfix: 66_EseraOneWire: fix match list - bugfix: 66_EseraOneWire: fix match list

View File

@ -343,6 +343,7 @@ my %sleep_readings = ( 'lightsleepduration' => { name => "Light Sleep", reading
'snoring' => { name => "Snoring", reading => "snoringDuration", unit => "s", }, 'snoring' => { name => "Snoring", reading => "snoringDuration", unit => "s", },
'snoringepisodecount' => { name => "Snoring Episode Count", reading => "snoringEpisodeCount", unit => 0, }, 'snoringepisodecount' => { name => "Snoring Episode Count", reading => "snoringEpisodeCount", unit => 0, },
'breathing_event_probability' => { name => "Breathing Event Probability", reading => "breathingEventProbability", unit => 0, }, 'breathing_event_probability' => { name => "Breathing Event Probability", reading => "breathingEventProbability", unit => 0, },
'night_events' => { name => "Night Events", reading => "nightEvents", unit => 0, },
'apnea_activated' => { name => "Apnea Activated", reading => "apneaActivated", unit => 0, }, 'apnea_activated' => { name => "Apnea Activated", reading => "apneaActivated", unit => 0, },
'apnea_algo_version' => { name => "Apnea Algo Version", reading => "apneaAlgoVersion", unit => 0, }, 'apnea_algo_version' => { name => "Apnea Algo Version", reading => "apneaAlgoVersion", unit => 0, },
'apnea_hypopnea_index' => { name => "Apnea/Hypopnea Index", reading => "apneaIndex", unit => 0, }, 'apnea_hypopnea_index' => { name => "Apnea/Hypopnea Index", reading => "apneaIndex", unit => 0, },
@ -1230,6 +1231,7 @@ sub withings_getUsers($) {
my @users = (); my @users = ();
foreach my $user (@{$json->{body}{users}}) { foreach my $user (@{$json->{body}{users}}) {
next if( !defined($user->{id}) ); next if( !defined($user->{id}) );
next if( $user->{idparentaccount} ne $hash->{AccountID} );
push( @users, $user ); push( @users, $user );
} }
@ -3821,7 +3823,7 @@ sub withings_AuthRefresh($) {
my $ref = ReadingsVal($name,'.refresh_token',''); my $ref = ReadingsVal($name,'.refresh_token','');
my $datahash = { my $datahash = {
url => "https://account.withings.com/oauth2/token", url => "https://wbsapi.withings.net/v2/oauth2",
method => "POST", method => "POST",
timeout => 10, timeout => 10,
noshutdown => 1, noshutdown => 1,
@ -3850,13 +3852,13 @@ sub withings_AuthRefresh($) {
Log3 $name, 4, "$name: REFRESH SUCCESS: $data"; Log3 $name, 4, "$name: REFRESH SUCCESS: $data";
#readingsSingleUpdate( $hash, "access_token", $json->{access_token}, 1 ) if(defined($json->{access_token})); #readingsSingleUpdate( $hash, "access_token", $json->{body}{access_token}, 1 ) if(defined($json->{body}{access_token}));
$hash->{helper}{OAuthKey} = $json->{access_token} if(defined($json->{access_token})); $hash->{helper}{OAuthKey} = $json->{body}{access_token} if(defined($json->{body}{access_token}));
#readingsSingleUpdate( $hash, "expires_in", $json->{expires_in}, 1 ) if(defined($json->{expires_in})); #readingsSingleUpdate( $hash, "expires_in", $json->{body}{expires_in}, 1 ) if(defined($json->{body}{expires_in}));
$hash->{helper}{OAuthValid} = (int(time)+$json->{expires_in}) if(defined($json->{expires_in})); $hash->{helper}{OAuthValid} = (int(time)+$json->{body}{expires_in}) if(defined($json->{body}{expires_in}));
readingsSingleUpdate( $hash, ".refresh_token", $json->{refresh_token}, 1 ) if(defined($json->{refresh_token})); readingsSingleUpdate( $hash, ".refresh_token", $json->{body}{refresh_token}, 1 ) if(defined($json->{body}{refresh_token}));
InternalTimer(gettimeofday()+$json->{expires_in}-60, "withings_AuthRefresh", $hash, 0); InternalTimer(gettimeofday()+$json->{body}{expires_in}-60, "withings_AuthRefresh", $hash, 0);
#https://wbsapi.withings.net/notify?action=subscribe&access_token=a639e912dfc31a02cc01ea4f38de7fa4a1464c2e&callbackurl=http://fhem:remote@gu9mohkaxqdgpix5.myfritz.net/fhem/withings&appli=1&comment=fhem #https://wbsapi.withings.net/notify?action=subscribe&access_token=a639e912dfc31a02cc01ea4f38de7fa4a1464c2e&callbackurl=http://fhem:remote@gu9mohkaxqdgpix5.myfritz.net/fhem/withings&appli=1&comment=fhem
@ -4238,6 +4240,11 @@ sub withings_DbLog_splitFn($) {
$value = $parts[1]; $value = $parts[1];
$unit = 'mmHg'; $unit = 'mmHg';
} }
elsif($event =~ m/^vascularAge/)
{
$value = $parts[1];
$unit = 'a';
}
else else
{ {
$value = $parts[1]; $value = $parts[1];
@ -4427,6 +4434,7 @@ sub withings_weekdays2Int( $ ) {
<li>heartSounds</li> <li>heartSounds</li>
<li>pulseWave</li> <li>pulseWave</li>
<li>spo2</li> <li>spo2</li>
<li>vascularAge</li>
<li>bodyTemperature</li> <li>bodyTemperature</li>
<li>skinTemperature</li> <li>skinTemperature</li>