74_AutomowerConnect: Common.pm, automowerconnect.js, fix problem with empty positions array, java script cleanup
git-svn-id: https://svn.fhem.de/fhem/trunk@27706 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
# 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.
|
||||||
|
- bugfix: 74_AutomowerConnect: Common.pm, automowerconnect.js, fix promlem
|
||||||
|
with empty positions array
|
||||||
- feature: 74_AutomowerConnect: Common.pm, add additional API polling
|
- feature: 74_AutomowerConnect: Common.pm, add additional API polling
|
||||||
- feature: 76_SMAInverter: bugfix DC-Power
|
- feature: 76_SMAInverter: bugfix DC-Power
|
||||||
- change: 74_AutomowerConnect: Common.pm, automowerconnect.js
|
- change: 74_AutomowerConnect: Common.pm, automowerconnect.js
|
||||||
|
|||||||
@@ -195,6 +195,7 @@ my $mapZonesTpl = '{
|
|||||||
maxLat => -90,
|
maxLat => -90,
|
||||||
imageHeight => 650,
|
imageHeight => 650,
|
||||||
imageWidthHeight => '350 650',
|
imageWidthHeight => '350 650',
|
||||||
|
map_init_delay => 2,
|
||||||
mapdesign => $mapAttr,
|
mapdesign => $mapAttr,
|
||||||
mapZonesTpl => $mapZonesTpl,
|
mapZonesTpl => $mapZonesTpl,
|
||||||
posMinMax => "-180 90\n180 -90",
|
posMinMax => "-180 90\n180 -90",
|
||||||
@@ -447,8 +448,6 @@ sub FW_detailFn {
|
|||||||
my $type = $hash->{TYPE};
|
my $type = $hash->{TYPE};
|
||||||
return '' if( AttrVal($name, 'disable', 0) || !AttrVal($name, 'showMap', 1) );
|
return '' if( AttrVal($name, 'disable', 0) || !AttrVal($name, 'showMap', 1) );
|
||||||
|
|
||||||
if ( $hash->{helper} && $hash->{helper}{mower} && $hash->{helper}{mower}{attributes} && $hash->{helper}{mower}{attributes}{positions} && @{$hash->{helper}{mower}{attributes}{positions}} > 0 ) {
|
|
||||||
|
|
||||||
my $img = "$FW_ME/$type/$name/map";
|
my $img = "$FW_ME/$type/$name/map";
|
||||||
my $zoom=AttrVal( $name,"mapImageZoom", 0.7 );
|
my $zoom=AttrVal( $name,"mapImageZoom", 0.7 );
|
||||||
my $backgroundcolor = AttrVal($name, 'mapBackgroundColor','');
|
my $backgroundcolor = AttrVal($name, 'mapBackgroundColor','');
|
||||||
@@ -521,16 +520,13 @@ sub FW_detailFn {
|
|||||||
$ret .= "<canvas id='${type}_${name}_canvas_1' class='${type}_${name}_canvas_1' width='$picx' height='$picy' ></canvas>";
|
$ret .= "<canvas id='${type}_${name}_canvas_1' class='${type}_${name}_canvas_1' width='$picx' height='$picy' ></canvas>";
|
||||||
$ret .= "</div>";
|
$ret .= "</div>";
|
||||||
$hash->{helper}{detailFnFirst} = 1;
|
$hash->{helper}{detailFnFirst} = 1;
|
||||||
InternalTimer( gettimeofday() + 2, \&FW_detailFn_Update, $hash, 0 );
|
my $mid = $hash->{helper}{map_init_delay};
|
||||||
|
InternalTimer( gettimeofday() + $mid, \&FW_detailFn_Update, $hash, 0 );
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
sub FW_detailFn_Update {
|
sub FW_detailFn_Update {
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
@@ -2504,7 +2500,8 @@ sub wsCb {
|
|||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $type = $hash->{TYPE};
|
my $type = $hash->{TYPE};
|
||||||
my $iam = "$type $name wsCb:";
|
my $iam = "$type $name wsCb:";
|
||||||
Log3 $name, 2, "$iam failed with error: $error" if( $error );
|
my $l = $hash->{devioLoglevel};
|
||||||
|
Log3 $name, ( $l ? $l : 1 ), "$iam failed with error: $error" if( $error );
|
||||||
return undef;
|
return undef;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -294,15 +294,13 @@ function AutomowerConnectUpdateDetail (dev, type, detailfnfirst, picx, picy, sca
|
|||||||
"L" : "leavingPath",
|
"L" : "leavingPath",
|
||||||
"G" : "goingHomePath"
|
"G" : "goingHomePath"
|
||||||
};
|
};
|
||||||
// log('loop: Start '+ type+' '+dev );
|
const div = document.getElementById(type+'_'+dev+'_div');
|
||||||
if (FW_urlParams.detail == dev || 1) {
|
|
||||||
const canvas_0 = document.getElementById(type+'_'+dev+'_canvas_0');
|
const canvas_0 = document.getElementById(type+'_'+dev+'_canvas_0');
|
||||||
const canvas = document.getElementById(type+'_'+dev+'_canvas_1');
|
const canvas = document.getElementById(type+'_'+dev+'_canvas_1');
|
||||||
const div = document.getElementById(type+'_'+dev+'_div');
|
|
||||||
|
|
||||||
if ( canvas && canvas_0 ) {
|
if ( div && canvas && canvas_0 ) {
|
||||||
|
|
||||||
// log('loop: canvas && canvas_0 true '+ type+' '+dev + ' detailfnfirst '+detailfnfirst);
|
// log('loop: div && canvas && canvas_0 true '+ type+' '+dev + ' detailfnfirst '+detailfnfirst);
|
||||||
|
|
||||||
if ( detailfnfirst ) {
|
if ( detailfnfirst ) {
|
||||||
|
|
||||||
@@ -368,13 +366,7 @@ function AutomowerConnectUpdateDetail (dev, type, detailfnfirst, picx, picy, sca
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
// log('loop: canvas false '+ type+' '+dev );
|
log('AutomowerConnectUpdateDetail loop: div && canvas && canvas_0 false '+ type+' '+dev );
|
||||||
AutomowerConnectUpdateDetail (dev, type, detailfnfirst, picx, picy, scalx, errdesc, pos, erray);
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
setTimeout(()=>{
|
|
||||||
// log('loop: detail false '+ type+' '+dev );
|
|
||||||
AutomowerConnectUpdateDetail (dev, type, detailfnfirst, picx, picy, scalx, errdesc, pos, erray);
|
AutomowerConnectUpdateDetail (dev, type, detailfnfirst, picx, picy, scalx, errdesc, pos, erray);
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user