mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-25 03:44:52 +00:00
74_AutomowerConnect.pm: use widgetList for stayOutZones and workAreas setter, update commandref, some default values changed regarding design attributes
git-svn-id: https://svn.fhem.de/fhem/trunk@28784 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
b041b28e35
commit
70c82ce665
@ -1,5 +1,8 @@
|
||||
# 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: 74_AutomowerConnect.pm: use widgetList for stayOutZones
|
||||
and workAreas setter, update commandref, some default values
|
||||
changed regarding design attributes
|
||||
- bugfix: 72_FRITZBOX: commandRef
|
||||
perl Warnung beim Fhem Start
|
||||
- feature: 72_FRITZBOX: Info statische/dynamische IP Adresse Lan Device
|
||||
|
@ -179,7 +179,8 @@ __END__
|
||||
|
||||
<li><a id='AutomowerConnect-set-StartInWorkArea'>StartInWorkArea</a><br>
|
||||
<code>set <name> StartInWorkArea <workAreaId|name> [<number of minutes>]</code><br>
|
||||
Testing: Starts immediately in <workAreaId|name> for <number of minutes><br>
|
||||
Testing: Starts immediately in <workAreaId|name> for <number of minutes>.<br>
|
||||
If <number of minutes> is empty or 0 is selected in the widget the mower will continue forever.<br>
|
||||
Work area name must not include space.</li>
|
||||
|
||||
<li><a id='AutomowerConnect-set-chargingStationPositionToAttribute'>chargingStationPositionToAttribute</a><br>
|
||||
@ -198,13 +199,9 @@ __END__
|
||||
<code>set <name> cuttingHeightInWorkArea <Id|name> <0..100></code><br>
|
||||
Testing: Sets the cutting height for Id or zone name from 0 to 100. Zone name must not include space and contain at least one alphabetic character.</li>
|
||||
|
||||
<li><a id='AutomowerConnect-set-stayOutZone_enable'>stayOutZone_enable</a><br>
|
||||
<code>set <name> stayOutZone_enable <Id|name></code><br>
|
||||
Testing: Enables stay out zone by Id or zone name. Zone name must not include space and contain at least one alphabetic character.</li>
|
||||
|
||||
<li><a id='AutomowerConnect-set-stayOutZone_disable'>stayOutZone_disable</a><br>
|
||||
<code>set <name> stayOutZone_disable <Id|name></code><br>
|
||||
Testing: Disables stay out zone by Id or zone name. Zone name must not include space and contain at least one alphabetic character.</li>
|
||||
<li><a id='AutomowerConnect-set-stayOutZone'>stayOutZone</a><br>
|
||||
<code>set <name> stayOutZone <Id|name> <enable|disable></code><br>
|
||||
Testing: Enables or disables stay out zone by Id or zone name. Zone name must not include space and contain at least one alphabetic character.</li>
|
||||
|
||||
<li><a id='AutomowerConnect-set-getNewAccessToken'>getNewAccessToken</a><br>
|
||||
<code>set <name> getNewAccessToken</code><br>
|
||||
@ -304,7 +301,7 @@ __END__
|
||||
hullLineWidth="1"<br>
|
||||
hullConnector="1"<br>
|
||||
hullResolution="40"<br>
|
||||
hullCalculate=""<br>
|
||||
hullCalculate="1"<br>
|
||||
propertyLimitsColor="#33cc33"<br>
|
||||
propertyLimitsLineWidth="1"<br>
|
||||
propertyLimitsConnector="1"<br>
|
||||
@ -321,15 +318,15 @@ __END__
|
||||
otherActivityPathLineColor="#999999"<br>
|
||||
otherActivityPathLineDash="6,2"<br>
|
||||
otherActivityPathLineWidth="1"<br>
|
||||
otherActivityPathDotWidth="4"<br>
|
||||
otherActivityPathDotWidth="2"<br>
|
||||
leavingPathLineColor="#33cc33"<br>
|
||||
leavingPathLineDash="6,2"<br>
|
||||
leavingPathLineWidth="2"<br>
|
||||
leavingPathDotWidth="4"<br>
|
||||
leavingPathLineWidth="1"<br>
|
||||
leavingPathDotWidth="2"<br>
|
||||
goingHomePathLineColor="#0099ff"<br>
|
||||
goingHomePathLineDash="6,2"<br>
|
||||
goingHomePathLineWidth="2"<br>
|
||||
goingHomePathDotWidth="4"<br>
|
||||
goingHomePathLineWidth="1"<br>
|
||||
goingHomePathDotWidth="2"<br>
|
||||
mowingPathDisplayStart=""<br>
|
||||
mowingPathLineColor="#ff0000"<br>
|
||||
mowingPathLineDash="6,2"<br>
|
||||
@ -613,6 +610,7 @@ __END__
|
||||
<li><a id='AutomowerConnect-set-StartInWorkArea'>StartInWorkArea</a><br>
|
||||
<code>set <name> StartInWorkArea <workAreaId|zone name> [<number of minutes>]</code><br>
|
||||
Testing: Startet sofort in <workAreaId|name> für <number of minutes><br>
|
||||
Wenn <number of minutes> nicht angegeben wird oder im Auswahlfeld 0 gewählt wird, dann wird der Mähvorgang bis auf Weiteres fortgesetzt.<br>
|
||||
Der Name der WorkArea darf keine Leerzeichen beinhalten und muss mindestens einen Buchstaben enthalten.</li>
|
||||
|
||||
<li><a id='AutomowerConnect-set-chargingStationPositionToAttribute'>chargingStationPositionToAttribute</a><br>
|
||||
@ -631,13 +629,10 @@ __END__
|
||||
<code>set <name> cuttingHeightInWorkArea <Id|name> <0..100></code><br>
|
||||
Testing: Setzt die Schnitthöhe für Id oder Zonennamen von 0 bis 100. Der Zonenname darf keine Leerzeichen beinhalten und muss mindestens einen Buchstaben enthalten.</li>
|
||||
|
||||
<li><a id='AutomowerConnect-set-stayOutZone_enable'>stayOutZone_enable</a><br>
|
||||
<code>set <name> stayOutZone_enable <Id|zone name></code><br>
|
||||
Testing: Enabled stayOutZone für die Id oder den Namen der Zone, er darf keine Leerzeichen beinhalten und muss mindestens einen Buchstaben enthalten.</li>
|
||||
|
||||
<li><a id='AutomowerConnect-set-stayOutZone_disable'>stayOutZone_disable</a><br>
|
||||
<code>set <name> stayOutZone_disable <Id|zone name></code><br>
|
||||
Testing: Disabled stayOutZone für die Id oder den Namen der Zone, er darf keine Leerzeichen beinhalten und muss mindestens einen Buchstaben enthalten.</li>
|
||||
<li><a id='AutomowerConnect-set-stayOutZone'>stayOutZone</a><br>
|
||||
<code>set <name> stayOutZone <Id|name> <enable|disable></code><br>
|
||||
Testing: Schaltet stayOutZone ein oder aus, für die Id oder den Namen der Zone.<br>
|
||||
Der Zonenname darf keine Leerzeichen beinhalten und muss mindestens einen Buchstaben enthalten.</li>
|
||||
|
||||
<li><a id='AutomowerConnect-set-confirmError'>confirmError</a><br>
|
||||
<code>set <name> confirmError</code><br>
|
||||
@ -741,7 +736,7 @@ __END__
|
||||
hullLineWidth="1"<br>
|
||||
hullConnector="1"<br>
|
||||
hullResolution="40"<br>
|
||||
hullCalculate=""<br>
|
||||
hullCalculate="1"<br>
|
||||
propertyLimitsColor="#33cc33"<br>
|
||||
propertyLimitsLineWidth="1"<br>
|
||||
propertyLimitsConnector="1"<br>
|
||||
@ -758,15 +753,15 @@ __END__
|
||||
otherActivityPathLineColor="#999999"<br>
|
||||
otherActivityPathLineDash="6,2"<br>
|
||||
otherActivityPathLineWidth="1"<br>
|
||||
otherActivityPathDotWidth="4"<br>
|
||||
otherActivityPathDotWidth="2"<br>
|
||||
leavingPathLineColor="#33cc33"<br>
|
||||
leavingPathLineDash="6,2"<br>
|
||||
leavingPathLineWidth="2"<br>
|
||||
leavingPathDotWidth="4"<br>
|
||||
leavingPathDotWidth="2"<br>
|
||||
goingHomePathLineColor="#0099ff"<br>
|
||||
goingHomePathLineDash="6,2"<br>
|
||||
goingHomePathLineWidth="2"<br>
|
||||
goingHomePathDotWidth="4"<br>
|
||||
goingHomePathDotWidth="2"<br>
|
||||
mowingPathDisplayStart=""<br>
|
||||
mowingPathLineColor="#ff0000"<br>
|
||||
mowingPathLineDash="6,2"<br>
|
||||
@ -831,8 +826,8 @@ __END__
|
||||
<li><a id='AutomowerConnect-attr-scaleToMeterXY'>scaleToMeterXY</a><br>
|
||||
<code>attr <name> scaleToMeterXY <scale factor longitude><seperator><scale factor latitude></code><br>
|
||||
Der Skalierfaktor hängt vom Standort ab und muss daher für kurze Strecken berechnet werden. <seperator> ist 1 Leerzeichen.<br>
|
||||
Longitude: <code>(LongitudeMeter_1 - LongitudeMeter_2) / (LongitudeDegree_1 - LongitudeDegree _2)</code><br>
|
||||
Latitude: <code>(LatitudeMeter_1 - LatitudeMeter_2) / (LatitudeDegree_1 - LatitudeDegree _2)</code></li>
|
||||
Longitude: <code>(LongitudeMeter_1 - LongitudeMeter_2) / (LongitudeDegree_1 - LongitudeDegree_2)</code><br>
|
||||
Latitude: <code>(LatitudeMeter_1 - LatitudeMeter_2) / (LatitudeDegree_1 - LatitudeDegree_2)</code></li>
|
||||
|
||||
<li><a id='AutomowerConnect-attr-mapZones'>mapZones</a><br>
|
||||
<code>attr <name> mapZones <JSON string with zone names in alpabetical order and valid perl condition to seperate the zones></code><br>
|
||||
@ -897,7 +892,7 @@ __END__
|
||||
Mit dem Designattribut 'hullResolution' kann die Anzahl der Brechungen beeinflusst werden ℕ, Default 40.<br>
|
||||
Das Hüllenpolygon wird berechnet wenn das Designattribute gesetzt ist, <code>hullCalculate="1"</code> und es mehr als 50 Wegpunkte der Aktivität MOWING gibt.<br>
|
||||
Die Berechnung wird beim Laden oder Wiederladen der Website ausgeführt.<br>
|
||||
Die Berechnung stopt wenn dieses Attribut gesetzt ist und startet wenn das Attibut gelöst wird.<br>
|
||||
Die Berechnung stopt wenn dieses Attribut gesetzt ist und startet wenn das Attibut gelöscht wird.<br>
|
||||
Das Attribut <code>weekdaysToResetWayPoints</code> sollte auf <code>-</code> und das Designattribut <code>mowingPathUseDots</code> sollte auf <code>"1"</code> gesetzt werden, bis das Polygon die Hülle der Mähfläche zufriedenstellend abbildet.
|
||||
</li>
|
||||
|
||||
|
@ -132,7 +132,7 @@ hullColor="#0066ff"
|
||||
hullLineWidth="1"
|
||||
hullConnector="1"
|
||||
hullResolution="40"
|
||||
hullCalculate=""
|
||||
hullCalculate="1"
|
||||
propertyLimitsColor="#33cc33"
|
||||
propertyLimitsLineWidth="1"
|
||||
propertyLimitsConnector="1"
|
||||
@ -149,15 +149,15 @@ chargingStationPathDotWidth="2"
|
||||
otherActivityPathLineColor="#999999"
|
||||
otherActivityPathLineDash="6,2"
|
||||
otherActivityPathLineWidth="1"
|
||||
otherActivityPathDotWidth="4"
|
||||
otherActivityPathDotWidth="2"
|
||||
leavingPathLineColor="#33cc33"
|
||||
leavingPathLineDash="6,2"
|
||||
leavingPathLineWidth="2"
|
||||
leavingPathDotWidth="4"
|
||||
leavingPathLineWidth="1"
|
||||
leavingPathDotWidth="2"
|
||||
goingHomePathLineColor="#0099ff"
|
||||
goingHomePathLineDash="6,2"
|
||||
goingHomePathLineWidth="2"
|
||||
goingHomePathDotWidth="4"
|
||||
goingHomePathLineWidth="1"
|
||||
goingHomePathDotWidth="2"
|
||||
mowingPathDisplayStart=""
|
||||
mowingPathLineColor="#ff0000"
|
||||
mowingPathLineDash="6,2"
|
||||
@ -1120,7 +1120,7 @@ sub CMD {
|
||||
my $iam = "$type $name CMD:";
|
||||
my $timeout = AttrVal( $name, 'timeoutCMD', $hash->{helper}->{timeout_cmd} );
|
||||
my $method = 'POST';
|
||||
$hash->{helper}{mower_commandSend} = $cmd[ 0 ] . ' ' . ( $cmd[ 1 ] ? $cmd[ 1 ] : '' );
|
||||
$hash->{helper}{mower_commandSend} = $cmd[ 0 ] . ( $cmd[ 1 ] ? ' '.$cmd[ 1 ] : '' ) . ( $cmd[ 2 ] ? ' '.$cmd[ 2 ] : '' );
|
||||
|
||||
if ( IsDisabled( $name ) ) {
|
||||
|
||||
@ -1154,8 +1154,7 @@ my $header = "Accept: application/vnd.api+json\r\nX-Api-Key: ".$client_id."\r\nA
|
||||
{ $json = '{"data": {"type":"'.$cmd[0].'","attributes":{"workAreaId":'.$cmd[1].'}}}'; $post = 'actions' }
|
||||
elsif ($cmd[0] eq "headlight") { $json = '{"data": {"type":"settings","attributes":{"'.$cmd[0].'": {"mode": "'.$cmd[1].'"}}}}'; $post = 'settings' }
|
||||
elsif ($cmd[0] eq "cuttingHeight") { $json = '{"data": {"type":"settings","attributes":{"'.$cmd[0].'": '.$cmd[1].'}}}'; $post = 'settings' }
|
||||
elsif ($cmd[0] eq "stayOutZone_enable") { $json = '{"data": {"type":"stayOutZone","id":"'.$cmd[1].'","attributes":{"enable": true}}}'; $post = 'stayOutZones/' . $cmd[1]; $method = 'PATCH' }
|
||||
elsif ($cmd[0] eq "stayOutZone_disable") { $json = '{"data": {"type":"stayOutZone","id":"'.$cmd[1].'","attributes":{"enable": false}}}'; $post = 'stayOutZones/' . $cmd[1]; $method = 'PATCH' }
|
||||
elsif ($cmd[0] eq "stayOutZone") { $json = '{"data": {"type":"stayOutZone","id":"'.$cmd[1].'","attributes":{"enable": '.$cmd[2].'}}}'; $post = 'stayOutZones/' . $cmd[1]; $method = 'PATCH' }
|
||||
elsif ($cmd[0] eq "confirmError") { $json = '{}'; $post = 'errors/confirm' }
|
||||
elsif ($cmd[0] eq "sendScheduleFromAttributeToMower" && AttrVal( $name, 'mowerSchedule', '')) {
|
||||
|
||||
@ -1275,15 +1274,6 @@ sub Set {
|
||||
CommandAttr( $hash, "$name chargingStationCoordinates $xm $ym" );
|
||||
return undef;
|
||||
|
||||
# } elsif ( $setName eq 'mowingAreaHullToAttribute' ) {
|
||||
|
||||
# if ( $FW_ME ) {
|
||||
# map {
|
||||
# ::FW_directNotify("#FHEMWEB:$_", "AutomowerConnectGetHull ( '$FW_ME/$type/$name/json' )","");
|
||||
# } devspec2array("TYPE=FHEMWEB");
|
||||
# return undef;
|
||||
# }
|
||||
|
||||
} elsif ( $setName eq 'defaultDesignAttributesToAttribute' ) {
|
||||
|
||||
my $design = $hash->{helper}{mapdesign};
|
||||
@ -1363,6 +1353,7 @@ sub Set {
|
||||
|
||||
} elsif ( ReadingsVal( $name, 'device_state', 'defined' ) !~ /defined|initialized|authentification|authenticated|update/ && $setName =~ /^(StartInWorkArea|cuttingHeightInWorkArea)$/ && AttrVal( $name, 'testing', '' ) ) {
|
||||
|
||||
( $setVal, $setVal2 ) = $setVal =~ /(.*),(\d+)/ if ( $setVal =~/,/ && ! defined( $setVal2 ) );
|
||||
my $id = undef;
|
||||
$id = name2id( $hash, $setVal, 'workAreas' ) if ( $setVal !~ /^(\d+)$/ );
|
||||
$setVal = $id // $setVal;
|
||||
@ -1375,14 +1366,16 @@ sub Set {
|
||||
|
||||
Log3 $name, 2, "$iam $setName : no valid Id or zone name for $setVal .";
|
||||
|
||||
} elsif ( ReadingsVal( $name, 'device_state', 'defined' ) !~ /defined|initialized|authentification|authenticated|update/ && $setName =~ /^stayOutZone_(enable|disable)$/ && AttrVal( $name, 'testing', '' ) ) {
|
||||
} elsif ( ReadingsVal( $name, 'device_state', 'defined' ) !~ /defined|initialized|authentification|authenticated|update/ && $setName =~ /^stayOutZone$/ && AttrVal( $name, 'testing', '' ) ) {
|
||||
|
||||
( $setVal, $setVal2 ) = $setVal =~ /(.*),(enable|disable)/ if ( $setVal =~/,/ && ! defined( $setVal2 ) );
|
||||
my $id = undef;
|
||||
$id = name2id( $hash, $setVal, 'stayOutZones' ) if ( $setVal !~ /\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b/ );
|
||||
$setVal = $id // $setVal;
|
||||
if ( $setVal =~ /\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b/ ) { # && $hash->{helper}{mower}{attributes}{capabilities}{stayOutZones}
|
||||
|
||||
CMD($hash ,$setName, $setVal);
|
||||
$setVal2 = $setVal2 eq 'enable' ? 'true' : 'false';
|
||||
CMD($hash ,$setName, $setVal, $setVal2);
|
||||
return undef;
|
||||
|
||||
}
|
||||
@ -1390,12 +1383,28 @@ sub Set {
|
||||
Log3 $name, 2, "$iam $setName : no valid Id or zone name for $setVal .";
|
||||
|
||||
}
|
||||
my $ret = " getNewAccessToken:noArg ParkUntilFurtherNotice:noArg ParkUntilNextSchedule:noArg Pause:noArg Start:selectnumbers,60,60,600,0,lin Park:selectnumbers,60,60,600,0,lin ResumeSchedule:noArg getUpdate:noArg client_secret ";
|
||||
my $ret = " getNewAccessToken:noArg ParkUntilFurtherNotice:noArg ParkUntilNextSchedule:noArg Pause:noArg Start:selectnumbers,30,30,600,0,lin Park:selectnumbers,30,30,600,0,lin ResumeSchedule:noArg getUpdate:noArg client_secret ";
|
||||
$ret .= "chargingStationPositionToAttribute:noArg headlight:ALWAYS_OFF,ALWAYS_ON,EVENING_ONLY,EVENING_AND_NIGHT cuttingHeight:1,2,3,4,5,6,7,8,9 mowerScheduleToAttribute:noArg ";
|
||||
$ret .= "sendScheduleFromAttributeToMower:noArg defaultDesignAttributesToAttribute:noArg mapZonesTemplateToAttribute:noArg ";
|
||||
$ret .= "StartInWorkArea cuttingHeightInWorkArea " if ( $hash->{helper}{mower}{attributes}{capabilities}{workAreas} && AttrVal( $name, 'testing', '' ) );
|
||||
|
||||
if ( $hash->{helper}{mower}{attributes}{capabilities}{workAreas} && defined ( $hash->{helper}{mower}{attributes}{workAreas} ) && AttrVal( $name, 'testing', '' ) ) {
|
||||
|
||||
my @ar = @{ $hash->{helper}{mower}{attributes}{workAreas} };
|
||||
my @anlist = map { ','.$_->{name} } @ar;
|
||||
$ret .= "cuttingHeightInWorkArea:widgetList,".(scalar @anlist + 1).",select".join('',@anlist).",6,selectnumbers,0,10,100,0,lin ";
|
||||
$ret .= "StartInWorkArea:widgetList,".(scalar @anlist + 1).",select".join('',@anlist).",6,selectnumbers,0,30,600,0,lin ";
|
||||
|
||||
}
|
||||
|
||||
if ( $hash->{helper}{mower}{attributes}{capabilities}{stayOutZones} && defined ( $hash->{helper}{mower}{attributes}{stayOutZones}{zones} ) && AttrVal( $name, 'testing', '' ) ) {
|
||||
|
||||
my @so = @{ $hash->{helper}{mower}{attributes}{stayOutZones}{zones} };
|
||||
my @solist = map { ','.$_->{name} } @so;
|
||||
$ret .= "stayOutZone:widgetList,".(scalar @solist + 1).",select".join('',@solist).",3,select,enable,disable ";
|
||||
|
||||
}
|
||||
|
||||
$ret .= "confirmError:noArg " if ( AttrVal( $name, 'testing', '' ) );
|
||||
$ret .= "stayOutZone_enable stayOutZone_disable " if ( $hash->{helper}{mower}{attributes}{capabilities}{stayOutZones} && AttrVal( $name, 'testing', '' ) );
|
||||
return "Unknown argument $setName, choose one of".$ret;
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user