diff --git a/fhem/FHEM/74_AutomowerConnect.pm b/fhem/FHEM/74_AutomowerConnect.pm index bbda92b3f..3baabfa1a 100644 --- a/fhem/FHEM/74_AutomowerConnect.pm +++ b/fhem/FHEM/74_AutomowerConnect.pm @@ -369,7 +369,7 @@ sub getMowerResponse { if ( AttrVal($name, 'mapZones', 0) && $hash->{helper}{currentZone} && $hash->{helper}{mapZones}{$hash->{helper}{currentZone}}{curZoneCnt} ) { my $curZon = $hash->{helper}{currentZone}; my $curZonCnt = $hash->{helper}{mapZones}{$curZon}{curZoneCnt}; - readingsBulkUpdateIfChanged($hash, $pref.'_currentZone', $curZon . '(' . $curZonCnt . '/' . $hash->{helper}{newdatasets} . ')' ); + readingsBulkUpdateIfChanged($hash, $pref.'_currentZone', $curZon . '(' . $curZonCnt . '/' . $hash->{helper}{newzonedatasets} . ')' ); } my $tstamp = $hash->{helper}{mower}{attributes}{$pref}{errorCodeTimestamp}; @@ -438,8 +438,11 @@ sub getMowerResponse { map { $hash->{helper}{mapZones}{$_}{lastDayCntPct} = sprintf( "%.0f", $hash->{helper}{mapZones}{$_}{lastDayCnt} / $sumLastDayCnt * 100 ); + } @zonekeys if( $sumLastDayCnt ); + + map { $hash->{helper}{mapZones}{$_}{currentWeekCntPct} = sprintf( "%.0f", $hash->{helper}{mapZones}{$_}{currentWeekCnt} / $sumCurrentWeekCnt * 100 ); - } @zonekeys; + } @zonekeys if( $sumCurrentWeekCnt ); } # do on days @@ -462,7 +465,7 @@ sub getMowerResponse { map { $hash->{helper}{mapZones}{$_}{lastWeekCntPct} = sprintf( "%.0f", $hash->{helper}{mapZones}{$_}{lastWeekCnt} / $sumLastWeekCnt * 100 ); - } @zonekeys; + } @zonekeys if( $sumLastWeekCnt ); } @@ -1161,7 +1164,7 @@ __END__
  • batteryPercent - battery state of charge in percent
  • mower_activity - current activity "UNKNOWN" | "NOT_APPLICABLE" | "MOWING" | "GOING_HOME" | "CHARGING" | "LEAVING" | "PARKED_IN_CS" | "STOPPED_IN_GARDEN"
  • mower_commandStatus - Status of the last sent command cleared each status update
  • -
  • mower_currentZone - Zone name with activity MOWING in the last interval and number of way points in parenthesis.
  • +
  • mower_currentZone - Zone name with activity MOWING in the last status time stamp interval and number of way points in parenthesis.
  • mower_errorCode - last error code
  • mower_errorCodeTimestamp - last error code time stamp
  • mower_errorDescription - error description
  • @@ -1469,7 +1472,7 @@ __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 Interval steht über die Perlvariable $act und die Aktivität im letzten Intervall über $actold zur Verfügung.
    + 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/
    @@ -1496,7 +1499,7 @@ __END__
  • batteryPercent - Batterieladung in Prozent
  • mower_activity - aktuelle Aktivität "UNKNOWN" | "NOT_APPLICABLE" | "MOWING" | "GOING_HOME" | "CHARGING" | "LEAVING" | "PARKED_IN_CS" | "STOPPED_IN_GARDEN"
  • mower_commandStatus - Status des letzten uebermittelten Kommandos wird duch Statusupdate zurückgesetzt.
  • -
  • mower_currentZone - Name der Zone im aktuell abgefragten Intervall, in der der Mäher gemäht hat und Anzahl der Wegpunkte in der Zone in Klammern.
  • +
  • mower_currentZone - Name der Zone im aktuell abgefragten Intervall der Statuszeitstempel , in der der Mäher gemäht hat und Anzahl der Wegpunkte in der Zone in Klammern.
  • mower_errorCode - last error code
  • mower_errorCodeTimestamp - last error code time stamp
  • mower_errorDescription - error description
  • diff --git a/fhem/FHEM/75_AutomowerConnectDevice.pm b/fhem/FHEM/75_AutomowerConnectDevice.pm index 08b1a7fd8..f947ff8ca 100644 --- a/fhem/FHEM/75_AutomowerConnectDevice.pm +++ b/fhem/FHEM/75_AutomowerConnectDevice.pm @@ -200,7 +200,7 @@ sub Notify { if ( AttrVal($name, 'mapZones', 0) && $hash->{helper}{currentZone} && $hash->{helper}{mapZones}{$hash->{helper}{currentZone}}{curZoneCnt} ) { my $curZon = $hash->{helper}{currentZone}; my $curZonCnt = $hash->{helper}{mapZones}{$curZon}{curZoneCnt}; - readingsBulkUpdateIfChanged($hash, $pref.'_currentZone', $curZon . '(' . $curZonCnt . '/' . $hash->{helper}{newdatasets} . ')' ); + readingsBulkUpdateIfChanged($hash, $pref.'_currentZone', $curZon . '(' . $curZonCnt . '/' . $hash->{helper}{newzonedatasets} . ')' ); } my $tstamp = $hash->{helper}{mower}{attributes}{$pref}{errorCodeTimestamp}; @@ -271,8 +271,11 @@ sub Notify { map { $hash->{helper}{mapZones}{$_}{lastDayCntPct} = sprintf( "%.0f", $hash->{helper}{mapZones}{$_}{lastDayCnt} / $sumLastDayCnt * 100 ); + } @zonekeys if( $sumLastDayCnt ); + + map { $hash->{helper}{mapZones}{$_}{currentWeekCntPct} = sprintf( "%.0f", $hash->{helper}{mapZones}{$_}{currentWeekCnt} / $sumCurrentWeekCnt * 100 ); - } @zonekeys; + } @zonekeys if( $sumCurrentWeekCnt ); } # do on days @@ -295,7 +298,7 @@ sub Notify { map { $hash->{helper}{mapZones}{$_}{lastWeekCntPct} = sprintf( "%.0f", $hash->{helper}{mapZones}{$_}{lastWeekCnt} / $sumLastWeekCnt * 100 ); - } @zonekeys; + } @zonekeys if( $sumLastWeekCnt ); } @@ -914,7 +917,7 @@ __END__
  • batteryPercent - battery state of charge in percent
  • mower_activity - current activity "UNKNOWN" | "NOT_APPLICABLE" | "MOWING" | "GOING_HOME" | "CHARGING" | "LEAVING" | "PARKED_IN_CS" | "STOPPED_IN_GARDEN"
  • mower_commandStatus - Status of the last sent command cleared each status update
  • -
  • mower_currentZone - Zone name with activity MOWING in the last interval and number of way points in parenthesis.
  • +
  • mower_currentZone - Zone name with activity MOWING in the last status time stamp interval and number of way points in parenthesis.
  • mower_errorCode - last error code
  • mower_errorCodeTimestamp - last error code time stamp
  • mower_errorDescription - error description
  • @@ -1219,7 +1222,7 @@ __END__
  • batteryPercent - Batterieladung in Prozent
  • mower_activity - aktuelle Aktivität "UNKNOWN" | "NOT_APPLICABLE" | "MOWING" | "GOING_HOME" | "CHARGING" | "LEAVING" | "PARKED_IN_CS" | "STOPPED_IN_GARDEN"
  • mower_commandStatus - Status des letzten uebermittelten Kommandos wird duch Statusupdate zurückgesetzt.
  • -
  • mower_currentZone - Name der Zone im aktuell abgefragten Intervall, in der der Mäher gemäht hat und Anzahl der Wegpunkte in der Zone in Klammern.
  • +
  • mower_currentZone - Name der Zone im aktuell abgefragten Intervall der Statuszeitstempel, in der der Mäher gemäht hat und Anzahl der Wegpunkte in der Zone in Klammern.
  • mower_errorCode - last error code
  • mower_errorCodeTimestamp - last error code time stamp
  • mower_errorDescription - error description
  • diff --git a/fhem/lib/FHEM/Devices/AMConnect/Common.pm b/fhem/lib/FHEM/Devices/AMConnect/Common.pm index fe04672a8..7387ac7e3 100644 --- a/fhem/lib/FHEM/Devices/AMConnect/Common.pm +++ b/fhem/lib/FHEM/Devices/AMConnect/Common.pm @@ -185,6 +185,7 @@ my $mapZonesTpl = '{ mapZonesTpl => $mapZonesTpl, posMinMax => "-180 90\n180 -90", newdatasets => 0, + newzonedatasets => 0, MAP_PATH => '', MAP_MIME => '', MAP_CACHE => '', @@ -727,7 +728,8 @@ sub AlignArray { } - if ( AttrVal($name, 'mapZones', 0) && $act =~ /^(MOWING)$/ && $actold =~ /^(MOWING|LEAVING|PARKED_IN_CS|CHARGING)$/ ) { + if ( AttrVal($name, 'mapZones', 0) && $act =~ /^(MOWING)$/ && $actold =~ /^(MOWING|LEAVING|PARKED_IN_CS|CHARGING)$/ + || $act =~ /^(GOING_HOME|PARKED_IN_CS|CHARGING)$/ && $actold =~ /^(MOWING)$/ ) { $tmp = dclone( \@ar ); ZoneHandling ( $hash, $tmp, $cnt ); @@ -849,7 +851,7 @@ sub ZoneHandling { if ( eval ("$hash->{helper}{mapZones}{$zonekeys[$k]}{condition}") ) { - if ( $hash->{helper}{mapZones}{$zonekeys[$k]}{curZoneCnt} == $i) { # find current zone and count consecutive way points + 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]; @@ -873,14 +875,15 @@ sub ZoneHandling { } - my $sumDayCnt=0; - map { $sumDayCnt += $hash->{helper}{mapZones}{$_}{zoneCnt} } @zonekeys; - map { $hash->{helper}{mapZones}{$_}{currentDayCntPct} = sprintf( "%.0f", $hash->{helper}{mapZones}{$_}{zoneCnt} / $sumDayCnt * 100 ) } @zonekeys; - } } + my $sumDayCnt=0; + map { $sumDayCnt += $hash->{helper}{mapZones}{$_}{zoneCnt} } @zonekeys; + map { $hash->{helper}{mapZones}{$_}{currentDayCntPct} = sprintf( "%.0f", $hash->{helper}{mapZones}{$_}{zoneCnt} / $sumDayCnt * 100 ) } @zonekeys if ( $sumDayCnt ); + $hash->{helper}{newzonedatasets} = $cnt; + } #########################