From 17fb8f27ab429492b280b8cb2415f2cb88b1794a Mon Sep 17 00:00:00 2001 From: "klaus.schauer" <> Date: Thu, 27 Oct 2022 04:34:42 +0000 Subject: [PATCH] 10_EnOcean: profil manufProfile / manufID 002 changed git-svn-id: https://svn.fhem.de/fhem/trunk@26598 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/10_EnOcean.pm | 102 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 101 insertions(+), 1 deletion(-) diff --git a/fhem/FHEM/10_EnOcean.pm b/fhem/FHEM/10_EnOcean.pm index 498b959b2..98150a6e1 100755 --- a/fhem/FHEM/10_EnOcean.pm +++ b/fhem/FHEM/10_EnOcean.pm @@ -453,6 +453,7 @@ my %EnO_eepConfig = ( "G5.3F.7F" => {attr => {subType => "manufProfile", eep => "A5-3F-7F", manufID => "00D", webCmd => "opens:stop:closes"}}, "H5.3F.7F" => {attr => {subType => "manufProfile", comMode => "confirm", eep => "A5-3F-7F", manufID => "00D", model => "Eltako_TF", sensorMode => 'pushbutton', settingAccuracy => "high", teachMethod => "confirm", webCmd => "opens:stop:closes"}}, "I5.3F.7F" => {attr => {subType => "manufProfile", comMode => "confirm", eep => "A5-3F-7F", manufID => "00D", model => "Eltako_FRM60", sensorMode => 'pushbutton', teachMethod => "confirm", webCmd => "opens:stop:closes:position"}}, + "J5.3F.7F" => {attr => {subType => "manufProfile", eep => "A5-3F-7F", manufID => "002"}}, "M5.38.08" => {attr => {subType => "gateway", eep => "A5-38-08", gwCmd => "switching", manufID => "00D", webCmd => "on:off"}}, "N5.38.08" => {attr => {subType => "gateway", comMode => "confirm", eep => "A5-38-08", gwCmd => "switching", manufID => "00D", model => "Eltako_TF", teachMethod => "confirm", webCmd => "on:off"}}, "O5.38.08" => {attr => {subType => "gateway", comMode => "confirm", eep => "A5-38-08", gwCmd => "switching", manufID => "00D", model => "Eltako_FSR14", teachMethod => "confirm", webCmd => "on:off"}}, @@ -4900,6 +4901,73 @@ sub EnOcean_Set($@) { } Log3 $name, 3, "EnOcean set $name $cmd"; } + } elsif ($manufID eq "002") { + # [Thermokon SR65 3AI, untested] + # $db[3] is the input 3 where 0x00 = 0 V ... 0xFF = 10 V + # $db[2] is the input 2 where 0x00 = 0 V ... 0xFF = 10 V + # $db[1] is the input 1 where 0x00 = 0 V ... 0xFF = 10 V + $rorg = "A5"; + if($cmd eq "teach") { + # teach-in EEP A5-3F-7F, Manufacturer "Thermokon" + $data = "FFF80280"; + $attr{$name}{eep} = "A5-3F-7F"; + CommandDeleteReading(undef, "$name .*"); + readingsSingleUpdate($hash, "teach", "4BS teach-in sent", 1); + $updateState = 0; + } elsif ($cmd =~ m/^input([123])$/) { + my $channel = $1; + return "Usage: numeric argument missing" if (!defined($a[1])); + return "Usage: $a[1] is not numeric or out of range" if ($a[1] !~ m/^\d+(\.\d+)?$/ || $a[1] > 10); + my @input; + for (my $i = 1; $i < 4; $i ++) { + $input[$i] = $channel == $i ? $a[1] : ReadingsVal($name, "input" . $i, 0); + } + $data = sprintf "%02X%02X%02X08", int($input[3] / 10 * 255), int($input[2] / 10 * 255), int($input[1] / 10 * 255); + readingsBeginUpdate($hash); + readingsBulkUpdateIfChanged($hash, $cmd, $a[1]); + my $setpointScaled = EnOcean_ReadingScaled($hash, $a[1], 0, 10); + readingsBulkUpdateIfChanged($hash, $cmd . "Scaled", $setpointScaled) if (defined $setpointScaled); + readingsBulkUpdateIfChanged($hash, 'state', "I1: $input[1] I2: $input[2] I3: $input[3]"); + readingsEndUpdate($hash, 1); + shift @a; + $updateState = 0; + } elsif ($cmd =~ m/^input([123])Scaled$/) { + my $channel = $1; + return "Usage: numeric argument missing" if (!defined($a[1])); + my $scaleMin = AttrVal($name, "scaleMin", undef); + my $scaleMax = AttrVal($name, "scaleMax", undef); + my ($rangeMin, $rangeMax); + if (defined $scaleMax && defined $scaleMin && + $scaleMax =~ m/^[+-]?\d+(\.\d+)?$/ && $scaleMin =~ m/^[+-]?\d+(\.\d+)?$/) { + if ($scaleMin > $scaleMax) { + ($rangeMin, $rangeMax) = ($scaleMax, $scaleMin); + } else { + ($rangeMin, $rangeMax) = ($scaleMin, $scaleMax); + } + } else { + return "Usage: Attributes scaleMin and/or scaleMax not defined or not numeric."; + } + my @input; + if ($a[1] =~ m/^[+-]?\d+(\.\d+)?$/ && $a[1] >= $rangeMin && $a[1] <= $rangeMax) { + $input[$channel] = 10 * $scaleMin / ($scaleMin - $scaleMax) - 10 / ($scaleMin - $scaleMax) * $a[1]; + for (my $i = 1; $i < 4; $i ++) { + $input[$i] = $channel == $i ? $input[$i] : ReadingsVal($name, "input" . $i, 0); + } + $data = sprintf "%02X%02X%02X08", int($input[3] / 10 * 255), int($input[2] / 10 * 255), int($input[1] / 10 * 255); + readingsBeginUpdate($hash); + readingsBulkUpdateIfChanged($hash, "input" . $channel, $input[$channel]); + readingsBulkUpdateIfChanged($hash, $cmd, $a[1]); + readingsBulkUpdateIfChanged($hash, 'state', "I1: $input[1] I2: $input[2] I3: $input[3]"); + readingsEndUpdate($hash, 1); + shift @a; + $updateState = 0; + } else { + return "Usage: $a[1] is not numeric or out of range"; + } + } else { + return "Unknown argument " . $cmd . ", choose one of " . $cmdList . "input1:slider,0,0.5,10 input1Scaled input2:slider,0,0.5,10 input2Scaled input3:slider,0,0.5,10 input3Scaled teach:noArg" + } + Log3 $name, 3, "EnOcean set $name $cmd"; } } elsif ($st eq "actuator.01") { @@ -19075,6 +19143,7 @@ sub EnOcean_Delete($$) {
set <name> <value>
+ value
is
+