mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 23:06:37 +00:00
74_AutomowerConnect.pm: new attribute mowerPanel
git-svn-id: https://svn.fhem.de/fhem/trunk@28806 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
603cdc4a23
commit
cf125d1de1
@ -1,5 +1,6 @@
|
||||
# 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: new attribute mowerPanel
|
||||
- bugfix: 76_SolarForecast: possible Illegal division by zero if Battery SOC
|
||||
management is activated
|
||||
- change: 76_SolarForecast: minor change calculation Today PV deviation
|
||||
|
@ -51,7 +51,8 @@ sub Initialize() {
|
||||
$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_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;
|
||||
@ -72,6 +73,7 @@ sub Initialize() {
|
||||
"chargingStationImagePosition:left,top,right,bottom,center " .
|
||||
"scaleToMeterXY " .
|
||||
"mowerCuttingWidth " .
|
||||
"mowerPanel:textField-long,85 " .
|
||||
"mowerSchedule:textField-long " .
|
||||
"mowingAreaLimits:textField-long " .
|
||||
"mowingAreaHull:textField-long " .
|
||||
@ -463,7 +465,22 @@ __END__
|
||||
The design attribute <code>hullSubtract</code> can be set to a natural number {ℕ}, it depicts the recursion depth in which polygon points removed from way points.<br>
|
||||
This reduces spikes in border region.<br>
|
||||
<code>hullSubtract=""</code> removes the button 'Subtract Hull'.<br>
|
||||
</li>
|
||||
|
||||
<li><a id='AutomowerConnect-attr-mowerPanel'>mowerPanel</a><br>
|
||||
<code>attr <name> mowerPanel <html code></code><br>
|
||||
Shows user defined html beneath the map. usefull for a panel with shortcuts<br>
|
||||
The command attribute has to contain the mower command, without set <name><br>
|
||||
<code>command="Start 210"</code> stands for <code>set <name> Start 210</code><br>
|
||||
Directives as comment in the first line allow positioning.<br>
|
||||
<ul>
|
||||
<code>ON_TOP</code> shows html above map<br>
|
||||
</ul>
|
||||
Example:<br>
|
||||
<code>
|
||||
<!-- ON_TOP --><br>
|
||||
<button command="Start 210" >Start für 3 1/2 h</button><br>
|
||||
</code>
|
||||
</li>
|
||||
|
||||
<li><a href="disable">disable</a></li>
|
||||
@ -912,6 +929,22 @@ __END__
|
||||
Wenn <code>hullSubtract=""</code> gesetzt wird, dann wird der Button 'Subtract Hull' entfernt.<br>
|
||||
</li>
|
||||
|
||||
<li><a id='AutomowerConnect-attr-mowerPanel'>mowerPanel</a><br>
|
||||
<code>attr <name> mowerPanel <html code></code><br>
|
||||
Zeigt HTML Kode unterhalb der Karte z.B. für ein Panel mit Kurzbefehlen.<br>
|
||||
Das command Attribut beinhaltet den Mäherbefehl, ohne set <name><br>
|
||||
<code>command="Start 210"</code> steht für <code>set <name> Start 210</code><br>
|
||||
Direktiven als Kommentar erlauben die Positionierung.<br>
|
||||
<ul>
|
||||
<code>ON_TOP</code> zeigt Buttons über der Karte<br>
|
||||
</ul>
|
||||
Beispiel:<br>
|
||||
<code>
|
||||
<!-- ON_TOP --><br>
|
||||
<button command="Start 210" >Start für 3 1/2 h</button><br>
|
||||
</code>
|
||||
</li>
|
||||
|
||||
<li><a href="disable">disable</a></li>
|
||||
|
||||
<li><a href="disabledForIntervals">disabledForIntervals</a></li>
|
||||
|
@ -478,6 +478,17 @@ sub Get {
|
||||
}
|
||||
}
|
||||
|
||||
#########################
|
||||
sub FW_summaryFn {
|
||||
my ($FW_wname, $name, $room, $pageHash) = @_; # pageHash is set for summaryFn.
|
||||
my $hash = $defs{$name};
|
||||
my $type = $hash->{TYPE};
|
||||
my $content = AttrVal($name, 'mowerPanel', '');
|
||||
return '' if( AttrVal($name, 'disable', 0) || !$content || !$::init_done);
|
||||
$content =~ s/command=['"](.*?)['"]/onclick="AutomowerConnectPanelCmd('set $name $1')"/g;
|
||||
return $content if ( $content =~ /IN_STATE/ );
|
||||
}
|
||||
|
||||
#########################
|
||||
sub FW_detailFn {
|
||||
my ($FW_wname, $name, $room, $pageHash) = @_; # pageHash is set for summaryFn.
|
||||
@ -580,6 +591,10 @@ sub FW_detailFn {
|
||||
.${type}_${name}_canvas_1{
|
||||
position: absolute; left: 0; top: 0; z-index: 1;}
|
||||
</style>";
|
||||
my $content = AttrVal($name, 'mowerPanel', '');
|
||||
my $contentflg = $content =~ /ON_TOP/;
|
||||
$content =~ s/command=['"](.*?)['"]/onclick="AutomowerConnectPanelCmd('set $name $1')"/g;
|
||||
$ret .= $content if ( $contentflg );
|
||||
$ret .= "<div id='${type}_${name}_div' class='${type}_${name}_div' $$mapDesign $csdata $limi $propli width='$picx' height='$picy' >";
|
||||
$ret .= "<canvas id='${type}_${name}_canvas_0' class='${type}_${name}_canvas_0' width='$picx' height='$picy' ></canvas>";
|
||||
$ret .= "<canvas id='${type}_${name}_canvas_1' class='${type}_${name}_canvas_1' width='$picx' height='$picy' ></canvas>";
|
||||
@ -588,6 +603,7 @@ sub FW_detailFn {
|
||||
if ( -e "$FW_dir/$hash->{helper}{FWEXTA}{path}/$hash->{helper}{FWEXTA}{file}" && !AttrVal( $name,'mowingAreaHull','' ) && $$mapDesign =~ m/hullCalculate="1"/g );
|
||||
$ret .= "<button title='Subtracts hull polygon points from way points. To hide button set hullSubtract=\"\".' onclick='AutomowerConnectSubtractHull( \"$FW_ME/$type/$name/json\" )'>Subtract Hull</button>"
|
||||
if ( -e "$FW_dir/$hash->{helper}{FWEXTA}{path}/$hash->{helper}{FWEXTA}{file}" && AttrVal( $name,'mowingAreaHull','' ) && $$mapDesign =~ m/hullSubtract="\d+"/g );
|
||||
$ret .= $content if ( !$contentflg );
|
||||
$ret .= "<br>";
|
||||
$hash->{helper}{detailFnFirst} = 1;
|
||||
my $mid = $hash->{helper}{map_init_delay};
|
||||
|
@ -457,6 +457,11 @@ function AutomowerConnectSubtractHull ( path ) {
|
||||
|
||||
}
|
||||
|
||||
function AutomowerConnectPanelCmd ( panelcmd ) {
|
||||
if ( typeof FW_cmd === "function" )
|
||||
FW_cmd( FW_root+"?cmd="+panelcmd+"&XHR=1" );
|
||||
}
|
||||
|
||||
//AutomowerConnectUpdateDetail (<devicename>, <type>, <detailfnfirst>, <imagesize x>, <imagesize y>, <scale x>, <scale y>, <error description>, <path array>, <error array>, <hull array>)
|
||||
function AutomowerConnectUpdateDetail (dev, type, detailfnfirst, picx, picy, scalx, scaly, errdesc, pos, erray, hullxy) {
|
||||
const colorat = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user