2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

AutomowerConnect(Device): add attribute to determine the days of a week when the way point stack will be reset

git-svn-id: https://svn.fhem.de/fhem/trunk@27448 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Ellert 2023-04-15 17:08:41 +00:00
parent 6eaec0e570
commit ade33c4b3f
3 changed files with 73 additions and 17 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.
- feature: 7x_AutomowerConnect(Device): add attribute to determine
the days of a week when the way point stack will be reset
- bugfix: AutomowerConnectFamily:minor fixes and changes in cref
- bugfix: 72_FRITZBOX: kleinere Korrekturen
- bugfix: 72_FRITZBOX: TR-064 Problem (topic=133142.0)

View File

@ -119,6 +119,7 @@ sub Initialize() {
"mowerSchedule:textField-long " .
"mowingAreaLimits:textField-long " .
"propertyLimits:textField-long " .
"weekdaysToResetWayPoints " .
"numberOfWayPointsToDisplay " .
$readingFnAttributes;
@ -421,11 +422,16 @@ sub getMowerResponse {
$hash->{helper}{statistics}{currentWeekTrack} = 0;
$hash->{helper}{statistics}{currentWeekArea} = 0;
#clear position arrays
}
#clear position arrays
if ( AttrVal( $name, 'weekdaysToResetWayPoints', 1 ) =~ $time[6] ) {
$hash->{helper}{areapos} = [];
$hash->{helper}{otherpos} = [];
}
}
readingsSingleUpdate($hash, 'state', 'connected', 1 );
@ -589,6 +595,19 @@ sub Attr {
}
##########
} elsif( $attrName eq "weekdaysToResetWayPoints" ) {
if( $cmd eq "set" ) {
return "$iam $attrName is invalid enter a combination of weekday numbers <0123456>" unless( $attrVal =~ /0|1|2|3|4|5|6/ );
Log3 $name, 3, "$iam $cmd $attrName $attrVal";
} elsif( $cmd eq "del" ) {
Log3 $name, 3, "$iam $cmd $attrName and set default to 1";
}
##########
} elsif ( $attrName eq 'numberOfWayPointsToDisplay' ) {
my $icurr = @{$hash->{helper}{areapos}};
@ -966,6 +985,10 @@ __END__
While in activity MOWING every 30 s a geo data set is generated.
While in activity PARKED_IN_CS/CHARGING every 42 min a geo data set is generated.</li>
<li><a id='AutomowerConnect-attr-weekdaysToResetWayPoints'>weekdaysToResetWayPoints</a><br>
<code>attr &lt;name&gt; weekdaysToResetWayPoints &lt;any combination of weekday numbers from 0123456&gt;</code><br>
A combination of weekday numbers when the way point stack will be reset, default 1.</li>
<li><a id='AutomowerConnect-attr-scaleToMeterXY'>scaleToMeterXY</a><br>
<code>attr &lt;name&gt; scaleToMeterXY &lt;scale factor longitude&gt;&lt;seperator&gt;&lt;scale factor latitude&gt;</code><br>
The scale factor depends from the Location on earth, so it has to be calculated for short ranges only. &lt;seperator&gt; is one space character.<br>
@ -1246,6 +1269,10 @@ __END__
Legt die Anzahl der gespeicherten und und anzuzeigenden Wegpunkte fest, default 5000
Während der Aktivität MOWING wird ca. alle 30 s und während PARKED_IN_CS/CHARGING wird alle 42 min ein Geodatensatz erzeugt.</li>
<li><a id='AutomowerConnect-attr-weekdaysToResetWayPoints'>weekdaysToResetWayPoints</a><br>
<code>attr &lt;name&gt; weekdaysToResetWayPoints &lt;any combination of weekday numbers from 0123456&gt;</code><br>
Eine Kombination von Wochentagnummern an denen der Wegpunktspeicher gelöscht wird, default 1.</li>
<li><a id='AutomowerConnect-attr-scaleToMeterXY'>scaleToMeterXY</a><br>
<code>attr &lt;name&gt; scaleToMeterXY &lt;scale factor longitude&gt;&lt;seperator&gt;&lt;scale factor latitude&gt;</code><br>
Der Skalierfaktor hängt vom Standort ab und muss daher für kurze Strecken berechnet werden. &lt;seperator&gt; ist 1 Leerzeichen.<br>

View File

@ -114,6 +114,7 @@ sub Initialize() {
"mowingAreaLimits:textField-long " .
"propertyLimits:textField-long " .
"numberOfWayPointsToDisplay " .
"weekdaysToResetWayPoints " .
$readingFnAttributes;
return undef;
@ -240,25 +241,30 @@ sub Notify {
# do at midnight
if ( $secs <= $interval ) {
$hash->{helper}{statistics}{lastDayTrack} = $hash->{helper}{statistics}{currentDayTrack};
$hash->{helper}{statistics}{lastDayArea} = $hash->{helper}{statistics}{currentDayArea};
$hash->{helper}{statistics}{currentWeekTrack} += $hash->{helper}{statistics}{currentDayTrack};
$hash->{helper}{statistics}{currentWeekArea} += $hash->{helper}{statistics}{currentDayArea};
$hash->{helper}{statistics}{currentDayTrack} = 0;
$hash->{helper}{statistics}{currentDayArea} = 0;
# do on mondays
if ( $time[6] == 1 ) {
$hash->{helper}{statistics}{lastDayTrack} = $hash->{helper}{statistics}{currentDayTrack};
$hash->{helper}{statistics}{lastDayArea} = $hash->{helper}{statistics}{currentDayArea};
$hash->{helper}{statistics}{currentWeekTrack} += $hash->{helper}{statistics}{currentDayTrack};
$hash->{helper}{statistics}{currentWeekArea} += $hash->{helper}{statistics}{currentDayArea};
$hash->{helper}{statistics}{currentDayTrack} = 0;
$hash->{helper}{statistics}{currentDayArea} = 0;
# do on mondays
if ( $time[6] == 1 ) {
$hash->{helper}{statistics}{lastWeekTrack} = $hash->{helper}{statistics}{currentWeekTrack};
$hash->{helper}{statistics}{lastWeekArea} = $hash->{helper}{statistics}{currentWeekArea};
$hash->{helper}{statistics}{currentWeekTrack} = 0;
$hash->{helper}{statistics}{currentWeekArea} = 0;
#clear position arrays
$hash->{helper}{areapos} = [];
$hash->{helper}{otherpos} = [];
$hash->{helper}{statistics}{lastWeekTrack} = $hash->{helper}{statistics}{currentWeekTrack};
$hash->{helper}{statistics}{lastWeekArea} = $hash->{helper}{statistics}{currentWeekArea};
$hash->{helper}{statistics}{currentWeekTrack} = 0;
$hash->{helper}{statistics}{currentWeekArea} = 0;
}
#clear position arrays
if ( AttrVal( $name, 'weekdaysToResetWayPoints', 1 ) =~ $time[6] ) {
$hash->{helper}{areapos} = [];
$hash->{helper}{otherpos} = [];
}
}
readingsSingleUpdate($hash, 'state', 'connected',1);
@ -390,6 +396,19 @@ sub Attr {
}
##########
} elsif( $attrName eq "weekdaysToResetWayPoints" ) {
if( $cmd eq "set" ) {
return "$iam $attrName is invalid enter a combination of weekday numbers <0123456>" unless( $attrVal =~ /0|1|2|3|4|5|6/ );
Log3 $name, 3, "$iam $cmd $attrName $attrVal";
} elsif( $cmd eq "del" ) {
Log3 $name, 3, "$iam $cmd $attrName and set default to 1";
}
##########
} elsif ( $attrName eq 'numberOfWayPointsToDisplay' ) {
my $icurr = @{$hash->{helper}{areapos}};
@ -719,6 +738,14 @@ __END__
While in activity MOWING every 30 s a geo data set is generated.
While in activity PARKED_IN_CS/CHARGING every 42 min a geo data set is generated.</li>
<li><a id='AutomowerConnect-attr-weekdaysToResetWayPoints'>weekdaysToResetWayPoints</a><br>
<code>attr &lt;name&gt; weekdaysToResetWayPoints &lt;any combination of weekday numbers from 0123456&gt;</code><br>
A combination of weekday numbers when the way point stack will be reset, default 1.</li>
<li><a id='AutomowerConnect-attr-weekdaysToResetWayPoints'>weekdaysToResetWayPoints</a><br>
<code>attr &lt;name&gt; weekdaysToResetWayPoints &lt;any combination of weekday numbers from 0123456&gt;</code><br>
Eine Kombination von Wochentagnummern an denen der Wegpunktspeicher gelöscht wird, default 1.</li>
<li><a id='AutomowerConnectDevice-attr-scaleToMeterXY'>scaleToMeterXY</a><br>
<code>attr &lt;name&gt; scaleToMeterXY &lt;scale factor longitude&gt;&lt;seperator&gt;&lt;scale factor latitude&gt;</code><br>
The scale factor depends from the Location on earth, so it has to be calculated for short ranges only. &lt;seperator&gt; is one space character.<br>