2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

10_EnOcean: Profil blindsCtrl.00/blindsCtrl.01: channel logic modified

git-svn-id: https://svn.fhem.de/fhem/trunk@19329 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
klaus.schauer 2019-05-04 19:36:18 +00:00
parent 0f32241086
commit ad6fad3f11

View File

@ -5180,7 +5180,7 @@ sub EnOcean_Set($@)
$rorg = "D2"; $rorg = "D2";
$updateState = 0; $updateState = 0;
my $cmdID; my $cmdID;
my $channel = AttrVal($name, "defaultChannel", 'all'); my $channel = AttrVal($name, "defaultChannel", 16) - 1;
my $position = 127; my $position = 127;
my $angle = 127; my $angle = 127;
my $repo = AttrVal($name, "reposition", "directly"); my $repo = AttrVal($name, "reposition", "directly");
@ -5211,10 +5211,12 @@ sub EnOcean_Set($@)
# position value # position value
if (($a[0] =~ m/^\d+$/) && ($a[0] >= 0) && ($a[0] <= 100)) { if (($a[0] =~ m/^\d+$/) && ($a[0] >= 0) && ($a[0] <= 100)) {
$position = shift(@a); $position = shift(@a);
if (defined $a[0]) { if (defined $a[0]) {
# angle value # angle value
if (($a[0] =~ m/^\d+$/) && ($a[0] >= 0) && ($a[0] <= 100)) { if (($a[0] =~ m/^\d+$/) && ($a[0] >= 0) && ($a[0] <= 100)) {
$angle = shift(@a); $angle = shift(@a);
if (defined $a[0]) { if (defined $a[0]) {
# channel # channel
$channel = shift(@a); $channel = shift(@a);
@ -5225,35 +5227,32 @@ sub EnOcean_Set($@)
} else { } else {
return "Usage: $position $angle $channel argument unknown, choose one of 1|2|3|4|all"; return "Usage: $position $angle $channel argument unknown, choose one of 1|2|3|4|all";
} }
} else {
$channel = 15; if (defined $a[0]) {
} # reposition value
if (defined $a[0]) { $repo = shift(@a);
# reposition value if ($repo eq "directly") {
$repo = shift(@a); $repo = 0;
if ($repo eq "directly") { } elsif ($repo eq "opens") {
$repo = 0; $repo = 1;
} elsif ($repo eq "opens") { } elsif ($repo eq "closes") {
$repo = 1; $repo = 2;
} elsif ($repo eq "closes") { } else {
$repo = 2; return "Usage: $position $angle $channel $repo argument unknown, choose one of directly opens closes";
} else { }
return "Usage: $position $angle $channel $repo argument unknown, choose one of directly opens closes";
} }
} }
readingsSingleUpdate($hash, "anglePos", $angle, 1); readingsSingleUpdate($hash, "anglePos", $angle, 1);
} else { } else {
return "Usage: $position $a[0] is not numeric or out of range"; return "Usage: $position $a[0] is not numeric or out of range";
} }
} else {
$channel = 15;
} }
readingsSingleUpdate($hash, "state", "in_motion", 1); readingsSingleUpdate($hash, "state", "in_motion", 1);
} else { } else {
return "Usage: $a[0] is not numeric or out of range"; return "Usage: $a[0] is not numeric or out of range";
} }
} else { } else {
return "Usage: set <name> position <position> [<angle> [<repo>]]"; return "Usage: set <name> position <position> [<angle> [<channel> [<repo>]]]";
} }
$data = sprintf "%02X%02X%02X%02X", $position, $angle, $repo << 4 | $lock, $channel << 4 | $cmdID; $data = sprintf "%02X%02X%02X%02X", $position, $angle, $repo << 4 | $lock, $channel << 4 | $cmdID;
@ -5276,8 +5275,6 @@ sub EnOcean_Set($@)
} else { } else {
return "Usage: $angle $channel argument unknown, choose one of 1|2|3|4|all"; return "Usage: $angle $channel argument unknown, choose one of 1|2|3|4|all";
} }
} else {
$channel = 15;
} }
readingsSingleUpdate($hash, "state", "in_motion", 1); readingsSingleUpdate($hash, "state", "in_motion", 1);
} else { } else {
@ -5302,8 +5299,6 @@ sub EnOcean_Set($@)
} else { } else {
return "Usage: stop $channel argument unknown, choose one of 1|2|3|4|all"; return "Usage: stop $channel argument unknown, choose one of 1|2|3|4|all";
} }
} else {
$channel = 15;
} }
readingsSingleUpdate($hash, "state", "stopped", 1); readingsSingleUpdate($hash, "state", "stopped", 1);
$data = sprintf "%02X", $channel << 4 | $cmdID; $data = sprintf "%02X", $channel << 4 | $cmdID;
@ -5324,8 +5319,6 @@ sub EnOcean_Set($@)
} else { } else {
return "Usage: opens $channel argument unknown, choose one of 1|2|3|4|all"; return "Usage: opens $channel argument unknown, choose one of 1|2|3|4|all";
} }
} else {
$channel = 15;
} }
$position = 0; $position = 0;
$repo = 0; $repo = 0;
@ -5347,8 +5340,6 @@ sub EnOcean_Set($@)
} else { } else {
return "Usage: closes $channel argument unknown, choose one of 1|2|3|4|all"; return "Usage: closes $channel argument unknown, choose one of 1|2|3|4|all";
} }
} else {
$channel = 15;
} }
$position = 100; $position = 100;
$repo = 0; $repo = 0;
@ -5367,8 +5358,6 @@ sub EnOcean_Set($@)
} else { } else {
return "Usage: unlock $channel argument unknown, choose one of 1|2|3|4|all"; return "Usage: unlock $channel argument unknown, choose one of 1|2|3|4|all";
} }
} else {
$channel = 15;
} }
$repo = 0; $repo = 0;
$lock = 7; $lock = 7;
@ -5387,8 +5376,6 @@ sub EnOcean_Set($@)
} else { } else {
return "Usage: lock $channel argument unknown, choose one of 1|2|3|4|all"; return "Usage: lock $channel argument unknown, choose one of 1|2|3|4|all";
} }
} else {
$channel = 15;
} }
$repo = 0; $repo = 0;
$lock = 1; $lock = 1;
@ -5407,8 +5394,6 @@ sub EnOcean_Set($@)
} else { } else {
return "Usage: alarm $channel argument unknown, choose one of 1|2|3|4|all"; return "Usage: alarm $channel argument unknown, choose one of 1|2|3|4|all";
} }
} else {
$channel = 15;
} }
$repo = 0; $repo = 0;
$lock = 2; $lock = 2;