mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-21 07:56:03 +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:
parent
f8143033f9
commit
db50e5165b
@ -458,7 +458,7 @@ MQTT2_CLIENT_Set($@)
|
|||||||
MQTT2_CLIENT_Disco($hash) if($init_done);
|
MQTT2_CLIENT_Disco($hash) if($init_done);
|
||||||
|
|
||||||
} elsif($a[0] eq "connect") {
|
} elsif($a[0] eq "connect") {
|
||||||
$hash->{maxFailedConnects} = 0;
|
$hash->{nrFailedConnects} = 0;
|
||||||
MQTT2_CLIENT_connect($hash) if(!$hash->{FD});
|
MQTT2_CLIENT_connect($hash) if(!$hash->{FD});
|
||||||
|
|
||||||
} elsif($a[0] eq "disconnect") {
|
} elsif($a[0] eq "disconnect") {
|
||||||
@ -785,7 +785,7 @@ MQTT2_CLIENT_addToFeedList($$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub
|
sub
|
||||||
MQTT2_CLIENT_feedTheList($$$)
|
MQTT2_CLIENT_feedTheList($$$;$)
|
||||||
{
|
{
|
||||||
my ($server, $tp, $val, $cid) = @_;
|
my ($server, $tp, $val, $cid) = @_;
|
||||||
my $fl = $server->{".feedList"};
|
my $fl = $server->{".feedList"};
|
||||||
|
@ -74,15 +74,16 @@ Landroid_connect($$)
|
|||||||
|
|
||||||
HttpUtils_NonblockingGet({
|
HttpUtils_NonblockingGet({
|
||||||
url=>"https://$t->{loginUrl}/oauth/token",
|
url=>"https://$t->{loginUrl}/oauth/token",
|
||||||
|
timeout=>60,
|
||||||
callback=> sub($$$){
|
callback=> sub($$$){
|
||||||
my ($h,$e,$d) = @_;
|
my ($h,$e,$d) = @_;
|
||||||
return Log3 $m2c, 1, "$errPrefix $e" if($e);
|
return Log3 $m2c, 1, "$errPrefix $e" if($e);
|
||||||
return Log3 $m2c, 1, "$errPrefix no data" if(!$d);
|
return Log3 $m2c, 1, "$errPrefix no data" if(!$d);
|
||||||
Log3 $m2c, 5, $d;
|
Log3 $m2c, 5, $d;
|
||||||
$m2c->{".auth"} = json2nameValue($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});
|
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",
|
setReadingsVal($m2c, ".refresh_token",
|
||||||
$m2c->{".auth"}{refresh_token}, TimeNow());
|
$m2c->{".auth"}{refresh_token}, TimeNow());
|
||||||
InternalTimer(gettimeofday()+$ra-60,
|
InternalTimer(gettimeofday()+$ra-60,
|
||||||
@ -121,11 +122,11 @@ Landroid_connect2($)
|
|||||||
Log3 $m2c, 5, $d;
|
Log3 $m2c, 5, $d;
|
||||||
my $me = json2nameValue($d);
|
my $me = json2nameValue($d);
|
||||||
return Log3 $m2c, 1, "$errPrefix no userId/mqttEndpoint"
|
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";
|
Log3 $m2c, 4, "$m2c_name: Got userId/mqttEndpoint";
|
||||||
$m2c->{userId} = $me->{id};
|
$m2c->{userId} = $me->{id};
|
||||||
$m2c->{mqttEndpoint} = $me->{mqtt_endpoint};
|
$m2c->{mqttEndpoint} = $me->{mqtt_endpoint};
|
||||||
Landroid_connect3($m2c);
|
Landroid_connect3($m2c_name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user