Geolocation Status added to Readings
thx to Andreas Krause <Andreas@die4krauses.net>
This commit is contained in:
parent
61c33fc956
commit
f36f13bb4b
@ -158,6 +158,9 @@ sub TadoAPI_Set(@) {
|
||||
return "Unknown argument $a[1], choose one of " . join(" ", @cmds);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (($cmd ne "password"))
|
||||
{
|
||||
my $pwd = TadoAPI_readPassword($name);
|
||||
@ -666,12 +669,9 @@ sub TadoAPI_SetZoneOverlayById(@){
|
||||
|
||||
#Log3 $name, 5, 'NonBlocking Request: ' . Dumper($request);
|
||||
HttpUtils_NonblockingGet($request);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub TadoAPI_SetAllOverlays(@){
|
||||
my ($hash, $setting) = @_;
|
||||
my $name = $hash->{NAME};
|
||||
@ -928,7 +928,17 @@ sub TadoAPI_UpdateMobileReadingsCallback($){
|
||||
}else{
|
||||
foreach my $item ( @$decoded_data ){
|
||||
readingsBeginUpdate($hash);
|
||||
readingsBulkUpdate($hash, "Geolocation_" . $item->{'id'}, $item->{'settings'}->{'geoTrackingEnabled'});
|
||||
readingsBulkUpdate($hash, "GeoTracking_" . $item->{'id'}, $item->{'settings'}->{'geoTrackingEnabled'});
|
||||
if(defined($item->{'location'}->{'atHome'}) && defined($item->{'location'}->{'atHome'}) eq "true"){
|
||||
# present
|
||||
readingsBulkUpdate($hash, "GeoLocation_" . $item->{'id'}, "present");
|
||||
}elsif(defined($item->{'location'}->{'atHome'})){
|
||||
# away
|
||||
readingsBulkUpdate($hash, "GeoLocation_" . $item->{'id'}, "present");
|
||||
}else{
|
||||
# no state
|
||||
readingsDelete($hash, "GeoLocation_" . $item->{'id'})
|
||||
}
|
||||
readingsEndUpdate( $hash, 1 );
|
||||
$hash->{LastRequest}="OK";
|
||||
}
|
||||
@ -1139,7 +1149,7 @@ sub TadoAPI_GetGeoById(@){
|
||||
}else{
|
||||
my $setting = $decoded_data->{'geoTrackingEnabled'};
|
||||
readingsBeginUpdate($hash);
|
||||
readingsBulkUpdate($hash, "Geolocation_" . $mobileID, $setting);
|
||||
readingsBulkUpdate($hash, "GeoLocation_" . $mobileID, $setting);
|
||||
readingsEndUpdate( $hash, 1 );
|
||||
return $setting;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user