2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-04 11:26:55 +00:00

10_EnOcean: autocreate teach-in modified

git-svn-id: https://svn.fhem.de/fhem/trunk@9328 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
klaus-schauer 2015-09-28 04:57:33 +00:00
parent 60745216da
commit d6d7dd61ce

View File

@ -576,13 +576,12 @@ EnOcean_Define($$)
return "wrong syntax: define <name> EnOcean <8-digit-hex-code>|getNextID|<EEP>"; return "wrong syntax: define <name> EnOcean <8-digit-hex-code>|getNextID|<EEP>";
} }
# autocreate subType from RORG # autocreate subType from RORG
$attr{$name}{subType} = $1 if($name =~ m/EnO_(.*)_$def/); if (@a == 4 && $name =~ m/EnO_$def/) {
if (@a == 4) {
# parse received device data # parse received device data
$hash->{DEF} = $def; $hash->{DEF} = $def;
if (exists $attr{$name}{subType}) { my ($data, $rorg, $status);
my ($data, $status); (undef, undef, $rorg, $data, undef, $status, undef) = split(':', $a[3]);
(undef, undef, undef, $data, undef, $status, undef) = split(':', $a[3]); $attr{$name}{subType} = $EnO_rorgname{$rorg};
if ($attr{$name}{subType} eq "switch") { if ($attr{$name}{subType} eq "switch") {
my $nu = (hex($status) & 0x10) >> 4; my $nu = (hex($status) & 0x10) >> 4;
my $t21 = (hex($status) & 0x20) >> 5; my $t21 = (hex($status) & 0x20) >> 5;
@ -608,7 +607,7 @@ EnOcean_Define($$)
readingsSingleUpdate($hash, "teach", "UTE teach-in is missing", 1); readingsSingleUpdate($hash, "teach", "UTE teach-in is missing", 1);
Log3 $name, 2, "EnOcean $name teach-in is missing"; Log3 $name, 2, "EnOcean $name teach-in is missing";
} elsif ($attr{$name}{subType} eq "MSC") { } elsif ($attr{$name}{subType} eq "MSC") {
readingsSingleUpdate($hash, "teach", "MSC teach-in not supported", 1); readingsSingleUpdate($hash, "teach", "MSC not supported", 1);
Log3 $name, 2, "EnOcean $name MSC not supported"; Log3 $name, 2, "EnOcean $name MSC not supported";
} elsif ($attr{$name}{subType} =~ m/^SEC|ENC$/) { } elsif ($attr{$name}{subType} =~ m/^SEC|ENC$/) {
readingsSingleUpdate($hash, "teach", "STE teach-in is missing", 1); readingsSingleUpdate($hash, "teach", "STE teach-in is missing", 1);
@ -617,7 +616,6 @@ EnOcean_Define($$)
readingsSingleUpdate($hash, "teach", "GP teach-in is missing", 1); readingsSingleUpdate($hash, "teach", "GP teach-in is missing", 1);
Log3 $name, 2, "EnOcean $name teach-in is missing"; Log3 $name, 2, "EnOcean $name teach-in is missing";
} }
}
EnOcean_Parse($hash, $a[3]); EnOcean_Parse($hash, $a[3]);
} }
#$hash->{NOTIFYDEV} = "global"; #$hash->{NOTIFYDEV} = "global";
@ -4563,10 +4561,10 @@ sub EnOcean_Parse($$)
if (exists($iohash->{helper}{gpRespWait}{$destinationID}) || if (exists($iohash->{helper}{gpRespWait}{$destinationID}) ||
exists($iohash->{helper}{UTERespWait}{$destinationID}) || exists($iohash->{helper}{UTERespWait}{$destinationID}) ||
exists($iohash->{helper}{"4BSRespWait"}{$destinationID})) { exists($iohash->{helper}{"4BSRespWait"}{$destinationID})) {
$ret = "UNDEFINED EnO_${rorgname}_$senderID EnOcean $senderID $msg"; $ret = "UNDEFINED EnO_$senderID EnOcean $senderID $msg";
#$ret = "UNDEFINED -temporary EnO_${rorgname}_$senderID EnOcean $senderID $msg"; #$ret = "UNDEFINED -temporary EnO_$senderID EnOcean $senderID $msg";
} else { } else {
$ret = "UNDEFINED EnO_${rorgname}_$senderID EnOcean $senderID $msg"; $ret = "UNDEFINED EnO_$senderID EnOcean $senderID $msg";
} }
if ($rorgname =~ m/^GPCD|GPSD$/) { if ($rorgname =~ m/^GPCD|GPSD$/) {
Log3 undef, 4, "EnOcean Unknown GP device with SenderID $senderID and $rorgname telegram, please define it."; Log3 undef, 4, "EnOcean Unknown GP device with SenderID $senderID and $rorgname telegram, please define it.";
@ -5394,7 +5392,7 @@ sub EnOcean_Parse($$)
$fspeed = 1 if ($db[3] >= 165); $fspeed = 1 if ($db[3] >= 165);
$fspeed = 0 if ($db[3] >= 190); $fspeed = 0 if ($db[3] >= 190);
$fspeed = "auto" if ($db[3] >= 210); $fspeed = "auto" if ($db[3] >= 210);
my $switch = $db[0] & 1; my $switch = $db[0] & 1 ? "on" : "off";
push @event, "3:state:T: $temp SP: $db[2] F: $fspeed SW: $switch"; push @event, "3:state:T: $temp SP: $db[2] F: $fspeed SW: $switch";
push @event, "3:fanStage:$fspeed"; push @event, "3:fanStage:$fspeed";
push @event, "3:switch:$switch"; push @event, "3:switch:$switch";
@ -8673,46 +8671,47 @@ sub EnOcean_Notify(@)
} elsif ($devName eq "global" && $s =~ m/^DEFINED ([^ ]*)$/) { } elsif ($devName eq "global" && $s =~ m/^DEFINED ([^ ]*)$/) {
my $definedName = $1; my $definedName = $1;
if ($definedName =~ m/FileLog_EnO_(.*)_(.*)/) { if ($definedName =~ m/FileLog_(EnO_.*)/) {
# teach-in response actions # teach-in response actions
# delete temporary teach-in response device # delete temporary teach-in response device
my $rorgName = $1; $definedName = $1;
my $rorgName = AttrVal($definedName, "subType", '');
if (defined $hash->{IODev}{helper}{UTERespWaitDel}{$name} && $rorgName eq "UTE") { if (defined $hash->{IODev}{helper}{UTERespWaitDel}{$name} && $rorgName eq "UTE") {
CommandDelete(undef, substr($definedName, 8)); CommandDelete(undef, $definedName);
delete $hash->{IODev}{helper}{UTERespWaitDel}{$name}; delete $hash->{IODev}{helper}{UTERespWaitDel}{$name};
Log3 $name, 2, "EnOcean $name UTE temporary teach-in response device " . substr($definedName, 8) . " deleted"; Log3 $name, 2, "EnOcean $name UTE temporary teach-in response device " . $definedName . " deleted";
EnOcean_CommandSave(undef, undef); EnOcean_CommandSave(undef, undef);
#CommandRereadCfg(undef, undef); #CommandRereadCfg(undef, undef);
##### #####
#delete $hash->{IODev}{helper}{UTERespWaitDel}{$name}; #delete $hash->{IODev}{helper}{UTERespWaitDel}{$name};
#Log3 $name, 2, "EnOcean $name UTE temporary teach-in response device " . substr($definedName, 8) . " deleted"; #Log3 $name, 2, "EnOcean $name UTE temporary teach-in response device " . $definedName . " deleted";
#my %functionHash = (hash => $hash, function => "delete", deleteDevice => substr($definedName, 8), oldDevice => undef); #my %functionHash = (hash => $hash, function => "delete", deleteDevice => $definedName, oldDevice => undef);
#RemoveInternalTimer(\%functionHash); #RemoveInternalTimer(\%functionHash);
#InternalTimer(gettimeofday() + 0.1, "EnOcean_CommandDelete", \%functionHash, 0); #InternalTimer(gettimeofday() + 0.1, "EnOcean_CommandDelete", \%functionHash, 0);
} }
if (defined $hash->{IODev}{helper}{"4BSRespWaitDel"}{$name} && $rorgName eq "4BS") { if (defined $hash->{IODev}{helper}{"4BSRespWaitDel"}{$name} && $rorgName eq "4BS") {
CommandDelete(undef, substr($definedName, 8)); CommandDelete(undef, $definedName);
delete $hash->{IODev}{helper}{"4BSRespWaitDel"}{$name}; delete $hash->{IODev}{helper}{"4BSRespWaitDel"}{$name};
Log3 $name, 2, "EnOcean $name 4BS temporary teach-in response device " . substr($definedName, 8) . " deleted"; Log3 $name, 2, "EnOcean $name 4BS temporary teach-in response device " . $definedName . " deleted";
EnOcean_CommandSave(undef, undef); EnOcean_CommandSave(undef, undef);
#CommandRereadCfg(undef, undef); #CommandRereadCfg(undef, undef);
##### #####
#delete $hash->{IODev}{helper}{"4BSRespWaitDel"}{$name}; #delete $hash->{IODev}{helper}{"4BSRespWaitDel"}{$name};
#Log3 $name, 2, "EnOcean $name 4BS temporary teach-in response device " . substr($definedName, 8) . " deleted"; #Log3 $name, 2, "EnOcean $name 4BS temporary teach-in response device " . $definedName . " deleted";
#my %functionHash = (hash => $hash, function => "delete", deleteDevice => substr($definedName, 8), oldDevice => undef); #my %functionHash = (hash => $hash, function => "delete", deleteDevice => $definedName, oldDevice => undef);
#RemoveInternalTimer(\%functionHash); #RemoveInternalTimer(\%functionHash);
#InternalTimer(gettimeofday() + 0.1, "EnOcean_CommandDelete", \%functionHash, 0); #InternalTimer(gettimeofday() + 0.1, "EnOcean_CommandDelete", \%functionHash, 0);
} }
if (defined $hash->{IODev}{helper}{gpRespWaitDel}{$name} && $rorgName eq "GPTR") { if (defined $hash->{IODev}{helper}{gpRespWaitDel}{$name} && $rorgName eq "GPTR") {
CommandDelete(undef, substr($definedName, 8)); CommandDelete(undef, $definedName);
delete $hash->{IODev}{helper}{gpRespWaitDel}{$name}; delete $hash->{IODev}{helper}{gpRespWaitDel}{$name};
Log3 $name, 2, "EnOcean $name GP temporary teach-in response device " . substr($definedName, 8) . " deleted"; Log3 $name, 2, "EnOcean $name GP temporary teach-in response device " . $definedName . " deleted";
EnOcean_CommandSave(undef, undef); EnOcean_CommandSave(undef, undef);
#CommandRereadCfg(undef, undef); #CommandRereadCfg(undef, undef);
##### #####
#delete $hash->{IODev}{helper}{gpRespWaitDel}{$name}; #delete $hash->{IODev}{helper}{gpRespWaitDel}{$name};
#Log3 $name, 2, "EnOcean $name GP temporary teach-in response device " . substr($definedName, 8) . " deleted"; #Log3 $name, 2, "EnOcean $name GP temporary teach-in response device " . $definedName . " deleted";
#my %functionHash = (hash => $hash, function => "delete", deleteDevice => substr($definedName, 8), oldDevice => undef); #my %functionHash = (hash => $hash, function => "delete", deleteDevice => $definedName, oldDevice => undef);
#RemoveInternalTimer(\%functionHash); #RemoveInternalTimer(\%functionHash);
#InternalTimer(gettimeofday() + 0.1, "EnOcean_CommandDelete", \%functionHash, 0); #InternalTimer(gettimeofday() + 0.1, "EnOcean_CommandDelete", \%functionHash, 0);
} }
@ -13239,11 +13238,11 @@ EnOcean_Undef($$)
<ul> <ul>
<li>T: t/&#176C SP: 0 ... 255 F: 0|1|2|3|auto SW: 0|1</li> <li>T: t/&#176C SP: 0 ... 255 F: 0|1|2|3|auto SW: 0|1</li>
<li>fanStage: 0|1|2|3|auto</li> <li>fanStage: 0|1|2|3|auto</li>
<li>switch: 0|1</li> <li>switch: on|off</li>
<li>setpoint: 0 ... 255</li> <li>setpoint: 0 ... 255</li>
<li>setpointScaled: &lt;floating-point number&gt;</li> <li>setpointScaled: &lt;floating-point number&gt;</li>
<li>temperature: t/&#176C (Sensor Range: t = 0 &#176C ... 40 &#176C)</li> <li>temperature: t/&#176C (Sensor Range: t = 0 &#176C ... 40 &#176C)</li>
<li>state: T: t/&#176C SP: 0 ... 255 F: 0|1|2|3|auto SW: 0|1</li><br> <li>state: T: t/&#176C SP: 0 ... 255 F: 0|1|2|3|auto SW: on|off</li><br>
Alternatively for Eltako devices Alternatively for Eltako devices
<li>T: t/&#176C SPT: t/&#176C NR: t/&#176C</li> <li>T: t/&#176C SPT: t/&#176C NR: t/&#176C</li>
<li>block: lock|unlock</li> <li>block: lock|unlock</li>