2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-25 03:44:52 +00:00

LandroidUtils.pm: Bugfixing

git-svn-id: https://svn.fhem.de/fhem/trunk@27409 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2023-04-07 18:08:58 +00:00
parent 73dd92c3c4
commit e47612226b
2 changed files with 7 additions and 6 deletions

View File

@ -458,7 +458,7 @@ MQTT2_CLIENT_Set($@)
MQTT2_CLIENT_Disco($hash) if($init_done);
} elsif($a[0] eq "connect") {
$hash->{maxFailedConnects} = 0;
$hash->{nrFailedConnects} = 0;
MQTT2_CLIENT_connect($hash) if(!$hash->{FD});
} elsif($a[0] eq "disconnect") {
@ -785,7 +785,7 @@ MQTT2_CLIENT_addToFeedList($$)
}
sub
MQTT2_CLIENT_feedTheList($$$)
MQTT2_CLIENT_feedTheList($$$;$)
{
my ($server, $tp, $val, $cid) = @_;
my $fl = $server->{".feedList"};

View File

@ -74,15 +74,16 @@ Landroid_connect($$)
HttpUtils_NonblockingGet({
url=>"https://$t->{loginUrl}/oauth/token",
timeout=>60,
callback=> sub($$$){
my ($h,$e,$d) = @_;
return Log3 $m2c, 1, "$errPrefix $e" if($e);
return Log3 $m2c, 1, "$errPrefix no data" if(!$d);
Log3 $m2c, 5, $d;
$m2c->{".auth"} = json2nameValue($d);
return Log3 $m2c, 1, "$errPrefix no access_token"
return Log3 $m2c, 1, "$errPrefix no access_token / $d"
if(!$m2c->{".auth"}{access_token});
Log3 $m2c, 4, "$m2c_name: Got auth info";
Log3 $m2c, 4, "$m2c_name: Got auth info, request: ".$data->{grant_type};
setReadingsVal($m2c, ".refresh_token",
$m2c->{".auth"}{refresh_token}, TimeNow());
InternalTimer(gettimeofday()+$ra-60,
@ -121,11 +122,11 @@ Landroid_connect2($)
Log3 $m2c, 5, $d;
my $me = json2nameValue($d);
return Log3 $m2c, 1, "$errPrefix no userId/mqttEndpoint"
if(!$me->{userId} || !$me->{mqttEndpoint});
if(!$me->{id} || !$me->{mqtt_endpoint});
Log3 $m2c, 4, "$m2c_name: Got userId/mqttEndpoint";
$m2c->{userId} = $me->{id};
$m2c->{mqttEndpoint} = $me->{mqtt_endpoint};
Landroid_connect3($m2c);
Landroid_connect3($m2c_name);
}
});
}