diff --git a/fhem/CHANGED b/fhem/CHANGED index 006fbcfc9..878638377 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,10 @@ # 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. + - change: 75_AutomowerConnectDevice: last revision, declared deprecated + will be removed soon, change definition to AutomowerConnect + use different application key + - change: 74_AutomowerConnect: Common.pm remove attr mowerActivityToHighLight + extend design attributes, automowerconnect.js enhanced highlighting - change: 93_DbRep: attr executeBeforeProc, executeAfterProc can execute FHEM commands as well as PERL code - bugfix: 82_LGTV_WebOS: fix little typos and change version diff --git a/fhem/FHEM/74_AutomowerConnect.pm b/fhem/FHEM/74_AutomowerConnect.pm index bc60eea90..775252579 100644 --- a/fhem/FHEM/74_AutomowerConnect.pm +++ b/fhem/FHEM/74_AutomowerConnect.pm @@ -113,7 +113,6 @@ sub Initialize() { "mapBackgroundColor " . "mapDesignAttributes:textField-long " . "mapZones:textField-long " . - "mowerActivityToHighLight:textField-long " . "showMap:1,0 " . "chargingStationCoordinates " . "chargingStationImagePosition:left,top,right,bottom,center " . @@ -329,16 +328,17 @@ sub getMowerResponse { if ( defined ($hash->{helper}{mower}{id}) ){ # update dataset - $hash->{helper}{mowerold} = dclone( $hash->{helper}{mower} ); - + $hash->{helper}{mowerold}{attributes}{metadata}{statusTimestamp} = $hash->{helper}{mower}{attributes}{metadata}{statusTimestamp}; + $hash->{helper}{mowerold}{attributes}{mower}{activity} = $hash->{helper}{mower}{attributes}{mower}{activity}; + } else { # first data set - $hash->{helper}{mowerold} = dclone( $hash->{helper}{mowers}[$mowerNumber] ); - $hash->{helper}{searchpos} = [ dclone( $hash->{helper}{mowerold}{attributes}{positions}[0] ), dclone( $hash->{helper}{mowerold}{attributes}{positions}[1] ) ]; - $hash->{helper}{timestamps}[ 0 ] = $hash->{helper}{mowerold}{attributes}{metadata}{statusTimestamp}; + $hash->{helper}{searchpos} = [ dclone( $hash->{helper}{mowers}[$mowerNumber]{attributes}{positions}[0] ), dclone( $hash->{helper}{mowers}[$mowerNumber]{attributes}{positions}[1] ) ]; + $hash->{helper}{mowerold}{attributes}{metadata}{statusTimestamp} = $hash->{helper}{mowers}[$mowerNumber]{attributes}{metadata}{statusTimestamp}; + $hash->{helper}{mowerold}{attributes}{mower}{activity} = $hash->{helper}{mowers}[$mowerNumber]{attributes}{mower}{activity}; if ( AttrVal( $name, 'mapImageCoordinatesToRegister', '' ) eq '' ) { - ::FHEM::Devices::AMConnect::Common::posMinMax( $hash, $hash->{helper}{mowerold}{attributes}{positions} ); + ::FHEM::Devices::AMConnect::Common::posMinMax( $hash, $hash->{helper}{mowers}[$mowerNumber]{attributes}{positions} ); } } @@ -348,8 +348,8 @@ sub getMowerResponse { push( @{ $hash->{helper}{mower}{attributes}{positions} }, @{ dclone( $hash->{helper}{searchpos} ) } ); $hash->{helper}{newdatasets} = 0; - my $storediff = $hash->{helper}{mower}{attributes}{metadata}{statusTimestamp} - $hash->{helper}{mowerold}{attributes}{metadata}{statusTimestamp}; - if ($storediff) { + $hash->{helper}{storediff} = $hash->{helper}{mower}{attributes}{metadata}{statusTimestamp} - $hash->{helper}{mowerold}{attributes}{metadata}{statusTimestamp}; + if ($hash->{helper}{storediff}) { ::FHEM::Devices::AMConnect::Common::AlignArray( $hash ); ::FHEM::Devices::AMConnect::Common::FW_detailFn_Update ($hash) if (AttrVal($name,'showMap',1)); @@ -710,24 +710,6 @@ sub Attr { CommandDeleteReading( $hash, "$name mower_currentZone" ); Log3 $name, 3, "$iam $cmd $attrName"; - } - ########## - } elsif( $attrName eq "mowerActivityToHighLight" ) { - if( $cmd eq "set" ) { - - my $act = 'LEAVING'; - my $actold = 'LEAVING'; - my $perl = eval "($attrVal)"; - - if ($@) { - return "$iam $cmd $attrName syntax error in condition: $@ \n $attrVal"; - } - Log3 $name, 4, "$iam $cmd $attrName"; - - } elsif( $cmd eq "del" ) { - - Log3 $name, 3, "$iam $cmd $attrName"; - } } return undef; @@ -751,22 +733,21 @@ __END__

AutomowerConnect


@@ -1033,16 +1009,6 @@ __END__ }'
-
  • mowerActivityToHighLight
    - attr <name> mowerActivityToHighLight <perl condition to determine a path section>
    - A perl condition to highlight a path section by mower activities.
    - The current interval activity is accessible by $act. The last intervall activity is accessible by $actold.
    - LineColor, LineDash and LineWidth are adjustable by the attribut mapDesignAttributes under otherActivityPath...
    - Example: Highlight path when leaving charging station.
    - attr <name> mowerActivityToHighLight $act =~ /MOWING|LEAVING/ && $actold =~ /LEAVING|PARKED_IN_CS|CHARGING/
    - Example: Highlight path when returning to charging station.
    - attr <name> mowerActivityToHighLight $act =~ /PARKED_IN_CS|CHARGING|GOING_HOME/ && $actold =~ /MOWING|GOING_HOME/
  • -
  • disable
  • disabledForIntervals
  • @@ -1078,7 +1044,6 @@ __END__
  • status_connected - state of connetion between mower and Husqvarna Cloud, (1 => CONNECTED, 0 => OFFLINE)
  • status_statusTimestamp - local time of last change of the API content
  • status_statusTimestampDiff - time difference in seconds between the last and second last change of the API content
  • -
  • status_statusTimestampOld - local time of second last change of the API content
  • system_name - name of the mower
  • @@ -1093,22 +1058,21 @@ __END__

    AutomowerConnect


    @@ -1377,17 +1336,6 @@ __END__ }'
    -
  • mowerActivityToHighLight
    - attr <name> mowerActivityToHighLight <perl condition to determine a path section>
    - Eine Perl Bedingung, die Aktivitäten verknüpft, um einen Pfadabschnitt festzulegen, der hervorgehoben wird.
    - Die Aktivität im aktuellen Intervall steht über die Perlvariable $act und die Aktivität im letzten Intervall über $actold zur Verfügung.
    - Die Farbe, Strichstärke und Muster können über das Attribut mapDesignAttributes unter otherActivityPath... eingestellt werden.
    - Beispiel: Pfad beim Verlassen der Ladestation hervorheben.
    - attr <name> mowerActivityToHighLight $act =~ /MOWING|LEAVING/ && $actold =~ /LEAVING|PARKED_IN_CS|CHARGING/
    - Beispiel: Pfad beim Zurückkehren zur Ladestation hervorheben.
    - attr <name> mowerActivityToHighLight $act =~ /PARKED_IN_CS|CHARGING|GOING_HOME/ && $actold =~ /MOWING|GOING_HOME/
    -
  • -
  • disable
  • disabledForIntervals
  • @@ -1424,7 +1372,6 @@ __END__
  • status_connected - Status der Verbindung zwischen dem Automower und der Husqvarna Cloud, (1 => CONNECTED, 0 => OFFLINE)
  • status_statusTimestamp - Lokalzeit der letzten Änderung der Daten in der API
  • status_statusTimestampDiff - Zeitdifferenz zwischen den beiden letzten Änderungen im Inhalt der Daten aus der API
  • -
  • status_statusTimestampOld - Lokalzeit der vorletzten Änderung der Daten in der API
  • system_name - Name des Automowers
  • diff --git a/fhem/FHEM/75_AutomowerConnectDevice.pm b/fhem/FHEM/75_AutomowerConnectDevice.pm index b7af8c41b..4a09757c3 100644 --- a/fhem/FHEM/75_AutomowerConnectDevice.pm +++ b/fhem/FHEM/75_AutomowerConnectDevice.pm @@ -107,7 +107,6 @@ sub Initialize() { "mapBackgroundColor " . "mapDesignAttributes:textField-long " . "mapZones:textField-long " . - "mowerActivityToHighLight:textField-long " . "showMap:1,0 " . "chargingStationCoordinates " . "chargingStationImagePosition:left,top,right,bottom,center " . @@ -160,16 +159,17 @@ sub Notify { my $myMower = dclone( $mowerhash ); if ( defined ($hash->{helper}{mower}{id}) ){ # update dataset - $hash->{helper}{mowerold} = dclone( $hash->{helper}{mower} ); - + $hash->{helper}{mowerold}{attributes}{metadata}{statusTimestamp} = $hash->{helper}{mower}{attributes}{metadata}{statusTimestamp}; + $hash->{helper}{mowerold}{attributes}{mower}{activity} = $hash->{helper}{mower}{attributes}{mower}{activity}; + } else { # first data set - $hash->{helper}{mowerold} = $myMower; - $hash->{helper}{searchpos} = [ dclone( $hash->{helper}{mowerold}{attributes}{positions}[0] ), dclone( $hash->{helper}{mowerold}{attributes}{positions}[1] ) ]; - $hash->{helper}{timestamps}[ 0 ] = $hash->{helper}{mowerold}{attributes}{metadata}{statusTimestamp}; + $hash->{helper}{searchpos} = [ dclone( $myMower->{attributes}{positions}[0] ), dclone( $myMower->{attributes}{positions}[1] ) ]; + $hash->{helper}{mowerold}{attributes}{metadata}{statusTimestamp} = $myMower->{attributes}{metadata}{statusTimestamp}; + $hash->{helper}{mowerold}{attributes}{mower}{activity} = $myMower->{attributes}{mower}{activity}; if ( AttrVal( $name, 'mapImageCoordinatesToRegister', '' ) eq '' ) { - ::FHEM::Devices::AMConnect::Common::posMinMax( $hash, $hash->{helper}{mowerold}{attributes}{positions} ); + ::FHEM::Devices::AMConnect::Common::posMinMax( $hash, $myMower->{attributes}{positions} ); } } @@ -179,8 +179,8 @@ sub Notify { push( @{ $hash->{helper}{mower}{attributes}{positions} }, @{ dclone( $hash->{helper}{searchpos} ) } ); $hash->{helper}{newdatasets} = 0; - my $storediff = $hash->{helper}{mower}{attributes}{metadata}{statusTimestamp} - $hash->{helper}{mowerold}{attributes}{metadata}{statusTimestamp}; - if ($storediff) { + $hash->{helper}{storediff} = $hash->{helper}{mower}{attributes}{metadata}{statusTimestamp} - $hash->{helper}{mowerold}{attributes}{metadata}{statusTimestamp}; + if ($hash->{helper}{storediff}) { ::FHEM::Devices::AMConnect::Common::AlignArray( $hash ); ::FHEM::Devices::AMConnect::Common::FW_detailFn_Update ($hash) if (AttrVal($name,'showMap',1)); @@ -494,24 +494,6 @@ sub Attr { CommandDeleteReading( $hash, "$name mower_currentZone" ); Log3 $name, 3, "$iam $cmd $attrName"; - } - ########## - } elsif( $attrName eq "mowerActivityToHighLight" ) { - if( $cmd eq "set" ) { - - my $act = 'LEAVING'; - my $actold = 'LEAVING'; - my $perl = eval "($attrVal)"; - - if ($@) { - return "$iam $cmd $attrName syntax error in condition: $@ \n $attrVal"; - } - Log3 $name, 4, "$iam $cmd $attrName"; - - } elsif( $cmd eq "del" ) { - - Log3 $name, 3, "$iam $cmd $attrName"; - } } return undef; @@ -526,8 +508,8 @@ __END__ =pod =item device -=item summary Module to control Husqvarnas robotic lawn mowers with Connect Module (SIM) -=item summary_DE Modul zur Steuerung von Husqvarnas Mähroboter mit Connect Modul (SIM) +=item summary This Module is deprecated. Please don't use it. +=item summary_DE Das Modul ist veraltet. Bitte, nicht mehr benutzen. =begin html @@ -535,23 +517,13 @@ __END__

    AutomowerConnectDevice

    Requirements

    @@ -845,23 +806,13 @@ __END__

    AutomowerConnectDevice

    diff --git a/fhem/lib/FHEM/Devices/AMConnect/Common.pm b/fhem/lib/FHEM/Devices/AMConnect/Common.pm index 160c20d6e..76e9b3345 100644 --- a/fhem/lib/FHEM/Devices/AMConnect/Common.pm +++ b/fhem/lib/FHEM/Devices/AMConnect/Common.pm @@ -137,10 +137,16 @@ errorPathLineDash="" errorPathLineWidth="2" chargingStationPathLineColor="#999999" chargingStationPathLineDash="6,2" -chargingStationPathLineWidth="3" -otherActivityPathLineColor="#33cc33" +chargingStationPathLineWidth="1" +otherActivityPathLineColor="#999999" otherActivityPathLineDash="6,2" -otherActivityPathLineWidth="2" +otherActivityPathLineWidth="1" +leavingPathLineColor="#33cc33" +leavingPathLineDash="6,2" +leavingPathLineWidth="2" +goingHomePathLineColor="#0099ff" +goingHomePathLineDash="6,2" +goingHomePathLineWidth="2" mowingPathDisplayStart="" mowingPathLineColor="#ff0000" mowingPathLineDash="6,2" @@ -195,7 +201,6 @@ my $mapZonesTpl = '{ MAP_MIME => '', MAP_CACHE => '', cspos => [], - otherpos => [], areapos => [], searchpos => [], timestamps => [], @@ -210,18 +215,21 @@ my $mapZonesTpl = '{ olLat => 0 }, UNKNOWN => { - arrayName => 'otherpos', + short => 'U', + arrayName => '', maxLength => 100, cnt => 0, callFn => '' }, NOT_APPLICABLE => { - arrayName => 'otherpos', + short => 'N', + arrayName => '', maxLength => 50, cnt => 0, callFn => '' }, MOWING => { + short => 'M', arrayName => 'areapos', maxLength => 5000, maxLengthDefault => 5000, @@ -229,30 +237,35 @@ my $mapZonesTpl = '{ callFn => \&FHEM::Devices::AMConnect::Common::AreaStatistics }, GOING_HOME => { - arrayName => 'otherpos', + short => 'G', + arrayName => '', maxLength => 50, cnt => 0, callFn => '' }, CHARGING => { + short => 'C', arrayName => 'cspos', maxLength => 100, cnt => 0, callFn => \&FHEM::Devices::AMConnect::Common::ChargingStationPosition }, LEAVING => { - arrayName => 'otherpos', + short => 'L', + arrayName => '', maxLength => 50, cnt => 0, callFn => '' }, PARKED_IN_CS => { + short => 'P', arrayName => 'cspos', maxLength => 100, cnt => 0, callFn => \&FHEM::Devices::AMConnect::Common::ChargingStationPosition }, STOPPED_IN_GARDEN => { + short => 'S', arrayName => 'otherpos', maxLength => 50, cnt => 0, @@ -298,6 +311,10 @@ my $mapZonesTpl = '{ } elsif ( $type eq 'AutomowerConnectDevice' ) { + $hash->{HINWEIS1} = 'Dieses Modul nicht mehr verwenden, die Entwicklung ist eingestellt.'; + $hash->{HINWEIS2} = 'Bestehende Instanzen muessen umgehend auf AutomowerConnect umgestellt werden.'; + $hash->{HINWEIS3} = 'Für jedes Geraet ist ein extra Application Key zu verwenden.'; + RemoveInternalTimer($hash); InternalTimer( gettimeofday() + 25, \&readMap, $hash, 0); @@ -438,7 +455,6 @@ sub FW_detailFn_Update { my @pos = @{ $hash->{helper}{areapos} }; my @posc = @{ $hash->{helper}{cspos} }; - my @posother = @{ $hash->{helper}{otherpos} }; my @poserr = @{ $hash->{helper}{lasterror}{positions} }; my $img = "./fhem/$type/$name/map"; @@ -474,23 +490,12 @@ sub FW_detailFn_Update { my $cslat = int(($latlo-$csla) * $picy / $mapy); # MOWING PATH - my $posxy = int($lonlo * $picx / $mapx).",".int($latlo * $picy / $mapy); + my $posxy = int( $lonlo * $picx / $mapx ).",".int( $latlo * $picy / $mapy ); if ( @pos > 1 ) { - $posxy = int(($lonlo-$pos[0]{longitude}) * $picx / $mapx).",".int(($latlo-$pos[0]{latitude}) * $picy / $mapy); + $posxy = int( ( $lonlo-$pos[ 0 ]{longitude} ) * $picx / $mapx ).",".int( ( $latlo-$pos[ 0 ]{latitude} ) * $picy / $mapy ).",'".$pos[ 0 ]{act}."'"; for (my $i=1;$i<@pos;$i++){ - $posxy .= ",".int(($lonlo-$pos[$i]{longitude}) * $picx / $mapx).",".int(($latlo-$pos[$i]{latitude}) * $picy / $mapy); - } - - } - - # OTHER PATH - my $posoxy = int($lonlo * $picx / $mapx).",".int($latlo * $picy / $mapy); - if ( @posother > 1 ) { - - $posoxy = int(($lonlo-$posother[0]{longitude}) * $picx / $mapx).",".int(($latlo-$posother[0]{latitude}) * $picy / $mapy); - for (my $i=1;$i<@posother;$i++){ - $posoxy .= ",".int(($lonlo-$posother[$i]{longitude}) * $picx / $mapx).",".int(($latlo-$posother[$i]{latitude}) * $picy / $mapy); + $posxy .= ",".int( ( $lonlo - $pos[ $i ]{longitude} ) * $picx / $mapx ).",".int( ( $latlo - $pos[ $i ]{latitude} ) * $picy / $mapy ).",'".$pos[ $i ]{act}."'"; } } @@ -551,10 +556,10 @@ sub FW_detailFn_Update { my $erray = "$errlon,$errlat,$errx,$erry,$poserrxy"; - # Log3 $name, 1, "AutomowerConnectUpdateDetail ( '$name', '$type', '$img', $picx, $picy, $cslon, $cslat, '$csimgpos', $scalx, '$errdesc', [ $posxy ], [ $limi ], [ $propli ], [ $poscxy ], [ $erray ] )"; + # Log3 $name, 1, "AutomowerConnectUpdateDetail ( '$name', '$type', '$img', $picx, $picy, $cslon, $cslat, '$csimgpos', $scalx, '$errdesc', [ $posxy ], [ $limi ], [ $propli ], [ $erray ] )"; map { - ::FW_directNotify("#FHEMWEB:$_", "AutomowerConnectUpdateDetail ( '$name', '$type', '$img', $picx, $picy, $cslon, $cslat, '$csimgpos', $scalx, [ '$errdesc', '$errdate' ], [ $posxy ], [ $limi ], [ $propli ], [ $poscxy ], [ $erray ], [ $posoxy ] )",""); + ::FW_directNotify("#FHEMWEB:$_", "AutomowerConnectUpdateDetail ( '$name', '$type', '$img', $picx, $picy, $cslon, $cslat, '$csimgpos', $scalx, [ '$errdesc', '$errdate' ], [ $posxy ], [ $limi ], [ $propli ], [ $erray ] )",""); } devspec2array("TYPE=FHEMWEB"); } return undef; @@ -707,6 +712,9 @@ sub AlignArray { if ( $cnt > 0 ) { my @ar = @{ $hash->{helper}{mower}{attributes}{positions} }[ 0 .. $cnt-1 ]; + + map { $_->{act} = $hash->{helper}{$act}{short} } @ar; + $tmp = dclone( \@ar ); if ( @{ $hash->{helper}{areapos} } ) { @@ -756,15 +764,6 @@ sub AlignArray { } - my $val = AttrVal($name, 'mowerActivityToHighLight', 0); - - if ( $val && eval( "$val" ) ) { - - $tmp = dclone( \@ar ); - HighlightPath ( $hash, $tmp, $cnt ); - - } - } else { $cnt = 0; @@ -909,71 +908,6 @@ sub ZoneHandling { } -######################### -sub setCuttingHeight { - my ( $hash, $poshash, $cnt ) = @_; - my $name = $hash->{NAME}; - my $zone = ''; - my $nextzone = ''; - my @pos = @$poshash; - my $longitude = 0; - my $latitude = 0; - my @zonekeys = sort (keys %{$hash->{helper}{mapZones}}); - my $i = 0; - my $k = 0; - - map{ $hash->{helper}{mapZones}{$_}{curZoneCnt} = 0 } @zonekeys; - - for ( $i = 0; $i < $cnt; $i++){ - - $longitude = $pos[$i]{longitude}; - $latitude = $pos[$i]{latitude}; - - for ( $k = 0; $k < @zonekeys-1; $k++){ - - if ( eval ("$hash->{helper}{mapZones}{$zonekeys[$k]}{condition}") ) { - - if ( $hash->{helper}{mapZones}{$zonekeys[$k]}{curZoneCnt} == $i) { # find current zone and count consecutive way points - - $hash->{helper}{mapZones}{$zonekeys[$k]}{curZoneCnt}++; - $hash->{helper}{currentZone} = $zonekeys[$k]; - - } - - $hash->{helper}{mapZones}{$zonekeys[$k]}{zoneCnt}++; - $hash->{helper}{mapZones}{$zonekeys[$k]}{zoneLength} += calcPathLength( $hash, $i, $i + 1 ); - last; - - } elsif ( $k == @zonekeys-2 ) { # last zone - - if ( $hash->{helper}{mapZones}{$zonekeys[$k+1]}{curZoneCnt} == $i) { # find current zone and count consecutive way points - - $hash->{helper}{mapZones}{$zonekeys[$k+1]}{curZoneCnt}++; - $hash->{helper}{currentZone} = $zonekeys[$k+1]; - - } - - $hash->{helper}{mapZones}{$zonekeys[$k+1]}{zoneCnt}++; - $hash->{helper}{mapZones}{$zonekeys[$k+1]}{zoneLength} += calcPathLength( $hash, $i, $i + 1 ); - - } - - } - - } - - my $sumDayCnt=0; - my $sumDayArea=0; - map { $sumDayCnt += $hash->{helper}{mapZones}{$_}{zoneCnt}; - $hash->{helper}{mapZones}{$_}{currentDayCntPct} = ( $sumDayCnt ? sprintf( "%.0f", $hash->{helper}{mapZones}{$_}{zoneCnt} / $sumDayCnt * 100 ) : 0 ); - $sumDayArea += $hash->{helper}{mapZones}{$_}{zoneLength}; - $hash->{helper}{mapZones}{$_}{currentDayAreaPct} = ( $sumDayArea ? sprintf( "%.0f", $hash->{helper}{mapZones}{$_}{zoneLength} / $sumDayArea * 100 ) : 0 ); - } @zonekeys; - - $hash->{helper}{newzonedatasets} = $cnt; - -} - ######################### sub ChargingStationPosition { my ( $hash, $poshash, $cnt ) = @_; @@ -1009,27 +943,6 @@ sub ChargingStationPosition { } -######################### -sub HighlightPath { - my ( $hash, $poshash, $cnt ) = @_; - if ( $cnt && @{ $hash->{helper}{otherpos} } ) { - - unshift ( @{ $hash->{helper}{otherpos} }, @$poshash ); - - } elsif ( $cnt ) { - - $hash->{helper}{otherpos} = $poshash; - - } - - while ( @{ $hash->{helper}{otherpos} } > $hash->{helper}{UNKNOWN}{maxLength} ) { - - pop ( @{ $hash->{helper}{otherpos}} ); # reduce to max allowed length - - } - return undef; -} - ######################### sub calcPathLength { my ( $hash, $istart, $i ) = @_; @@ -1213,10 +1126,8 @@ sub fillReadings { my $connected = $hash->{helper}{mower}{attributes}{metadata}{connected}; readingsBulkUpdateIfChanged($hash, $pref."_connected", ( $connected ? "CONNECTED($connected)" : "OFFLINE($connected)") ); - my $storediff = $hash->{helper}{mower}{attributes}{metadata}{statusTimestamp} - $hash->{helper}{mowerold}{attributes}{metadata}{statusTimestamp}; readingsBulkUpdateIfChanged($hash, $pref."_Timestamp", FmtDateTime( $hash->{helper}{mower}{attributes}{metadata}{statusTimestamp}/1000 )); - readingsBulkUpdateIfChanged($hash, $pref."_TimestampDiff", $storediff/1000 ); - readingsBulkUpdateIfChanged($hash, $pref."_TimestampOld", FmtDateTime( $hash->{helper}{mowerold}{attributes}{metadata}{statusTimestamp}/1000 )); + readingsBulkUpdateIfChanged($hash, $pref."_TimestampDiff", $hash->{helper}{storediff}/1000 ); return undef; } @@ -1474,9 +1385,6 @@ sub listInternalData { $arnr = scalar @{ $hash->{helper}{areapos} } if( scalar @{ $hash->{helper}{areapos} } > 2 ); my $arnrmax = $hash->{helper}{MOWING}{maxLength}; - my $ornr = scalar @{ $hash->{helper}{otherpos} }; - my $ornrmax = $hash->{helper}{UNKNOWN}{maxLength}; - my $ernr = scalar @{ $hash->{helper}{lasterror}{positions} }; $hash->{helper}{posMinMax} =~ /(-?\d*\.?\d+)\s(-?\d*\.?\d+)(\R|\s)(-?\d*\.?\d+)\s(-?\d*\.?\d+)/; @@ -1484,7 +1392,7 @@ sub listInternalData { if ( $::init_done && $1 && $2 && $4 && $5 ) { $ret .= ' Data Sets ( max )  Corner Longitude Latitude '; - $ret .= ' ' . ($csnr + $arnr) . ' ( ' . ($csnrmax + $arnrmax) . ' )  Upper Left ' . $1 . ' ' . $2 . ' '; + $ret .= ' ' . $arnr . ' ( ' . $arnrmax . ' )  Upper Left ' . $1 . ' ' . $2 . ' '; $ret .= ' Lower Right ' . $4 . ' ' . $5 . ' '; $ret .= '

    '; @@ -1498,12 +1406,9 @@ sub listInternalData { $ret .= ''; $ret .= ''; - $ret .= ''; + $ret .= ''; $ret .= ''; - $ret .= ''; - $ret .= ' - - '; + $ret .= ''; $ret .= ''; $ret .= '
    Way Point Stacks
    Used For Action  Stack Name  Current Size  Max Size 
    Used For Activities  Stack Name  Current Size  Max Size 
    PARKED_IN_CS, CHARGING  cspos  ' . $csnr . ' ' . $csnrmax . ' 
    MOWING  areapos  ' . $arnr . ' ' . $arnrmax . ' 
    User defined activities  otherpos  ' . $ornr . ' ' . $ornrmax . ' 
    ALL  areapos  ' . $arnr . ' ' . $arnrmax . ' 
    NOT_APPLICABLE with error time stamp  lasterror/positions  ' . $ernr . ' - 
    '; diff --git a/fhem/www/pgm2/automowerconnect.js b/fhem/www/pgm2/automowerconnect.js index d38dc9d8c..7129b0329 100644 --- a/fhem/www/pgm2/automowerconnect.js +++ b/fhem/www/pgm2/automowerconnect.js @@ -175,8 +175,47 @@ function AutomowerConnectDrawPath ( ctx, div, pos, type ) { } -//AutomowerConnectUpdateDetail (, , , , ,, , , , , , ) -function AutomowerConnectUpdateDetail (dev, type, imgsrc, picx, picy, csx, csy, csrel, scalx, errdesc, pos, lixy, plixy, posc, erray, poso) { +function AutomowerConnectDrawPathColor ( ctx, div, pos, colorat ) { + // draw path + var type = colorat[ pos[ 2 ] ]; + ctx.beginPath(); + ctx.strokeStyle = div.getAttribute( 'data-'+ type + 'LineColor' ); + ctx.lineWidth=div.getAttribute( 'data-'+ type + 'LineWidth' ); + ctx.setLineDash( div.getAttribute( 'data-'+ type + 'LineDash' ).split(",") ); + ctx.moveTo( parseInt( pos[0] ), parseInt( pos[ 1 ] ) ); + + for (var i=3;i, , , , ,, , , , , ) +function AutomowerConnectUpdateDetail (dev, type, imgsrc, picx, picy, csx, csy, csrel, scalx, errdesc, pos, lixy, plixy, erray) { + const colorat = { + "U" : "otherActivityPath", + "N" : "otherActivityPath", + "S" : "otherActivityPath", + "P" : "chargingStationPath", + "C" : "chargingStationPath", + "M" : "mowingPath", + "L" : "leavingPath", + "G" : "goingHomePath" + }; // log('pos.length '+pos.length+' lixy.length '+lixy.length+', scalx '+scalx ); // log('loop: Start '+ type+' '+dev ); if (FW_urlParams.detail == dev || 1) { @@ -194,13 +233,10 @@ function AutomowerConnectUpdateDetail (dev, type, imgsrc, picx, picy, csx, csy, if ( plixy.length > 0 ) AutomowerConnectLimits( ctx, div, plixy, 'property' ); // draw scale AutomowerConnectScale( ctx, picx, picy, scalx ); - // draw charging station path - AutomowerConnectDrawPath ( ctx, div, posc, 'chargingStationPath' ); - if ( pos.length > 2 ) { - // draw mowing path - AutomowerConnectDrawPath ( ctx, div, pos, 'mowingPath' ); - // draw path for other activity - if ( poso.length > 1 ) AutomowerConnectDrawPath ( ctx, div, poso, 'otherActivityPath' ); + if ( pos.length > 3 ) { + + // draw mowing path color + AutomowerConnectDrawPathColor ( ctx, div, pos, colorat ); // draw start if ( div.getAttribute( 'data-mowingPathDisplayStart' ) ) { @@ -209,7 +245,7 @@ function AutomowerConnectUpdateDetail (dev, type, imgsrc, picx, picy, csx, csy, ctx.lineWidth=3; ctx.strokeStyle = 'white'; ctx.fillStyle= 'black'; - ctx.arc(parseInt(pos[pos.length-2]), parseInt(pos[pos.length-1]), 4, 0, 2 * Math.PI, false); + ctx.arc(parseInt(pos[pos.length-3]), parseInt(pos[pos.length-2]), 4, 0, 2 * Math.PI, false); ctx.fill(); ctx.stroke(); } @@ -228,13 +264,13 @@ function AutomowerConnectUpdateDetail (dev, type, imgsrc, picx, picy, csx, csy, } else { setTimeout(()=>{ // log('loop: canvas false '+ type+' '+dev ); - AutomowerConnectUpdateDetail (dev, type, imgsrc, picx, picy, csx, csy, csrel, scalx, errdesc, pos, lixy, plixy, posc, erray, poso); + AutomowerConnectUpdateDetail (dev, type, imgsrc, picx, picy, csx, csy, csrel, scalx, errdesc, pos, lixy, plixy, erray); }, 100); } } else { setTimeout(()=>{ // log('loop: detail false '+ type+' '+dev ); - AutomowerConnectUpdateDetail (dev, type, imgsrc, picx, picy, csx, csy, csrel, scalx, errdesc, pos, lixy, plixy, posc, erray, poso); + AutomowerConnectUpdateDetail (dev, type, imgsrc, picx, picy, csx, csy, csrel, scalx, errdesc, pos, lixy, plixy, erray); }, 100); } }