From 10616a0005a25b5eff18d578d524dba2c4c1f33a Mon Sep 17 00:00:00 2001 From: klaus-schauer Date: Sun, 27 Sep 2015 18:25:16 +0000 Subject: [PATCH] 10_EnOcean: autocreate teach-in modified git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@9326 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/10_EnOcean.pm | 88 ++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 45 deletions(-) diff --git a/fhem/FHEM/10_EnOcean.pm b/fhem/FHEM/10_EnOcean.pm index c5d50b2e5..fa46ff3a6 100755 --- a/fhem/FHEM/10_EnOcean.pm +++ b/fhem/FHEM/10_EnOcean.pm @@ -576,47 +576,45 @@ EnOcean_Define($$) return "wrong syntax: define EnOcean <8-digit-hex-code>|getNextID|"; } # autocreate subType from RORG - $attr{$name}{subType} = $1 if($name =~ m/EnO_(.*)_$def/); - if (@a == 4) { + if (@a == 4 && $name =~ m/EnO_$def/) { # parse received device data $hash->{DEF} = $def; - if (exists $attr{$name}{subType}) { - my ($data, $status); - (undef, undef, undef, $data, undef, $status, undef) = split(':', $a[3]); - if ($attr{$name}{subType} eq "switch") { - my $nu = (hex($status) & 0x10) >> 4; - my $t21 = (hex($status) & 0x20) >> 5; - $attr{$name}{manufID} = "7FF"; - if ($t21 && $nu) { - $attr{$name}{eep} = "F6-02-01"; - readingsSingleUpdate($hash, "teach", "RPS teach-in accepted EEP F6-02-01 Manufacturer: no ID", 1); - Log3 $name, 2, "EnOcean $name teach-in EEP F6-02-01 Manufacturer: no ID"; - } elsif (!$t21 && $nu) { - $attr{$name}{eep} = "F6-03-01"; - readingsSingleUpdate($hash, "teach", "RPS teach-in accepted EEP F6-03-01 Manufacturer: no ID", 1); - Log3 $name, 2, "EnOcean $name teach-in EEP F6-03-01 Manufacturer: no ID"; - } - } elsif ($attr{$name}{subType} eq "contact" && hex($data) & 8) { - $attr{$name}{eep} = "D5-00-01"; - $attr{$name}{manufID} = "7FF"; - readingsSingleUpdate($hash, "teach", "1BS teach-in accepted EEP D5-00-01 Manufacturer: no ID", 1); - Log3 $name, 2, "EnOcean $name teach-in EEP D5-00-01 Manufacturer: no ID"; - } elsif ($attr{$name}{subType} eq "4BS" && hex(substr($data, 6, 2)) & 8) { - readingsSingleUpdate($hash, "teach", "4BS teach-in is missing", 1); - Log3 $name, 2, "EnOcean $name teach-in is missing"; - } elsif ($attr{$name}{subType} eq "VLD") { - readingsSingleUpdate($hash, "teach", "UTE teach-in is missing", 1); - Log3 $name, 2, "EnOcean $name teach-in is missing"; - } elsif ($attr{$name}{subType} eq "MSC") { - readingsSingleUpdate($hash, "teach", "MSC teach-in not supported", 1); - Log3 $name, 2, "EnOcean $name MSC not supported"; - } elsif ($attr{$name}{subType} =~ m/^SEC|ENC$/) { - readingsSingleUpdate($hash, "teach", "STE teach-in is missing", 1); - Log3 $name, 2, "EnOcean $name secure teach-in is missing"; - } elsif ($attr{$name}{subType} =~ m/^GPCD|GPSD$/) { - readingsSingleUpdate($hash, "teach", "GP teach-in is missing", 1); - Log3 $name, 2, "EnOcean $name teach-in is missing"; - } + my ($data, $rorg, $status); + (undef, undef, $rorg, $data, undef, $status, undef) = split(':', $a[3]); + $attr{$name}{subType} = $EnO_rorgname{$rorg}; + if ($attr{$name}{subType} eq "switch") { + my $nu = (hex($status) & 0x10) >> 4; + my $t21 = (hex($status) & 0x20) >> 5; + $attr{$name}{manufID} = "7FF"; + if ($t21 && $nu) { + $attr{$name}{eep} = "F6-02-01"; + readingsSingleUpdate($hash, "teach", "RPS teach-in accepted EEP F6-02-01 Manufacturer: no ID", 1); + Log3 $name, 2, "EnOcean $name teach-in EEP F6-02-01 Manufacturer: no ID"; + } elsif (!$t21 && $nu) { + $attr{$name}{eep} = "F6-03-01"; + readingsSingleUpdate($hash, "teach", "RPS teach-in accepted EEP F6-03-01 Manufacturer: no ID", 1); + Log3 $name, 2, "EnOcean $name teach-in EEP F6-03-01 Manufacturer: no ID"; + } + } elsif ($attr{$name}{subType} eq "contact" && hex($data) & 8) { + $attr{$name}{eep} = "D5-00-01"; + $attr{$name}{manufID} = "7FF"; + readingsSingleUpdate($hash, "teach", "1BS teach-in accepted EEP D5-00-01 Manufacturer: no ID", 1); + Log3 $name, 2, "EnOcean $name teach-in EEP D5-00-01 Manufacturer: no ID"; + } elsif ($attr{$name}{subType} eq "4BS" && hex(substr($data, 6, 2)) & 8) { + readingsSingleUpdate($hash, "teach", "4BS teach-in is missing", 1); + Log3 $name, 2, "EnOcean $name teach-in is missing"; + } elsif ($attr{$name}{subType} eq "VLD") { + readingsSingleUpdate($hash, "teach", "UTE teach-in is missing", 1); + Log3 $name, 2, "EnOcean $name teach-in is missing"; + } elsif ($attr{$name}{subType} eq "MSC") { + readingsSingleUpdate($hash, "teach", "MSC not supported", 1); + Log3 $name, 2, "EnOcean $name MSC not supported"; + } elsif ($attr{$name}{subType} =~ m/^SEC|ENC$/) { + readingsSingleUpdate($hash, "teach", "STE teach-in is missing", 1); + Log3 $name, 2, "EnOcean $name secure teach-in is missing"; + } elsif ($attr{$name}{subType} =~ m/^GPCD|GPSD$/) { + readingsSingleUpdate($hash, "teach", "GP teach-in is missing", 1); + Log3 $name, 2, "EnOcean $name teach-in is missing"; } EnOcean_Parse($hash, $a[3]); } @@ -4563,10 +4561,10 @@ sub EnOcean_Parse($$) if (exists($iohash->{helper}{gpRespWait}{$destinationID}) || exists($iohash->{helper}{UTERespWait}{$destinationID}) || exists($iohash->{helper}{"4BSRespWait"}{$destinationID})) { - $ret = "UNDEFINED EnO_${rorgname}_$senderID EnOcean $senderID $msg"; - #$ret = "UNDEFINED -temporary EnO_${rorgname}_$senderID EnOcean $senderID $msg"; + $ret = "UNDEFINED EnO_$senderID EnOcean $senderID $msg"; + #$ret = "UNDEFINED -temporary EnO_$senderID EnOcean $senderID $msg"; } else { - $ret = "UNDEFINED EnO_${rorgname}_$senderID EnOcean $senderID $msg"; + $ret = "UNDEFINED EnO_$senderID EnOcean $senderID $msg"; } if ($rorgname =~ m/^GPCD|GPSD$/) { 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 = 0 if ($db[3] >= 190); $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:fanStage:$fspeed"; push @event, "3:switch:$switch"; @@ -13239,11 +13237,11 @@ EnOcean_Undef($$)
  • T: t/°C SP: 0 ... 255 F: 0|1|2|3|auto SW: 0|1
  • fanStage: 0|1|2|3|auto
  • -
  • switch: 0|1
  • +
  • switch: on|off
  • setpoint: 0 ... 255
  • setpointScaled: <floating-point number>
  • temperature: t/°C (Sensor Range: t = 0 °C ... 40 °C)
  • -
  • state: T: t/°C SP: 0 ... 255 F: 0|1|2|3|auto SW: 0|1

  • +
  • state: T: t/°C SP: 0 ... 255 F: 0|1|2|3|auto SW: on|off

  • Alternatively for Eltako devices
  • T: t/°C SPT: t/°C NR: t/°C
  • block: lock|unlock