diff --git a/fhem/CHANGED b/fhem/CHANGED index 0aad968c0..eb820c91b 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -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 diff --git a/fhem/FHEM/74_AutomowerConnect.pm b/fhem/FHEM/74_AutomowerConnect.pm index a67798481..d62b068f9 100644 --- a/fhem/FHEM/74_AutomowerConnect.pm +++ b/fhem/FHEM/74_AutomowerConnect.pm @@ -179,7 +179,8 @@ __END__
  • StartInWorkArea
    set <name> StartInWorkArea <workAreaId|name> [<number of minutes>]
    - Testing: Starts immediately in <workAreaId|name> for <number of minutes>
    + Testing: Starts immediately in <workAreaId|name> for <number of minutes>.
    + If <number of minutes> is empty or 0 is selected in the widget the mower will continue forever.
    Work area name must not include space.
  • chargingStationPositionToAttribute
    @@ -198,13 +199,9 @@ __END__ set <name> cuttingHeightInWorkArea <Id|name> <0..100>
    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.
  • -
  • stayOutZone_enable
    - set <name> stayOutZone_enable <Id|name>
    - Testing: Enables stay out zone by Id or zone name. Zone name must not include space and contain at least one alphabetic character.
  • - -
  • stayOutZone_disable
    - set <name> stayOutZone_disable <Id|name>
    - Testing: Disables stay out zone by Id or zone name. Zone name must not include space and contain at least one alphabetic character.
  • +
  • stayOutZone
    + set <name> stayOutZone <Id|name> <enable|disable>
    + 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.
  • getNewAccessToken
    set <name> getNewAccessToken
    @@ -304,7 +301,7 @@ __END__ hullLineWidth="1"
    hullConnector="1"
    hullResolution="40"
    - hullCalculate=""
    + hullCalculate="1"
    propertyLimitsColor="#33cc33"
    propertyLimitsLineWidth="1"
    propertyLimitsConnector="1"
    @@ -321,15 +318,15 @@ __END__ 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"
    @@ -613,6 +610,7 @@ __END__
  • StartInWorkArea
    set <name> StartInWorkArea <workAreaId|zone name> [<number of minutes>]
    Testing: Startet sofort in <workAreaId|name> für <number of minutes>
    + Wenn <number of minutes> nicht angegeben wird oder im Auswahlfeld 0 gewählt wird, dann wird der Mähvorgang bis auf Weiteres fortgesetzt.
    Der Name der WorkArea darf keine Leerzeichen beinhalten und muss mindestens einen Buchstaben enthalten.
  • chargingStationPositionToAttribute
    @@ -631,13 +629,10 @@ __END__ set <name> cuttingHeightInWorkArea <Id|name> <0..100>
    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.
  • -
  • stayOutZone_enable
    - set <name> stayOutZone_enable <Id|zone name>
    - Testing: Enabled stayOutZone für die Id oder den Namen der Zone, er darf keine Leerzeichen beinhalten und muss mindestens einen Buchstaben enthalten.
  • - -
  • stayOutZone_disable
    - set <name> stayOutZone_disable <Id|zone name>
    - Testing: Disabled stayOutZone für die Id oder den Namen der Zone, er darf keine Leerzeichen beinhalten und muss mindestens einen Buchstaben enthalten.
  • +
  • stayOutZone
    + set <name> stayOutZone <Id|name> <enable|disable>
    + Testing: Schaltet stayOutZone ein oder aus, für die Id oder den Namen der Zone.
    + Der Zonenname darf keine Leerzeichen beinhalten und muss mindestens einen Buchstaben enthalten.
  • confirmError
    set <name> confirmError
    @@ -741,7 +736,7 @@ __END__ hullLineWidth="1"
    hullConnector="1"
    hullResolution="40"
    - hullCalculate=""
    + hullCalculate="1"
    propertyLimitsColor="#33cc33"
    propertyLimitsLineWidth="1"
    propertyLimitsConnector="1"
    @@ -758,15 +753,15 @@ __END__ otherActivityPathLineColor="#999999"
    otherActivityPathLineDash="6,2"
    otherActivityPathLineWidth="1"
    - otherActivityPathDotWidth="4"
    + otherActivityPathDotWidth="2"
    leavingPathLineColor="#33cc33"
    leavingPathLineDash="6,2"
    leavingPathLineWidth="2"
    - leavingPathDotWidth="4"
    + leavingPathDotWidth="2"
    goingHomePathLineColor="#0099ff"
    goingHomePathLineDash="6,2"
    goingHomePathLineWidth="2"
    - goingHomePathDotWidth="4"
    + goingHomePathDotWidth="2"
    mowingPathDisplayStart=""
    mowingPathLineColor="#ff0000"
    mowingPathLineDash="6,2"
    @@ -831,8 +826,8 @@ __END__
  • scaleToMeterXY
    attr <name> scaleToMeterXY <scale factor longitude><seperator><scale factor latitude>
    Der Skalierfaktor hängt vom Standort ab und muss daher für kurze Strecken berechnet werden. <seperator> ist 1 Leerzeichen.
    - Longitude: (LongitudeMeter_1 - LongitudeMeter_2) / (LongitudeDegree_1 - LongitudeDegree _2)
    - Latitude: (LatitudeMeter_1 - LatitudeMeter_2) / (LatitudeDegree_1 - LatitudeDegree _2)
  • + Longitude: (LongitudeMeter_1 - LongitudeMeter_2) / (LongitudeDegree_1 - LongitudeDegree_2)
    + Latitude: (LatitudeMeter_1 - LatitudeMeter_2) / (LatitudeDegree_1 - LatitudeDegree_2)
  • mapZones
    attr <name> mapZones <JSON string with zone names in alpabetical order and valid perl condition to seperate the zones>
    @@ -897,7 +892,7 @@ __END__ Mit dem Designattribut 'hullResolution' kann die Anzahl der Brechungen beeinflusst werden ℕ, Default 40.
    Das Hüllenpolygon wird berechnet wenn das Designattribute gesetzt ist, hullCalculate="1" und es mehr als 50 Wegpunkte der Aktivität MOWING gibt.
    Die Berechnung wird beim Laden oder Wiederladen der Website ausgeführt.
    - Die Berechnung stopt wenn dieses Attribut gesetzt ist und startet wenn das Attibut gelöst wird.
    + Die Berechnung stopt wenn dieses Attribut gesetzt ist und startet wenn das Attibut gelöscht wird.
    Das Attribut weekdaysToResetWayPoints sollte auf - und das Designattribut mowingPathUseDots sollte auf "1" gesetzt werden, bis das Polygon die Hülle der Mähfläche zufriedenstellend abbildet.
  • diff --git a/fhem/lib/FHEM/Devices/AMConnect/Common.pm b/fhem/lib/FHEM/Devices/AMConnect/Common.pm index 6cbc354db..538b69139 100644 --- a/fhem/lib/FHEM/Devices/AMConnect/Common.pm +++ b/fhem/lib/FHEM/Devices/AMConnect/Common.pm @@ -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; }