Merge pull request 'closed: #53 Patch beliebigen Fahrbefehl zulassen' (#54) from patch-implementationCommandTemplate into devel
Reviewed-on: #54
This commit is contained in:
commit
b9a7328661
@ -639,6 +639,18 @@ __END__
|
||||
</li>
|
||||
<a id="AutoShuttersControl-attr-ASC_SlatPosCmd_SlatDevice"></a>
|
||||
<li><strong>ASC_SlatPosCmd_SlatDevice</strong> - If your shutter is "venetian blind" type (with turnable slats, lamellas or similar), this is the place to set additional command and/or device info to control the slat level. Examples: <i>attr ROLLO ASC_SlatPosCmd_SlatDevice slatPct</i> or <i>attr ROLLO ASC_SlatPosCmd_SlatDevice dim:ROLLOSLATDEVICE</i>. Providing a device name for the slat device is only needed in case it's different to the shutter itself. If attribute is set, additional positioning values for the respective slat levels can be set in attributes <i>ASC_Open_Pos</i>, <i>ASC_Closed_Pos</i>, <i>ASC_Ventilate_Pos</i>, <i>ASC_ComfortOpen_Pos</i>, <i>ASC_Shading_Pos</i> and <i>ASC_Sleep_Pos</i>.</li>
|
||||
<a id="AutoShuttersControl-attr-ASC_CommandTemplate"></a>
|
||||
<li><strong>ASC_CommandTemplate</strong> - <strong>FHEM or Perl command</strong> (Perl in braces as usual needs escaping semicolons etc.). The parameters <i>$name</i> (name of the shutter device), <i>$level</i> (target position for the respective drive command) and <i>$slatLevel</i> (target position for the (rurnable) lammellas in venetion blinds) will be replaced by the appropirate values. You may have to take care to avoid unneeded driving commands.
|
||||
Examples:
|
||||
<ul>
|
||||
<li><i>attr ROLLO ASC_CommandTemplate set $name $level</i> - Address the position command directly to the main switch of the device</li>
|
||||
<li><i>attr ROLLO ASC_CommandTemplate set $name pct $level</i> - Address the position command directly to the main switch of the device</li>
|
||||
<li><i>attr ROLLO ASC_CommandTemplate set $name datapoint 4.LEVEL_2 $slatLevel 4.LEVEL $level</i> - combined positioning command, e.g. appropriate for HM-IP-venetian blind type actors</li>
|
||||
<li><i>attr ROLLO ASC_CommandTemplate { fhem("set $name ".($level+1024)).";set $name 0")}</i> - positioning command with Perl calculation and additional "execute" command, e.g. for an SPS type blind</li>
|
||||
<li><i>attr ROLLO ASC_CommandTemplate myPerlCode("$name", $level, $slatLevel)</i> - positioning command from perlfunction</li>
|
||||
</ul>
|
||||
<strong>Note: ASC_CommandTemplate</strong> is meant for some rare and special cases. In most cases there's <strong>no need</strong> to set this attribute!
|
||||
</li>
|
||||
<a id="AutoShuttersControl-attr-ASC_WindowRec_PosAfterDayClosed"></a>
|
||||
<li><strong>ASC_WindowRec_PosAfterDayClosed</strong> - open,lastManual / auf welche Position soll das Rollo nach dem schließen am Tag fahren. Open Position oder letzte gespeicherte manuelle Position (default: open)</li>
|
||||
<blockquote>
|
||||
@ -1157,6 +1169,20 @@ __END__
|
||||
<li><strong>ASC_WindowRec_subType</strong> - Typ des verwendeten Fensterkontaktes: twostate (optisch oder magnetisch) oder threestate (Drehgriffkontakt) (default: twostate)</li>
|
||||
<a id="AutoShuttersControl-attr-ASC_SlatPosCmd_SlatDevice"></a>
|
||||
<li><strong>ASC_SlatPosCmd_SlatDevice</strong> - Angaben zu einem Slat (Lamellen) CMD und - sofern diese Lamellen über ein anderes Device gesteuert werden - zum Slat Device. Beispiele: <i>attr ROLLO ASC_SlatPosCmd_SlatDevice slatPct</i> oder <i>attr ROLLO ASC_SlatPosCmd_SlatDevice dim:ROLLOSLATDEVICE</i>. Die Angabe des Devices ist nur erforderlich, wenn zur Steuerung der Lamellen ein anderes Device verwendet wird. Damit das ganze dann auch greift, muss in den 6 Positionsangaben ASC_Open_Pos, ASC_Closed_Pos, ASC_Ventilate_Pos, ASC_ComfortOpen_Pos, ASC_Shading_Pos und ASC_Sleep_Pos ein weiterer Parameter für die Lamellenstellung mit angegeben werden.</li>
|
||||
<a id="AutoShuttersControl-attr-ASC_CommandTemplate"></a>
|
||||
<li><strong>ASC_CommandTemplate</strong> - <strong>FHEM-Kommando(s) oder Perl-Anweisung</strong> (in geschweiften Klammern unter Beachtung der üblichen Regeln für das escapen von Semicolons etc.). Die Variablen <i>$name</i> (der Name des Rollladen-Devices), <i>$level</i> (die Zielposition des Fahrbefehls) und <i>$slatLevel</i> (die Zielposition des Fahrbefehls für eventuelle Lamellen) werden durch die ermittelten Werte ersetzt, es muss selbst dafür gesorgt werden, dass eventuell unnötige Fahrbefehle aussortiert werden.
|
||||
Beispiele:
|
||||
<ul>
|
||||
<li><i>attr ROLLO ASC_CommandTemplate set $name $level</i> - Positionsbefehl direkt an Gerät
|
||||
setzen</li>
|
||||
<li><i>attr ROLLO ASC_CommandTemplate set $name pct $level</i> - Positionsbefehl direkt an Gerät
|
||||
setzen</li>
|
||||
<li><i>attr ROLLO ASC_CommandTemplate set $name datapoint 4.LEVEL_2 $slatLevel 4.LEVEL $level</i> - Positionsbefehl und Lamellen-Ansteuerung für HM-IP-Jalousieaktoren</li>
|
||||
<li><i>attr ROLLO ASC_CommandTemplate { fhem("set $name ".($level+1024)).";set $name 0")}</i> - Positionsbefehl für eine SPS in Perl umrechnen</li>
|
||||
<li><i>attr ROLLO ASC_CommandTemplate myPerlCode("$name", $level, $slatLevel)</i> - Positionsbefehl aus eigener Perlfunktion</li>
|
||||
</ul>
|
||||
<strong>Hinweis: ASC_CommandTemplate</strong> ist für seltene und spezielle Fälle gedacht. In der Regel ist es nicht erforderlich, dieses Attribut zu setzen!
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</p>
|
||||
@ -1436,7 +1462,7 @@ __END__
|
||||
],
|
||||
"release_status": "stable",
|
||||
"license": "GPL_2",
|
||||
"version": "v0.10.17",
|
||||
"version": "v0.10.18",
|
||||
"author": [
|
||||
"Marko Oldenburg <fhemdevelopment@cooltux.net>"
|
||||
],
|
||||
|
@ -1,5 +1,5 @@
|
||||
UPD 2021-10-26_19:29:13 111908 FHEM/73_AutoShuttersControl.pm
|
||||
UPD 2021-10-26_19:27:16 74553 lib/FHEM/Automation/ShuttersControl.pm
|
||||
UPD 2021-10-26_20:19:19 115160 FHEM/73_AutoShuttersControl.pm
|
||||
UPD 2021-10-26_20:19:19 75259 lib/FHEM/Automation/ShuttersControl.pm
|
||||
UPD 2021-10-09_07:12:54 2657 lib/FHEM/Automation/ShuttersControl/Dev.pm
|
||||
UPD 2021-10-09_07:12:54 2494 lib/FHEM/Automation/ShuttersControl/Roommate.pm
|
||||
UPD 2021-10-24_07:33:53 31900 lib/FHEM/Automation/ShuttersControl/Shutters.pm
|
||||
@ -9,8 +9,8 @@ UPD 2021-10-09_07:12:54 40628 lib/FHEM/Automation/ShuttersControl/Helper.pm
|
||||
UPD 2021-10-09_07:12:54 2173 lib/FHEM/Automation/ShuttersControl/Window.pm
|
||||
UPD 2021-10-09_07:12:54 11739 lib/FHEM/Automation/ShuttersControl/Dev/Attr.pm
|
||||
UPD 2021-10-09_07:12:54 7249 lib/FHEM/Automation/ShuttersControl/Dev/Readings.pm
|
||||
UPD 2021-10-26_18:45:03 52523 lib/FHEM/Automation/ShuttersControl/Shutters/Attr.pm
|
||||
UPD 2021-10-26_20:11:53 52649 lib/FHEM/Automation/ShuttersControl/Shutters/Attr.pm
|
||||
UPD 2021-10-09_07:12:54 2901 lib/FHEM/Automation/ShuttersControl/Shutters/Readings.pm
|
||||
UPD 2021-10-09_07:12:54 3978 lib/FHEM/Automation/ShuttersControl/Window/Attr.pm
|
||||
UPD 2021-10-09_07:12:54 2286 lib/FHEM/Automation/ShuttersControl/Window/Readings.pm
|
||||
UPD 2021-10-26_18:45:03 6716 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm
|
||||
UPD 2021-10-26_20:19:19 6716 lib/FHEM/Automation/ShuttersControl/Rainprotection.pm
|
||||
|
@ -184,9 +184,7 @@ BEGIN {
|
||||
delFromAttrList
|
||||
gettimeofday
|
||||
InternalTimer
|
||||
RemoveInternalTimer
|
||||
computeAlignTime
|
||||
ReplaceEventMap)
|
||||
RemoveInternalTimer)
|
||||
);
|
||||
|
||||
#-- Export to main context with different name
|
||||
@ -265,6 +263,7 @@ our %userAttrList = (
|
||||
'ASC_RainProtection:on,off' => '-',
|
||||
'ASC_ExternalTrigger' => '-',
|
||||
'ASC_Adv:on,off' => '-',
|
||||
'ASC_CommandTemplate' => '-',
|
||||
'ASC_SlatPosCmd_SlatDevice' => '-',
|
||||
);
|
||||
|
||||
@ -1769,8 +1768,9 @@ sub _SetCmdFn {
|
||||
. '. Grund der Fahrt: '
|
||||
. $shutters->getLastDrive );
|
||||
|
||||
my $driveCommand = $shutters->getPosSetCmd . ' ' . $posValue;
|
||||
my $slatPos = -1;
|
||||
my $driveCommand = $shutters->getPosSetCmd . ' ' . $posValue;
|
||||
my $commandTemplate = $shutters->getCommandTemplate;
|
||||
my $slatPos = -1;
|
||||
|
||||
if ( $shutters->getShadingPositionAssignment ne 'none'
|
||||
|| $shutters->getOpenPositionAssignment ne 'none'
|
||||
@ -1822,32 +1822,48 @@ sub _SetCmdFn {
|
||||
}
|
||||
}
|
||||
|
||||
CommandSet( undef,
|
||||
$shuttersDev
|
||||
. ':FILTER='
|
||||
. $shutters->getPosCmd . '!='
|
||||
. $posValue . ' '
|
||||
. $driveCommand );
|
||||
if ( $commandTemplate ne 'none' ) { # Patch von Beta-User Forum https://forum.fhem.de/index.php/topic,123659.0.html
|
||||
# Nutzervariablen setzen
|
||||
my %specials = (
|
||||
'$name' => $shuttersDev,
|
||||
'$level' => $posValue,
|
||||
'$slatLevel' => $slatPos,
|
||||
'$reason' => $shutters->getLastDrive
|
||||
);
|
||||
|
||||
$commandTemplate = ::EvalSpecials($commandTemplate, %specials);
|
||||
# CMD ausführen
|
||||
::AnalyzeCommandChain( $h, $commandTemplate );
|
||||
}
|
||||
else {
|
||||
CommandSet( undef,
|
||||
$shuttersDev
|
||||
. ':FILTER='
|
||||
. $shutters->getPosCmd . '!='
|
||||
. $posValue . ' '
|
||||
. $driveCommand );
|
||||
|
||||
InternalTimer(
|
||||
gettimeofday() + 3,
|
||||
sub() {
|
||||
CommandSet(
|
||||
undef,
|
||||
(
|
||||
$shutters->getSlatDevice ne 'none'
|
||||
? $shutters->getSlatDevice
|
||||
: $shuttersDev
|
||||
)
|
||||
. ' '
|
||||
. $shutters->getSlatPosCmd . ' '
|
||||
. $slatPos
|
||||
);
|
||||
},
|
||||
$shuttersDev
|
||||
)
|
||||
if ( $slatPos > -1
|
||||
&& $shutters->getSlatPosCmd ne 'none' );
|
||||
InternalTimer(
|
||||
gettimeofday() + 3,
|
||||
sub() {
|
||||
CommandSet(
|
||||
undef,
|
||||
(
|
||||
$shutters->getSlatDevice ne 'none'
|
||||
? $shutters->getSlatDevice
|
||||
: $shuttersDev
|
||||
)
|
||||
. ' '
|
||||
. $shutters->getSlatPosCmd . ' '
|
||||
. $slatPos
|
||||
);
|
||||
},
|
||||
$shuttersDev
|
||||
)
|
||||
if ( $slatPos > -1
|
||||
&& $shutters->getSlatPosCmd ne 'none' );
|
||||
|
||||
}
|
||||
|
||||
$shutters->setSelfDefenseAbsent( 0, 0 )
|
||||
if (!$shutters->getSelfDefenseAbsent
|
||||
|
@ -516,6 +516,12 @@ sub getSelfDefenseAbsentDelay {
|
||||
return AttrVal( $self->{shuttersDev}, 'ASC_Self_Defense_AbsentDelay', 300 );
|
||||
}
|
||||
|
||||
sub getCommandTemplate {
|
||||
my $self = shift;
|
||||
|
||||
return AttrVal( $self->{shuttersDev}, 'ASC_CommandTemplate', 'none' );
|
||||
}
|
||||
|
||||
sub setWiggleValue {
|
||||
my $self = shift;
|
||||
my $attrVal = shift;
|
||||
|
Loading…
Reference in New Issue
Block a user