###############################################################################
#
# $Id$
#
# This script is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# any later version.
#
# The GNU General Public License can be found at
# http://www.gnu.org/copyleft/gpl.html.
# A copy is found in the textfile GPL.txt and important notices to the license
# from the author is found in LICENSE.txt distributed with these scripts.
#
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
#
# Husqvarnas Open API is used
# based on some ideas from HusqvarnaAutomower and BOTVAC module
#
################################################################################
package FHEM::AutomowerConnect;
our $cvsid = '$Id$';
use strict;
use warnings;
use POSIX;
# wird für den Import der FHEM Funktionen aus der fhem.pl benötigt
use GPUtils qw(:all);
GP_Export(
qw(
Initialize
)
);
require FHEM::Devices::AMConnect::Common;
##############################################################
sub Initialize() {
my ($hash) = @_;
$hash->{DefFn} = \&FHEM::Devices::AMConnect::Common::Define;
$hash->{GetFn} = \&FHEM::Devices::AMConnect::Common::Get;
$hash->{UndefFn} = \&FHEM::Devices::AMConnect::Common::Undefine;
$hash->{DeleteFn} = \&FHEM::Devices::AMConnect::Common::Delete;
$hash->{ShutdownFn} = \&FHEM::Devices::AMConnect::Common::Shutdown;
$hash->{RenameFn} = \&FHEM::Devices::AMConnect::Common::Rename;
$hash->{FW_detailFn} = \&FHEM::Devices::AMConnect::Common::FW_detailFn;
# $hash->{FW_summaryFn} = \&FHEM::Devices::AMConnect::Common::FW_summaryFn;
$hash->{ReadFn} = \&FHEM::Devices::AMConnect::Common::wsRead;
$hash->{ReadyFn} = \&FHEM::Devices::AMConnect::Common::wsReady;
$hash->{SetFn} = \&FHEM::Devices::AMConnect::Common::Set;
$hash->{AttrFn} = \&FHEM::Devices::AMConnect::Common::Attr;
$hash->{AttrList} = "disable:1,0 " .
"debug:1,0 " .
"disabledForIntervals " .
"mapImagePath " .
"mapImageWidthHeight " .
"mapImageCoordinatesToRegister:textField-long " .
"mapImageCoordinatesUTM:textField-long " .
"mapImageZoom " .
"mapBackgroundColor " .
"mapDesignAttributes:textField-long " .
"mapZones:textField-long " .
"showMap:1,0 " .
"chargingStationCoordinates " .
"chargingStationImagePosition:left,top,right,bottom,center " .
"scaleToMeterXY " .
"mowerCuttingWidth " .
"mowerPanel:textField-long,85 " .
"mowerSchedule:textField-long " .
"mowingAreaLimits:textField-long " .
"mowingAreaHull:textField-long " .
"propertyLimits:textField-long " .
"weekdaysToResetWayPoints " .
"numberOfWayPointsToDisplay " .
"addPollingMinInterval " .
"addPositionPolling:1,0 " .
$::readingFnAttributes;
$::data{FWEXT}{AutomowerConnect}{SCRIPT} = 'automowerconnect.js';
$::data{FWEXT}{AutomowerConnectA}{SCRIPT} = '/automowerconnect/hull.js';
return undef;
}
##############################################################
1;
__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)
=begin html
This module allows the communication between the Husqvarna Cloud and FHEM to control Husqvarna Automower equipped with a Connect Module (SIM).
It acts as Device for one mower. Use this Module for aditional mower registered in the API. Provide a different application key and application secret each mower
The mower path is shown in the detail view.
An arbitrary map can be used as background for the mower path.
The map has to be a raster image in webp, png or jpg format.
The property limits can be registered manually.
The mowing area limits can be registered manually.
The mowing area limits can be calculated, alternatively.
It's possible to control everything the API offers, e.g. schedule, headlight, cutting height and actions like start, pause, park etc.
Zones are definable.
Cutting height can be set for each zone differently.
All API data is stored in the device hash. Use {Dumper $defs{<name>}} in the commandline to find the data and build userReadings out of it.
Requirements
To get access to the API an application has to be created in the Husqvarna Developer Portal. The application has to be connected with the AutomowerConnect API.
During registration an application key (client_id) and an application secret (client secret) is provided. Use these for the module.
The module uses client credentials as grant type for authorization.
The module downloads third party software from external server necessary to calculate the hull of mowing area.
Define
define <device name> AutomowerConnect <application key> [<mower number>]
Example: define myMower AutomowerConnect 123456789012345678901234567890123456 First device: the default mower number is 0.
It has to be set a client_secret. It's the application secret from the Husqvarna Developer Portal. set myMower <client secret>
Button
Mower Schedule
The Button opens GUI to maintain the mower schedule..
Add/change entry: fill out the schedule fields and press .
Delete entry: unselect each weekday and press .
Reset entry: fill any time field with -- and press .
Set
Park set <name> Park <number of minutes>
Parks mower in charging station for <number of minutes>
ParkUntilFurtherNotice set <name> ParkUntilFurtherNotice
Parks mower in charging station until further notice
ParkUntilNextSchedule set <name> ParkUntilNextSchedule
Parks mower in charging station and starts with next planned start
Pause set <name> Pause
Pauses mower immediately at current position
ResumeSchedule set <name> ResumeSchedule
Starts immediately if in planned intervall, otherwise with next scheduled start>
Start set <name> Start <number of minutes>
Starts immediately for <number of minutes>
confirmError set <name> confirmError
Testing: Confirm current error on the mower. Will only work if current error is considered confirmable by the mower. Available for models 405X, 415X, 435X AWD and 535 AWD. Also available on all Ceora, EPOS and NERA models.
StartInWorkArea set <name> StartInWorkArea <workAreaId|name> [<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 set <name> chargingStationPositionToAttribute
Sets the calculated charging station coordinates to the corresponding attributes.
client_secret set <name> client_secret <application secret>
Sets the mandatory application secret (client secret)
cuttingHeight set <name> cuttingHeight <1..9>
Sets the cutting height. NOTE: Do not use for 550 EPOS and Ceora.
cuttingHeightInWorkArea 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 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
For debug purpose only.
getUpdate set <name> getUpdate
For debug purpose only.
headlight set <name> headlight <ALWAYS_OFF|ALWAYS_ON|EVENIG_ONLY|EVENING_AND_NIGHT>
mowerScheduleToAttribute set <name> mowerScheduleToAttribute
Writes the schedule in to the attribute moverSchedule.
sendScheduleFromAttributeToMower set <name> sendScheduleFromAttributeToMower
Sends the schedule to the mower. NOTE: Do not use for 550 EPOS and Ceora.
mapZonesTemplateToAttribute set <name> mapZonesTemplateToAttribute
Load the command reference example into the attribute mapZones.
html get <name> html
Returns the mower area image as html code. For use in uiTable, TabletUI, Floorplan, readingsGroup, weblink etc.
InternalData get <name> InternalData
Lists some device internal data
MowerData get <name> MowerData
Lists all mower data with its hash path exept positon array. The hash path can be used for generating userReadings. The trigger is e.g. device_state: connected or mower_wsEvent: <status-event|positions-event|settings-event>.
Example: created reading serialnumber with hash path $hash->{helper}{mower}{attributes}{system}{serialNumber}
StatisticsData get <name> StatisticsData
Lists statistics data with its hash path. The hash path can be used for generating userReadings. The trigger is e.g. device_state: connected or mower_wsEvent: <status-event|positions-event|settings-event>.
errorCodes get <name> errorCodes
Lists API response status codes and mower error codes
errorStack get <name> errorStack
Lists error stack.
Attributes
mapImagePath attr <name> mapImagePath <path to image>
Path of a raster image file for an area the mower path has to be drawn to.
If the image name implies the image size by containing a part which matches /(\d+)x(\d+)/
the corresponding attribute will be set to mapImageWidthHeight = '$1 $2'
Image name example: map740x1300.webp
mapImageWidthHeight attr <name> mapImageWidthHeight <width in pixel><separator><height in pixel>
Width and Height in pixel of a raster image file for an area image the mower path has to be drawn to. <separator> is one space character.
mapImageZoom attr <name> mapImageZoom <zoom factor>
Zoom of a raster image for an area the mower path has to be drawn to.
mapBackgroundColor attr <name> mapBackgroundColor <background-color>
The value is used as background-color.
mapDesignAttributes attr <name> mapDesignAttributes <complete list of design-attributes>
Load the list of attributes by set <name> defaultDesignAttributesToAttribute to change its values. Design attributes with changed default values are mandatory in this attribute.
Default values:
mapImageCoordinatesToRegister attr <name> mapImageCoordinatesToRegister <upper left longitude><space><upper left latitude><line feed><lower right longitude><space><lower right latitude>
Upper left and lower right coordinates to register (or to fit to earth) the image. Format: linewise longitude and latitude values separated by 1 space.
The lines are splitted by (/\s|\R$/). Use WGS84 (GPS) coordinates in decimal degree notation.
mapImageCoordinatesUTM attr <name> mapImageCoordinatesUTM <upper left longitude><space><upper left latitude><line feed><lower right longitude><space><lower right latitude>
Upper left and lower right coordinates to register (or to fit to earth) the image. Format: linewise longitude and latitude values separated by 1 space.
The lines are splitted by (/\s|\R$/). Use UTM coordinates in meter notation.
This attribute has to be set after the attribute mapImageCoordinatesToRegister. The values are used to calculate the scale factors and the attribute scaleToMeterXY is set accordingly.
showMap attr <name> showMap <1,0>
Shows Map on (1 default) or not (0).
chargingStationCoordinates attr <name> chargingStationCoordinates <longitude><separator><latitude>
Longitude and latitude of the charging station. Use WGS84 (GPS) coordinates in decimal degree notation. <separator> is one space character
chargingStationImagePosition attr <name> chargingStationImagePosition <right, bottom, left, top, center>
Position of the charging station image relative to its coordinates.
mowerCuttingWidth attr <name> mowerCuttingWidth <cutting width>
mower cutting width in meter to calculate the mowed area. default: 0.24
mowerSchedule attr <name> mowerSchedule <schedule array>
This attribute provides the possebility to edit the mower schedule in form of an JSON array. The actual schedule can be loaded with the command set <name> mowerScheduleToAttribute. The command set <name> sendScheduleFromAttributeToMower sends the schedule to the mower. The maximum of array elements is 14 and 2 each day, so every day of a week can have 2 time spans. Each array element consists of 7 day values (monday to sunday) which can be true or false, a start and duration value in minutes. Start time counts from midnight. NOTE: Do not use for 550 EPOS and Ceora. Delete the attribute after the schedule is successfully uploaded.
mowingAreaLimits attr <name> mowingAreaLimits <positions list>
List of position describing the area to mow. Format: linewise longitude and latitude values separated by 1 space. The lines are splitted by (/\s|\R$/). The position values could be taken from Google Earth KML file, but whithout the altitude values.
propertyLimits attr <name> propertyLimits <positions list>
List of position describing the property limits. Format: linewise of longitude and latitude values separated by 1 space. The lines are splitted by (/\s|\R$/).The position values could be taken from . For converting UTM32 meter to ETRS89 / WGS84 decimal degree you can use the BKG-Geodatenzentrum BKG-Geodatenzentrum.
numberOfWayPointsToDisplay attr <name> numberOfWayPointsToDisplay <number of way points>
Set the number of way points stored and displayed, default is 5000 at least 100. The way points are shifted through the dedicated stack.
weekdaysToResetWayPoints attr <name> weekdaysToResetWayPoints <any combination of weekday numbers, space or minus [0123456 -]>
A combination of weekday numbers when the way point stack will be reset. No reset for space or minus. Default 1.
scaleToMeterXY attr <name> scaleToMeterXY <scale factor longitude><seperator><scale factor latitude>
The scale factor depends from the Location on earth, so it has to be calculated for short ranges only. <seperator> is one space character.
Longitude: (LongitudeMeter_1 - LongitudeMeter_2) / (LongitudeDegree_1 - LongitudeDegree _2)
Latitude: (LatitudeMeter_1 - LatitudeMeter_2) / (LatitudeDegree_1 - LatitudeDegree _2)
mapZones attr <name> mapZones <valid perl condition to separate Zones>
These Zones are provided by the Modul and are not related to Husqvarnas work areas.
Provide the zones with conditions as JSON-String:
The waypoints are accessable by the variables $longitude und $latitude.
Zones have have to be separated by conditions in alphabetical order of their names.
The last zone is determined by the remaining waypoints.
Syntactical example:
'{
"<name_1>" : {
"condition" : "<condition to separate name_1 from other zones>",
"cuttingHeight" : "<cutting height for the first zone>"
},
"<name_2>" : {
"condition" : "<condition to separate name_2 from other zones, except name_1>",
"cuttingHeight" : "<cutting height for the second zone>"
},
"<name_3>" : {
"condition" : "<condition to separate name_3 from other zones, except name_1 and name_2>",
"cuttingHeight" : "<cutting height for the third zone>"
},
"<name_n-1>" : {
"condition" : "<condition to separate name_n-1 from other zones ,except the zones already seperated>",
"cuttingHeight" : "<cutting height for the nth-1 zone>"
},
"<name n>" : {
"condition" : "Use 'undef' because the last zone remains.",
"cuttingHeight" : "<cutting height for the nth zone>"
}
}'
Example with two Zones and virtual lines defined by latitude 52.6484600648553, 52.64839739580418 (horizontal) and longitude 9.54799477359984 (vertikal). all way points above 52.6484600648553 or all way points above 52.64839739580418 and all way points to the right of 9.54799477359984 belong to zone 01_oben. All other way points belong to zone 02_unten.
There are different cutting heightts each zone
'{
"01_oben" : {
"condition" : "$latitude > 52.6484600648553 || $longitude > 9.54799477359984 && $latitude > 52.64839739580418",
"cuttingHeight" : "7"
},
"02_unten" : {
"condition" : "undef",
"cuttingHeight" : "3"
}
}'
addPollingMinInterval attr <name> addPollingMinInterval <interval in seconds>
Set minimum intervall for additional polling triggered by status-event, default 0 (no polling). Gets periodically statistics data from mower. Make sure to be within API limits (10000 calls per month).
addPositionPolling attr <name> addPositionPolling <[1|0]>
Set position polling, default 0 (no position polling). Gets periodically position data from mower, instead from websocket. It has no effect without setting attribute addPollingMinInterval.
mowingAreaHull attr <name> mowingAreaHull <use button 'mowingAreaHullToAttribute' to fill the attribute>
Contains the calculated hull coordinates as JSON string and is set by button 'mowingAreaHullToAttribute' under the dislpayed map.
The stored hull polygon is displayed like the other limits.
Use the design attribute 'hullResolution' to change the number of fractions ℕ .
The hull polygon is calculated when the design attribut is set to 1 hullCalculate="1" and there are more than 50 Points for activity MOWING.
The calculation is done only after site reload.
The calculation of hull is stopped when the attribute ist set and starts again when attribute is deleted.
The attribute weekdaysToResetWayPoints should be set to - and also the design attribute mowingPathUseDots should be set to "1" until the hull is sufficient.
If there is a polygon in attribute, it can be changed.
The design attribute hullSubtract can be set to a natural number {ℕ}, it depicts the recursion depth in which polygon points removed from way points.
This reduces spikes in border region. hullSubtract="" removes the button 'Subtract Hull'.
mowerPanel attr <name> mowerPanel <html code>
Shows user defined html beneath the map. usefull for a panel with shortcuts
The command attribute has to contain the mower command, without set <name> command="Start 210" stands for set <name> Start 210
A directive as comment in the first line allows positioning.
<!-- ON_TOP --> shows html above map
Panel has to be enclosed by a div-tag with a mandatory HTML-attribute data-amc_panel_inroom=<"1"|"">. Panel is shown in room view, i.e. for uiTable, weblink, etc., for value "1" and hidden for value "" look at example.
Example:
<style>
.amc_panel_button {height:50px; width:150px;}
.amc_panel_div {position:relative; left:348px; top:-330px; z-index: 2; width:150px; height:1px}
</style>
<div class="amc_panel_div" data-amc_panel_inroom="1" >
<button class="amc_panel_button" command="Start 210" >Start für 3 1/2 h</button>
<button class="amc_panel_button" command="Pause" >Pause bis auf Weiteres</button>
<button class="amc_panel_button" command="ResumeSchedule" >Weiter nach Plan</button>
<button class="amc_panel_button" command="ParkUntilNextSchedule" >Parken bis nächsten Termin</button>
<button class="amc_panel_button" command="ParkUntilNextSchedule" >Parken bis auf Weiteres</button>
</div>
Dieses Modul etabliert eine Kommunikation zwischen der Husqvarna Cloud and FHEM, um einen Husqvarna Automower zu steuern, der mit einem Connect Modul (SIM) ausgerüstet ist.
Es arbeitet als Device für einen Mähroboter. Für jeden in der API registrierten Mähroboter ist ein extra Appilcation Key mit Application Secret zu verwenden.
Der Pfad des Mähroboters wird in der Detailansicht des FHEMWEB Frontends angezeigt.
Der Pfad kann mit einer beliebigen Karte hinterlegt werden.
Die Karte muss als Rasterbild im webp, png oder jpg Format vorliegen.
Die Grundstücksgrenze kann manuell eingetragen werden.
Die Die Mähflächengrenze kann manuell eingetragen werden.
Alternativ kann die Mähflächengrenze berechnet werden.
Es ist möglich alles was die API anbietet zu steuern, z.B. Mähplan,Scheinwerfer, Schnitthöhe und Aktionen wie, Start, Pause, Parken usw.
Zonen können selbst definiert werden.
Die Schnitthöhe kann je selbstdefinierter Zone eingestellt werden.
Die Daten aus der API sind im Gerätehash gespeichert, Mit {Dumper $defs{<device name>}} in der Befehlezeile können die Daten angezeigt werden und daraus userReadings erstellt werden.
Anforderungen
Für den Zugriff auf die API muss eine Application im Husqvarna Developer Portal angelegt und mit der Automower Connect API verbunden werden.
Währenddessen wird ein Application Key (client_id) und ein Application Secret (client secret) bereitgestellt. Diese Angaben sind im Zusammenhang mit der Definition eines Gerätes erforderlich.
Das Modul nutzt Client Credentials als Granttype zur Authorisierung.
Das Modul läd Drittsoftware, die zur Berechnung der Hüllkurve des Mähbereiches erforderlich ist, von einem externem Server.
Define
define <device name> AutomowerConnect <application key> [<mower number>]
Beispiel: define myMower AutomowerConnect 123456789012345678901234567890123456 Erstes Gerät: die Defaultmähernummer ist 0.
Es muss ein client_secret gesetzt werden. Es ist das Application Secret vom Husqvarna Developer Portal. set myMower client_secret <client secret>
Button
Mower Schedule
Über den Button kann eine Benutzeroberfläche zur Bearbeitung des Mähplans geöffnet werden.
Eintrag zufügen/ändern: Die gewünschten Angaben eintragen und betätigen.
Eintrag löschen: Alle Wochentage abwählen und betätigen.
Eintrag zurücksetzen: Irgend ein Zeitfeld mit -- füllen und betätigen.
Set
Park set <name> Park <number of minutes>
Parkt den Mäher in der Ladestation (LS) für <number of minutes>
ParkUntilFurtherNotice set <name> ParkUntilFurtherNotice
Parkt den Mäher bis auf Weiteres in der LS
ParkUntilNextSchedule set <name> ParkUntilNextSchedule
Parkt den Mäher bis auf Weiteres in der LS und startet zum nächsten geplanten Zeitpunkt
Pause set <name> Pause
Pausiert den Mäher sofort am aktuellen Standort
ResumeSchedule set <name> ResumeSchedule
Startet im geplanten Intervall den Mäher sofort, sonst zum nächsten geplanten Zeitpunkt
Start set <name> Start <number of minutes>
Startet sofort für <number of minutes>
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 set <name> chargingStationPositionToAttribute
Setzt die berechneten Koordinaten der LS in das entsprechende Attribut.
client_secret set <name> client_secret <application secret>
Setzt das erforderliche Application Secret (client secret)
cuttingHeight set <name> cuttingHeight <1..9>
Setzt die Schnitthöhe. HINWEIS: Nicht für 550 EPOS und Ceora geeignet.
cuttingHeightInWorkArea 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 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
Testing: Bestätigt den letzten Fehler im Mäher, wenn der Mäher es zulässt. Verfügbar für 405X, 415X, 435X AWD and 535 AWD und alle Ceora, EPOS and NERA.
getNewAccessToken set <name> getNewAccessToken
Nur zur Fehlerbehebung.
getUpdate set <name> getUpdate
Nur zur Fehlerbehebung.
headlight set <name> headlight <ALWAYS_OFF|ALWAYS_ON|EVENIG_ONLY|EVENING_AND_NIGHT>
Setzt den Scheinwerfermode
mowerScheduleToAttribute set <name> mowerScheduleToAttribute
Schreibt den Mähplan ins Attribut mowerSchedule.
sendScheduleFromAttributeToMower set <name> sendScheduleFromAttributeToMower
Sendet den Mähplan zum Mäher. HINWEIS: Nicht für 550 EPOS und Ceora geeignet.
mapZonesTemplateToAttribute set <name> mapZonesTemplateToAttribute
Läd das Beispiel aus der Befehlsreferenz in das Attribut mapZones.
html get <name> html
Gibt das Bild des Mäherbereiches html kodiert zurück, zur Verwendung in uiTable, TabletUI, Floorplan, readingsGroup, weblink usw.
errorCodes get <name> errorCodes
Listet die Statuscode der API-Anfrage und die Fehlercodes des Mähroboters auf.
InternalData get <name> InternalData
Listet einige Daten des FHEM-Gerätes auf.
MowerData get <name> MowerData
Listet alle Daten des Mähers einschließlich Hashpfad auf, ausgenommen das Positonsarray. Der Hashpfad kann zur Erzeugung von userReadings genutzt werden, getriggert wird durch e.g. device_state: connected oder mower_wsEvent: <status-event|positions-event|settings-event>.
Beispiel: erzeugen des Reading serialnumber mit dem Hashpfad $hash->{helper}{mower}{attributes}{system}{serialNumber}
StatisticsData get <name> StatisticsData
Listet statistische Daten mit ihrem Hashpfad auf. Der Hashpfad kann zur Erzeugung von userReadings genutzt werden, getriggert wird z.B. durch device_state: connected oder mower_wsEvent: <status-event|positions-event|settings-event>
errorStack get <name> errorStack
Listet die gespeicherten Fehler auf.
Attributes
mapImagePath attr <name> mapImagePath <path to image>
Pfad zur Bilddatei. Auf das Bild werden Pfad, Anfangs- u. Endpunkte gezeichnet.
Wenn der Bildname die Bildgröße impliziert indem er zu dem regulären Ausdruck /(\d+)x(\d+)/ passt,
wird das zugehörige Attribut gesetzt mapImageWidthHeight = '$1 $2'
Beispiel Bildname: map740x1300.webp
mapImageWidthHeight attr <name> mapImageWidthHeight <width in pixel><separator><height in pixel>
Bildbreite in Pixel des Bildes auf das Pfad, Anfangs- u. Endpunkte gezeichnet werden. <separator> ist 1 Leerzeichen.
mapImageZoom attr <name> mapImageZoom <zoom factor>
Zoomfaktor zur Salierung des Bildes auf das Pfad, Anfangs- u. Endpunkte gezeichnet werden. Standard: 0.5
mapBackgroundColor attr <name> mapBackgroundColor <color value>
Der Wert wird als Hintergrungfarbe benutzt.
mapDesignAttributes attr <name> mapDesignAttributes <complete list of design-attributes>
Lade die Attributliste mit set <name> defaultDesignAttributesToAttribute um die Werte zu ändern. Nur Designattribute mit geänderten Standartwerten müssen in diesem Attribut enthalten sein.
Vorgabe Werte:
mapImageCoordinatesToRegister attr <name> mapImageCoordinatesToRegister <upper left longitude><space><upper left latitude><line feed><lower right longitude><space><lower right latitude>
Obere linke und untere rechte Ecke der Fläche auf der Erde, die durch das Bild dargestellt wird, um das Bild auf der Fläche zu registrieren (oder einzupassen).
Format: Zeilenweise Paare von Longitude- u. Latitudewerten getrennt durch 1 Leerzeichen. Die Zeilen werden aufgeteilt durch (/\s|\R$/).
Angabe der WGS84 (GPS) Koordinaten muss als Dezimalgrad erfolgen.
mapImageCoordinatesUTM attr <name> mapImageCoordinatesUTM <upper left longitude><space><upper left latitude><line feed><lower right longitude><space><lower right latitude>
Obere linke und untere rechte Ecke der Fläche auf der Erde, die durch das Bild dargestellt wird, um das Bild auf der Fläche zu registrieren (oder einzupassen).
Format: Zeilenweise Paare von Longitude- u. Latitudewerten getrennt durch 1 Leerzeichen. Die Zeilen werden aufgeteilt durch (/\s|\R$/).
Die Angabe der UTM Koordinaten muss als Dezimalzahl in Meter erfolgen.
Das Attribut muss nach dem Attribut mapImageCoordinatesToRegister gesetzt werden.
Dieses Attribut berechnet die Skalierungsfaktoren. Das Attribut scaleToMeterXY wird entsprechend gesetzt.
showMap attr <name> showMap <1,0>
Zeigt die Karte an (1 default) oder nicht (0).
chargingStationCoordinates attr <name> chargingStationCoordinates <longitude><separator><latitude>
Longitude und Latitude der Ladestation als WGS84 (GPS) Koordinaten als Deimalzahl. <separator> ist 1 Leerzeichen.
chargingStationImagePosition attr <name> chargingStationImagePosition <right, bottom, left, top, center>
Position der Ladestation relativ zu ihren Koordinaten.
mowerCuttingWidth attr <name> mowerCuttingWidth <cutting width>
Schnittbreite in Meter zur Berechnung der gemähten Fläche. default: 0.24
mowerSchedule attr <name> mowerSchedule <schedule array>
Dieses Attribut bietet die Möglichkeit den Mähplan zu ändern, er liegt als JSON Array vor. Der aktuelle Mähplan kann mit dem Befehl set <name> mowerScheduleToAttrbute ins Attribut geschrieben werden. Der Befehl set <name> sendScheduleFromAttributeToMower sendet den Mähplan an den Mäher. Das Maximum der Arrayelemente beträgt 14, 2 für jeden Tag, so daß jeden Tag zwei Intervalle geplant werden können. Jedes Arrayelement besteht aus 7 Tageswerten (monday bis sunday) die auf true oder false gesetzt werden können, einen start Wert und einen duration Wert in Minuten. Die Startzeit start wird von Mitternacht an gezählt. HINWEIS: Nicht für 550 EPOS und Ceora geeignet.
mowingAreaLimits attr <name> mowingAreaLimits <positions list>
Liste von Positionen, die den Mähbereich beschreiben. Format: Zeilenweise Paare von Longitude- u. Latitudewerten getrennt durch 1 Leerzeichen. Die Zeilen werden aufgeteilt durch (/\s|\R$/). Die Liste der Positionen kann aus einer mit Google Earth erzeugten KML-Datei entnommen werden, aber ohne Höhenangaben.
propertyLimits attr <name> propertyLimits <positions list>
Liste von Positionen, um die Grundstücksgrenze zu beschreiben. Format: Zeilenweise Paare von Longitude- u. Latitudewerten getrennt durch 1 Leerzeichen. Eine Zeile wird aufgeteilt durch (/\s|\R$/). Die genaue Position der Grenzpunkte kann man über die Geoportale der Länder finden. Eine Umrechnung der UTM32 Daten in Meter nach ETRS89 in Dezimalgrad kann über das BKG-Geodatenzentrum erfolgen.
numberOfWayPointsToDisplay attr <name> numberOfWayPointsToDisplay <number of way points>
Legt die Anzahl der gespeicherten und und anzuzeigenden Wegpunkte fest, Standartwert ist 5000 und Mindestwert ist 100. Die Wegpunkte werden durch den zugeteilten Wegpunktspeicher geschoben.
weekdaysToResetWayPoints attr <name> weekdaysToResetWayPoints <any combination of weekday numbers, space or minus [0123456 -]>
Eine Kombination von Wochentagnummern an denen der Wegpunktspeicher gelöscht wird. Keine Löschung bei Leer- oder Minuszeichen, Standard 1.
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)
mapZones attr <name> mapZones <JSON string with zone names in alpabetical order and valid perl condition to seperate the zones>
Die Zonen werden vom Modul bereit gestellt, sie stehen in keinem Zusammenhang mit Husquvarnas Work Areas
Die Wegpunkte stehen über die Perlvariablen $longitude und $latitude zur Verfügung.
Die Zonennamen und Bedingungen müssen als JSON-String angegeben werden.
Die Zonennamen müssen in alphabetischer Reihenfolge durch Bedingungen abgegrenzt werden.
Die letzte Zone ergibt sich aus den übrig gebliebenen Wegpunkten.
Syntaxbeispiel:
'{
"<name_1>" : {
"condition" : "<condition to separate name_1 from other zones>",
"cuttingHeight" : "<cutting height for the first zone>"
},
"<name_2>" : {
"condition" : "<condition to separate name_2 from other zones, except name_1>",
"cuttingHeight" : "<cutting height for the second zone>"
},
"<name_3>" : {
"condition" : "<condition to separate name_3 from other zones, except name_1 and name_2>",
"cuttingHeight" : "<cutting height for the third zone>"
},
"<name_n-1>" : {
"condition" : "<condition to separate name_n-1 from other zones ,except the zones already seperated>",
"cuttingHeight" : "<cutting height for the nth-1 zone>"
},
"<name n>" : {
"condition" : "Use 'undef' because the last zone remains.",
"cuttingHeight" : "<cutting height for the nth zone>"
}
}'
Beispiel mit zwei Zonen und gedachten Linien bestimmt durch die Punkte Latitude 52.6484600648553, 52.64839739580418 (horizontal) und 9.54799477359984 (vertikal). Alle Wegpunkte deren Latitude über einer horizontalen Linie mit der Latitude 52.6484600648553 liegen oder alle Wegpunkte deren Latitude über einer horizontalen Linie mit der Latitude 52.64839739580418 liegen und deren Longitude rechts von einer vertikale Linie mit der Longitude 9.54799477359984 liegen, gehören zur Zone 01_oben. Alle anderen Wegpunkte gehören zur Zone 02_unten.
In den Zonen sind unterschiedliche Schnitthöhen eingestellt.
'{
"01_oben" : {
"condition" : "$latitude > 52.6484600648553 || $longitude > 9.54799477359984 && $latitude > 52.64839739580418",
"cuttingHeight" : "7"
},
"02_unten" : {
"condition" : "undef",
"cuttingHeight" : "3"
}
}'
addPollingMinInterval attr <name> addPollingMinInterval <interval in seconds>
Setzt das Mindestintervall für zusätzliches Polling der API nach einem status-event, default 0 (kein Polling). Liest periodisch zusätzlich statistische Daten vom Mäher. Es muss sichergestellt werden, das die API Begrenzung (10000 Anfragen pro Monat) eingehalten wird.
addPositionPolling attr <name> addPositionPolling <[1|0]>
Setzt das Positionspolling, default 0 (kein Positionpolling). Liest periodisch Positiondaten des Mähers, an Stelle der über Websocket gelieferten Daten. Das Attribut ist nur wirksam, wenn durch das Attribut addPollingMinInterval das Polling eingeschaltet ist.
mowingAreaHull attr <name> mowingAreaHull <use button 'mowingAreaHullToAttribute' to fill the attribute>
Enthält die berechneten Hüllenkooordinaten als JSON String und wird gesetzt durch den Button 'mowingAreaHullToAttribute' unterhalb der angezeigten Karte.
Das gespeicherte Hüllenpolygon wird wie die anderen Grenzen angezeigt.
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öscht wird.
Das Attribut weekdaysToResetWayPoints sollte auf - und das Designattribut mowingPathUseDots sollte auf "1" gesetzt werden.
Befindet sich ein Polygon im Attribut, besteht die Möglichkeit das Polygon anzupassen.
Das Designattribut hullSubtract kann auf eine natürliche Zahl {ℕ} gesetzt werden, die angibt in welcher Rekursionstiefe Polygonpunkte aus der Menge der Wegpunkte entfernt werden.
Das reduziert Ausreißer im Randbereich der vom Polygon umschlossenen Fläche.
Wenn hullSubtract="" gesetzt wird, dann wird der Button 'Subtract Hull' entfernt.
mowerPanel attr <name> mowerPanel <html code>
Zeigt HTML Kode unterhalb der Karte z.B. für ein Panel mit Kurzbefehlen.
Das command Attribut beinhaltet den Mäherbefehl, ohne set <name> command="Start 210" steht für set <name> Start 210
Eine Direktive als Kommentar in der ersten Zeile erlaubt die Positionierung:
<!-- ON_TOP --> zeigt das Panel über der Karte an.
Das Panel muss in einem div-Element eingebettet sein das ein HTML-Attribut data-amc_panel_inroom=<"1"|""> enthält. Das Panel wird in der Raumansicht, z.B. bei uiTable, weblink, usw., angezeigt wenn der Wert "1" ist und versteckt falls der Wert "" ist, s. Bsp.
Beispiel:
<style>
.amc_panel_button {height:50px; width:150px;}
.amc_panel_div {position:relative; left:348px; top:-330px; z-index: 2; width:150px; height:1px}
</style>
<div class="amc_panel_div" data-amc_panel_inroom="1" >
<button class="amc_panel_button" command="Start 210" >Start für 3 1/2 h</button>
<button class="amc_panel_button" command="Pause" >Pause bis auf Weiteres</button>
<button class="amc_panel_button" command="ResumeSchedule" >Weiter nach Plan</button>
<button class="amc_panel_button" command="ParkUntilNextSchedule" >Parken bis nächsten Termin</button>
<button class="amc_panel_button" command="ParkUntilNextSchedule" >Parken bis auf Weiteres</button>
</div>
mower_commandStatus - Status des letzten uebermittelten Kommandos wird duch Statusupdate zurückgesetzt.
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_wsEvent - Events der Websocketverbindung (status-event, positions-event, settings-event)
mower_errorCode - last error code
mower_errorCodeTimestamp - last error code time stamp