2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-21 14:04:15 +00:00

10_EnOcean: function SetExtensionsCancel() added, subType hvac.01: attribute pidCtrl, model added

git-svn-id: https://svn.fhem.de/fhem/trunk@12747 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
klaus-schauer 2016-12-12 05:25:48 +00:00
parent 10839fe785
commit c530e68b0c

View File

@ -1,5 +1,15 @@
############################################## ##############################################
# $Id$ # $Id$
# 2016-12-06
# Added new EEP:
# Remote Management:
# EEP changed:
# EnOcean_Notify():
# EnOcean_Attr():
# function SetExtensionsCancel() added
# subType hvac.01: attribute pidCtrl, model added
# commandref: further explanations added
package main; package main;
@ -397,6 +407,7 @@ my @EnO_models = qw (
FT55 FT55
FTS12 FTS12
TF TF
OEM
tracker tracker
); );
@ -2127,6 +2138,8 @@ sub EnOcean_Set($@)
if (defined $sendCmd) { if (defined $sendCmd) {
$data = sprintf "%02X", $switchCmd; $data = sprintf "%02X", $switchCmd;
$rorg = "F6"; $rorg = "F6";
#####
SetExtensionsCancel($hash);
Log3 $name, 3, "EnOcean set $name $cmd"; Log3 $name, 3, "EnOcean set $name $cmd";
if ($updateState) { if ($updateState) {
readingsSingleUpdate($hash, "channel" . $1, $cmd1, 1) if ($cmd1 =~ m/^([A-D])./); readingsSingleUpdate($hash, "channel" . $1, $cmd1, 1) if ($cmd1 =~ m/^([A-D])./);
@ -2167,6 +2180,8 @@ sub EnOcean_Set($@)
} else { } else {
$data = sprintf "%02X", $EnO_switch_00Btn{$switchCmd}; $data = sprintf "%02X", $EnO_switch_00Btn{$switchCmd};
$rorg = "D2"; $rorg = "D2";
#####
SetExtensionsCancel($hash);
} }
Log3 $name, 3, "EnOcean set $name $switchCmd"; Log3 $name, 3, "EnOcean set $name $switchCmd";
@ -2704,7 +2719,9 @@ sub EnOcean_Set($@)
readingsBulkUpdate($hash, "waitingCmds", "setpointTemp"); readingsBulkUpdate($hash, "waitingCmds", "setpointTemp");
readingsEndUpdate($hash, 0); readingsEndUpdate($hash, 0);
# PID regulator active # PID regulator active
($err, $logLevel, $response) = EnOcean_setPID(undef, $hash, 'start', ''); #####
my $activatePID = AttrVal($name, 'pidCtrl', 'on') eq 'on' ? 'start' : 'stop';
($err, $logLevel, $response) = EnOcean_setPID(undef, $hash, $activatePID, '');
CommandDeleteReading(undef, "$name setpointSet"); CommandDeleteReading(undef, "$name setpointSet");
Log3 $name, 3, "EnOcean set $name $cmd $setpointTemp"; Log3 $name, 3, "EnOcean set $name $cmd $setpointTemp";
shift(@a); shift(@a);
@ -2725,8 +2742,9 @@ sub EnOcean_Set($@)
$updateState = 2; $updateState = 2;
} else { } else {
$cmdList .= "setpointTemp:slider,10,1,30 " if (AttrVal($name, "pidCtrl", 'on') eq 'on'); $cmdList .= "setpointTemp:slider,10,1,30 " if (AttrVal($name, "pidCtrl", 'on') eq 'on' || AttrVal($name, "model", '') eq 'OEM');
$cmdList .= "setpoint:slider,0,5,100 runInit:noArg valveCloses:noArg valveOpens:noArg"; $cmdList .= "setpoint:slider,0,5,100 " if (AttrVal($name, "pidCtrl", 'on') eq 'off' && AttrVal($name, "model", '') ne 'OEM');
$cmdList .= "runInit:noArg valveCloses:noArg valveOpens:noArg";
return "Unknown command " . $cmd . ", choose one of " . $cmdList; return "Unknown command " . $cmd . ", choose one of " . $cmdList;
} }
@ -2816,6 +2834,8 @@ sub EnOcean_Set($@)
readingsBulkUpdate($hash, "powerSwitch", "off"); readingsBulkUpdate($hash, "powerSwitch", "off");
readingsBulkUpdate($hash, "state", "off"); readingsBulkUpdate($hash, "state", "off");
readingsEndUpdate($hash, 0); readingsEndUpdate($hash, 0);
#####
SetExtensionsCancel($hash);
} elsif ($ctrlFuncID == 2) { } elsif ($ctrlFuncID == 2) {
# on # on
$powerSwitch = "on"; $powerSwitch = "on";
@ -2824,6 +2844,8 @@ sub EnOcean_Set($@)
readingsBulkUpdate($hash, "powerSwitch", "on"); readingsBulkUpdate($hash, "powerSwitch", "on");
readingsBulkUpdate($hash, "state", "off"); readingsBulkUpdate($hash, "state", "off");
readingsEndUpdate($hash, 0); readingsEndUpdate($hash, 0);
#####
SetExtensionsCancel($hash);
} elsif ($ctrlFuncID == 3) { } elsif ($ctrlFuncID == 3) {
# occupancy # occupancy
if (defined $a[1] && $a[1] =~ m/^occupied|standby|unoccupied|off$/) { if (defined $a[1] && $a[1] =~ m/^occupied|standby|unoccupied|off$/) {
@ -3020,6 +3042,8 @@ sub EnOcean_Set($@)
shift(@a); shift(@a);
} }
#$updateState = 0; #$updateState = 0;
#####
SetExtensionsCancel($hash);
$data = sprintf "%02X%04X%02X", $gwCmdID, $time, $setCmd; $data = sprintf "%02X%04X%02X", $gwCmdID, $time, $setCmd;
} elsif ($cmd eq "off") { } elsif ($cmd eq "off") {
if ($model eq "FSA12") { if ($model eq "FSA12") {
@ -3037,6 +3061,8 @@ sub EnOcean_Set($@)
shift(@a); shift(@a);
} }
#$updateState = 0; #$updateState = 0;
#####
SetExtensionsCancel($hash);
$data = sprintf "%02X%04X%02X", $gwCmdID, $time, $setCmd; $data = sprintf "%02X%04X%02X", $gwCmdID, $time, $setCmd;
} elsif ($cmd eq "local") { } elsif ($cmd eq "local") {
if ($a[1]) { if ($a[1]) {
@ -3180,6 +3206,8 @@ sub EnOcean_Set($@)
shift(@a); shift(@a);
} }
#$updateState = 0; #$updateState = 0;
#####
SetExtensionsCancel($hash);
$data = sprintf "%02X%02X%02X%02X", $gwCmdID, $dimVal, $rampTime, $setCmd; $data = sprintf "%02X%02X%02X%02X", $gwCmdID, $dimVal, $rampTime, $setCmd;
} else { } else {
@ -3722,10 +3750,14 @@ sub EnOcean_Set($@)
} elsif ($ctrlFuncID == 1) { } elsif ($ctrlFuncID == 1) {
# off # off
CommandDeleteReading(undef, "$name scene"); CommandDeleteReading(undef, "$name scene");
#####
SetExtensionsCancel($hash);
$updateState = 0; $updateState = 0;
} elsif ($ctrlFuncID == 2) { } elsif ($ctrlFuncID == 2) {
# on # on
CommandDeleteReading(undef, "$name scene"); CommandDeleteReading(undef, "$name scene");
#####
SetExtensionsCancel($hash);
$updateState = 0; $updateState = 0;
} elsif ($ctrlFuncID == 3 || $ctrlFuncID == 4) { } elsif ($ctrlFuncID == 3 || $ctrlFuncID == 4) {
# dimup / dimdown # dimup / dimdown
@ -3743,10 +3775,14 @@ sub EnOcean_Set($@)
$ctrlParam2 = ($rampTime & 0xFF00) >> 8; $ctrlParam2 = ($rampTime & 0xFF00) >> 8;
readingsSingleUpdate($hash, "rampTime", $rampTime, 1); readingsSingleUpdate($hash, "rampTime", $rampTime, 1);
CommandDeleteReading(undef, "$name scene"); CommandDeleteReading(undef, "$name scene");
#####
SetExtensionsCancel($hash);
$updateState = 0; $updateState = 0;
} elsif ($ctrlFuncID == 5) { } elsif ($ctrlFuncID == 5) {
# stop # stop
CommandDeleteReading(undef, "$name scene"); CommandDeleteReading(undef, "$name scene");
#####
SetExtensionsCancel($hash);
$updateState = 0; $updateState = 0;
} elsif ($ctrlFuncID == 6) { } elsif ($ctrlFuncID == 6) {
# dim # dim
@ -3770,6 +3806,8 @@ sub EnOcean_Set($@)
$ctrlParam2 = ($rampTime & 0xFF00) >> 8; $ctrlParam2 = ($rampTime & 0xFF00) >> 8;
CommandDeleteReading(undef, "$name scene"); CommandDeleteReading(undef, "$name scene");
readingsSingleUpdate($hash, "rampTime", $rampTime, 1); readingsSingleUpdate($hash, "rampTime", $rampTime, 1);
#####
SetExtensionsCancel($hash);
$updateState = 0; $updateState = 0;
} elsif ($ctrlFuncID == 7) { } elsif ($ctrlFuncID == 7) {
# RGB # RGB
@ -5065,7 +5103,7 @@ sub EnOcean_Set($@)
} else { } else {
$channel = 15; $channel = 15;
} }
readingsSingleUpdate($hash, "state", "stoped", 1); readingsSingleUpdate($hash, "state", "stopped", 1);
$data = sprintf "%02X", $channel << 4 | $cmdID; $data = sprintf "%02X", $channel << 4 | $cmdID;
} elsif ($cmd eq "opens") { } elsif ($cmd eq "opens") {
@ -7767,6 +7805,7 @@ sub EnOcean_Parse($$)
Log3 $name, 5, "EnOcean $name EnOcean_parse SPT: $setpointTemp SPTS: $setpointTempSet"; Log3 $name, 5, "EnOcean $name EnOcean_parse SPT: $setpointTemp SPTS: $setpointTempSet";
my $activatePID = AttrVal($name, 'pidCtrl', 'on') eq 'on' ? 'actuator' : 'stop';
my $blockKey = ((AttrVal($name, "blockKey", 'no') eq 'yes') ? 1 : 0) << 2; my $blockKey = ((AttrVal($name, "blockKey", 'no') eq 'yes') ? 1 : 0) << 2;
my $displayOrientation = $displayOrientation{AttrVal($name, "displayOrientation", 0)} << 4; my $displayOrientation = $displayOrientation{AttrVal($name, "displayOrientation", 0)} << 4;
my $maintenanceMode = ReadingsVal($name, "maintenanceMode", "off"); my $maintenanceMode = ReadingsVal($name, "maintenanceMode", "off");
@ -7891,7 +7930,7 @@ sub EnOcean_Parse($$)
$waitingCmds = 2; $waitingCmds = 2;
} else { } else {
# activate PID regulator # activate PID regulator
($err, $logLevel, $response) = EnOcean_setPID(undef, $hash, 'actuator', ''); ($err, $logLevel, $response) = EnOcean_setPID(undef, $hash, $activatePID, '');
$setpointSet = ReadingsVal($name, "setpointSet", $setpoint); $setpointSet = ReadingsVal($name, "setpointSet", $setpoint);
$setpointTemp = $setpointTempSet; $setpointTemp = $setpointTempSet;
push @event, "3:setpointTemp:$setpointTemp"; push @event, "3:setpointTemp:$setpointTemp";
@ -7946,7 +7985,7 @@ sub EnOcean_Parse($$)
$waitingCmds = 2; $waitingCmds = 2;
} else { } else {
# activate PID regulator # activate PID regulator
($err, $logLevel, $response) = EnOcean_setPID(undef, $hash, 'actuator', ''); ($err, $logLevel, $response) = EnOcean_setPID(undef, $hash, $activatePID, '');
$setpointSet = ReadingsVal($name, "setpointSet", $setpointSet); $setpointSet = ReadingsVal($name, "setpointSet", $setpointSet);
push @event, "3:setpointTemp:$setpointTemp"; push @event, "3:setpointTemp:$setpointTemp";
push @event, "3:maintenanceMode:off"; push @event, "3:maintenanceMode:off";
@ -7977,7 +8016,7 @@ sub EnOcean_Parse($$)
# sent message to the actuator # sent message to the actuator
$data = sprintf "%02X%02X%02X%02X", $setpointSet, $data = sprintf "%02X%02X%02X%02X", $setpointSet,
($setpointTempSet - 10) / 20 * 255, ($setpointTempSet - 10) / 20 * 255,
$measurementCtrl | $wakeUpCycle, (AttrVal($name, 'pidCtrl', 'on') eq 'on' ? 0 : 0x80) | $measurementCtrl | $wakeUpCycle,
$displayOrientation | 8 | $blockKey | $waitingCmds; $displayOrientation | 8 | $blockKey | $waitingCmds;
EnOcean_SndRadio(undef, $hash, $packetType, "A5", $data, $subDef, "00", $hash->{DEF}); EnOcean_SndRadio(undef, $hash, $packetType, "A5", $data, $subDef, "00", $hash->{DEF});
@ -13089,9 +13128,9 @@ sub EnOcean_setPID($$$) {
@{$hash->{helper}{calcPID}} = (undef, $hash, $cmd); @{$hash->{helper}{calcPID}} = (undef, $hash, $cmd);
if ($cmd eq 'stop' || AttrVal($name, 'pidCtrl', 'on') eq 'off') { if ($cmd eq 'stop' || AttrVal($name, 'pidCtrl', 'on') eq 'off') {
$hash->{helper}{stopped} = 1; $hash->{helper}{stopped} = 1;
readingsSingleUpdate($hash, "pidState", 'stoped', 0); readingsSingleUpdate($hash, "pidState", 'stopped', 0);
RemoveInternalTimer($hash->{helper}{calcPID}); RemoveInternalTimer($hash->{helper}{calcPID});
$response = 'stoped'; $response = 'stopped';
} elsif ($cmd eq 'start' || $cmd eq 'actuator') { } elsif ($cmd eq 'start' || $cmd eq 'actuator') {
$hash->{helper}{stopped} = 0; $hash->{helper}{stopped} = 0;
$hash->{helper}{adjust} = $adjust; $hash->{helper}{adjust} = $adjust;
@ -14495,7 +14534,7 @@ sub EnOcean_observeParse($$@)
delete $hash->{helper}{lastCmdValue}; delete $hash->{helper}{lastCmdValue};
my %functionHash = (hash => $hash, function => "observe"); my %functionHash = (hash => $hash, function => "observe");
RemoveInternalTimer(\%functionHash); RemoveInternalTimer(\%functionHash);
Log3 $name, 4, "EnOcean $name < $devName $cmd " . join(" ", @cmdValue) . " observing stoped"; Log3 $name, 4, "EnOcean $name < $devName $cmd " . join(" ", @cmdValue) . " observing stopped";
} else { } else {
# remove the device that has sent a telegram # remove the device that has sent a telegram
Log3 $name, 4, "EnOcean $name < observeRefDev " . $hash->{helper}{observeRefDev}[$observeRefDevIdx] . " removed"; Log3 $name, 4, "EnOcean $name < observeRefDev " . $hash->{helper}{observeRefDev}[$observeRefDevIdx] . " removed";
@ -14515,7 +14554,7 @@ sub EnOcean_observeParse($$@)
delete $hash->{helper}{lastCmdValue}; delete $hash->{helper}{lastCmdValue};
my %functionHash = (hash => $hash, function => "observe"); my %functionHash = (hash => $hash, function => "observe");
RemoveInternalTimer(\%functionHash); RemoveInternalTimer(\%functionHash);
Log3 $name, 4, "EnOcean $name < $devName $cmd " . join(" ", @cmdValue) . " observing stoped"; Log3 $name, 4, "EnOcean $name < $devName $cmd " . join(" ", @cmdValue) . " observing stopped";
} }
} }
@ -14614,7 +14653,7 @@ sub EnOcean_RLT($) {
} }
} else { } else {
RemoveInternalTimer($hash->{helper}{rlt}{param}); RemoveInternalTimer($hash->{helper}{rlt}{param});
readingsSingleUpdate($hash, 'state', 'stoped', 1); readingsSingleUpdate($hash, 'state', 'stopped', 1);
EnOcean_RLTResult(undef, $hash, $rltType, $rltCntrMax); EnOcean_RLTResult(undef, $hash, $rltType, $rltCntrMax);
if (exists $hash->{helper}{rlt}{oldDev}) { if (exists $hash->{helper}{rlt}{oldDev}) {
# activate old device subType # activate old device subType
@ -14648,7 +14687,7 @@ sub EnOcean_RLT($) {
} }
} elsif ($ctrl eq 'waiting') { } elsif ($ctrl eq 'waiting') {
readingsSingleUpdate($hash, 'state', 'stoped', 1); readingsSingleUpdate($hash, 'state', 'stopped', 1);
EnOcean_RLTResult(undef, $hash, $rltType, $rltCntrMax); EnOcean_RLTResult(undef, $hash, $rltType, $rltCntrMax);
if (exists $hash->{helper}{rlt}{oldDev}) { if (exists $hash->{helper}{rlt}{oldDev}) {
# activate old device subType # activate old device subType
@ -14682,7 +14721,7 @@ sub EnOcean_RLT($) {
$modules{EnOcean}{defptr}{$oldDef} = $oldHash; $modules{EnOcean}{defptr}{$oldDef} = $oldHash;
} }
delete $hash->{helper}{rlt}; delete $hash->{helper}{rlt};
readingsSingleUpdate($hash, 'state', 'stoped', 1); readingsSingleUpdate($hash, 'state', 'stopped', 1);
# delete deviceID # delete deviceID
CommandModify(undef, "$name 00000000"); CommandModify(undef, "$name 00000000");
delete $modules{EnOcean}{defptr}{$def}; delete $modules{EnOcean}{defptr}{$def};
@ -16001,7 +16040,7 @@ EnOcean_Delete($$)
is used for the EnOcean Tipp-Funk devices. The function is activated via the attribute [<a href="#EnOcean_teachMethod">teachMethod</a>] = confirm.<br> is used for the EnOcean Tipp-Funk devices. The function is activated via the attribute [<a href="#EnOcean_teachMethod">teachMethod</a>] = confirm.<br>
For example the remote device Eltako TF100D can be learned as follows For example the remote device Eltako TF100D can be learned as follows
<ul><br> <ul><br>
<code>set &lt;name&gt; EnOcean H5-38-08</code><br> <code>define &lt;name&gt; EnOcean H5-38-08</code><br>
set TF100D in learning mode<br> set TF100D in learning mode<br>
<code>set &lt;name&gt; teach</code> <code>set &lt;name&gt; teach</code>
</ul> </ul>
@ -16841,6 +16880,7 @@ EnOcean_Delete($$)
<li><a href="#EnOcean_blockKey">blockKey</a></li> <li><a href="#EnOcean_blockKey">blockKey</a></li>
<li><a href="#EnOcean_displayOrientation">displayOrientation</a></li> <li><a href="#EnOcean_displayOrientation">displayOrientation</a></li>
<li><a href="#EnOcean_measurementCtrl">measurementCtrl</a></li> <li><a href="#EnOcean_measurementCtrl">measurementCtrl</a></li>
<li><a href="#model">model</a></li>
<li><a href="#EnOcean_pidActorCallBeforeSetting">pidActorCallBeforeSetting</a></li> <li><a href="#EnOcean_pidActorCallBeforeSetting">pidActorCallBeforeSetting</a></li>
<li><a href="#EnOcean_pidActorErrorAction">pidActorErrorAction</a></li> <li><a href="#EnOcean_pidActorErrorAction">pidActorErrorAction</a></li>
<li><a href="#EnOcean_pidActorErrorPos">pidActorErrorPos</a></li> <li><a href="#EnOcean_pidActorErrorPos">pidActorErrorPos</a></li>
@ -16866,6 +16906,8 @@ EnOcean_Delete($$)
The attr subType must be hvac.04. This is done if the device was The attr subType must be hvac.04. This is done if the device was
created by autocreate. To control the device, it must be bidirectional paired, created by autocreate. To control the device, it must be bidirectional paired,
see <a href="#EnOcean_teach-in">Teach-In / Teach-Out</a>.<br> see <a href="#EnOcean_teach-in">Teach-In / Teach-Out</a>.<br>
The OEM version of the Holter SmartDrive MX has an internal PID controller. This function is activated by
attr <device> model OEM and attr <device> pidCtrl off.<br>
The command is not sent until the device wakes up and sends a message, usually The command is not sent until the device wakes up and sends a message, usually
every 5 minutes. every 5 minutes.
</li> </li>
@ -18110,7 +18152,7 @@ EnOcean_Delete($$)
</li> </li>
<li><a name="EnOcean_pidCtrl">pidCtrl</a> on|off, <li><a name="EnOcean_pidCtrl">pidCtrl</a> on|off,
[pidCtrl] = on is default<br> [pidCtrl] = on is default<br>
Activate PID regulator Activate the Fhem PID regulator
</li> </li>
<li><a name="EnOcean_pidDeltaTreshold">pidDeltaTreshold</a> &lt;floating-point number&gt;, <li><a name="EnOcean_pidDeltaTreshold">pidDeltaTreshold</a> &lt;floating-point number&gt;,
[pidDeltaTreshold] = 0 is default<br> [pidDeltaTreshold] = 0 is default<br>
@ -19922,7 +19964,7 @@ EnOcean_Delete($$)
<li>endPosition&lt;channel&gt;: open|closed|not_reached|unknown</li> <li>endPosition&lt;channel&gt;: open|closed|not_reached|unknown</li>
<li>position&lt;channel&gt;: unknown|pos/% (Sensor Range: pos = 0 % ... 100 %)</li> <li>position&lt;channel&gt;: unknown|pos/% (Sensor Range: pos = 0 % ... 100 %)</li>
<li>teach: &lt;result of teach procedure&gt;</li> <li>teach: &lt;result of teach procedure&gt;</li>
<li>state: open|closed|in_motion|stoped|pos/% (Sensor Range: pos = 0 % ... 100 %)</li> <li>state: open|closed|in_motion|stopped|pos/% (Sensor Range: pos = 0 % ... 100 %)</li>
</ul> </ul>
<br> <br>
The attr subType must be blindsCtrl.00 or blindsCtrl.01. This is done if the device was The attr subType must be blindsCtrl.00 or blindsCtrl.01. This is done if the device was
@ -20198,10 +20240,10 @@ EnOcean_Delete($$)
<li>Radio Link Test<br> <li>Radio Link Test<br>
<ul> <ul>
<li>standby|active|stoped</li> <li>standby|active|stopped</li>
<li>msgLost: msgLost/%</li> <li>msgLost: msgLost/%</li>
<li>rssiMasterAvg: LP/dBm</li> <li>rssiMasterAvg: LP/dBm</li>
<li>state: standby|active|stoped<br></li> <li>state: standby|active|stopped<br></li>
</ul><br> </ul><br>
The attr subType must be readioLinkTest. This is done if the device was The attr subType must be readioLinkTest. This is done if the device was
created by autocreate or manually by <code>define &lt;name&gt; EnOcean A5-3F-00</code><br>. created by autocreate or manually by <code>define &lt;name&gt; EnOcean A5-3F-00</code><br>.