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

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:
Ellert 2023-06-25 11:44:25 +00:00
parent 02e95f4fbb
commit 01e1a0df67
3 changed files with 132 additions and 141 deletions

View File

@ -1,5 +1,7 @@
# 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.
- bugfix: 74_AutomowerConnect: Common.pm, automowerconnect.js, fix promlem
with empty positions array
- feature: 74_AutomowerConnect: Common.pm, add additional API polling
- feature: 76_SMAInverter: bugfix DC-Power
- change: 74_AutomowerConnect: Common.pm, automowerconnect.js

View File

@ -195,6 +195,7 @@ my $mapZonesTpl = '{
maxLat => -90,
imageHeight => 650,
imageWidthHeight => '350 650',
map_init_delay => 2,
mapdesign => $mapAttr,
mapZonesTpl => $mapZonesTpl,
posMinMax => "-180 90\n180 -90",
@ -447,8 +448,6 @@ sub FW_detailFn {
my $type = $hash->{TYPE};
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 $zoom=AttrVal( $name,"mapImageZoom", 0.7 );
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 .= "</div>";
$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 '';
}
#########################
sub FW_detailFn_Update {
my ($hash) = @_;
@ -2504,7 +2500,8 @@ sub wsCb {
my $name = $hash->{NAME};
my $type = $hash->{TYPE};
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;
}

View File

@ -294,15 +294,13 @@ function AutomowerConnectUpdateDetail (dev, type, detailfnfirst, picx, picy, sca
"L" : "leavingPath",
"G" : "goingHomePath"
};
// log('loop: Start '+ type+' '+dev );
if (FW_urlParams.detail == dev || 1) {
const div = document.getElementById(type+'_'+dev+'_div');
const canvas_0 = document.getElementById(type+'_'+dev+'_canvas_0');
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 ) {
@ -368,13 +366,7 @@ function AutomowerConnectUpdateDetail (dev, type, detailfnfirst, picx, picy, sca
} else {
setTimeout(()=>{
// log('loop: canvas false '+ type+' '+dev );
AutomowerConnectUpdateDetail (dev, type, detailfnfirst, picx, picy, scalx, errdesc, pos, erray);
}, 100);
}
} else {
setTimeout(()=>{
// log('loop: detail false '+ type+' '+dev );
log('AutomowerConnectUpdateDetail loop: div && canvas && canvas_0 false '+ type+' '+dev );
AutomowerConnectUpdateDetail (dev, type, detailfnfirst, picx, picy, scalx, errdesc, pos, erray);
}, 100);
}