mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
14_SD_RSL.PM: support for setExtensions added
git-svn-id: https://svn.fhem.de/fhem/trunk@20671 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c9a5b0e28e
commit
7f5a74a3b1
@ -1,5 +1,6 @@
|
||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||
# Do not insert empty lines here, update check depends on it.
|
||||
- feature: 14_SD_RSL.PM: support for setExtensions added
|
||||
- change: 59_Weather: delete table options in commandref
|
||||
- bugfix: 73_AutoShuttersControl: fix Commandref, skip ExternalTrigger Drive
|
||||
from adv check
|
||||
|
@ -14,8 +14,12 @@ package main;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use SetExtensions;
|
||||
|
||||
my %sets = ( "on:noArg" => "", "off:noArg" => "");
|
||||
my %sets = (
|
||||
"on" => sub { return $_[0]->{OnCode}; },
|
||||
"off" => sub { return $_[0]->{OffCode}; }
|
||||
);
|
||||
|
||||
my @RSLCodes;
|
||||
|
||||
@ -114,33 +118,23 @@ sub SD_RSL_Define($$) {
|
||||
##########################################################
|
||||
sub SD_RSL_Set($@) {
|
||||
my ($hash, $name, @a) = @_;
|
||||
my $cmd = $a[0];
|
||||
return "\"set $name\" needs at least one argument" unless(defined($cmd));
|
||||
|
||||
my $cmdList= join(" ", map { "$_:noArg" } sort keys %sets);
|
||||
if (exists($sets{$cmd})) {
|
||||
my $ioHash = $hash->{IODev};
|
||||
my $ioName = $ioHash->{NAME};
|
||||
my $cmd = $a[0];
|
||||
my $c;
|
||||
my $message;
|
||||
my $device = substr($hash->{DEF},0,6);
|
||||
|
||||
return join(" ", sort keys %sets) if((@a < 1) || ($cmd eq "?"));
|
||||
|
||||
$c = $hash->{OnCode} if ($cmd eq "on") ;
|
||||
$c = $hash->{OffCode} if ($cmd eq "off");
|
||||
|
||||
return "Unknown argument $cmd, choose on or off" if(!$c);
|
||||
|
||||
## Send Message to IODev using IOWrite
|
||||
$message = 'P1#0x' . $c . $device . '#R' . AttrVal($name, "RSLrepetition", 6);
|
||||
my $c= $sets{$cmd}->($hash,@a);
|
||||
my $message = 'P1#0x' . $c . $device . '#R' . AttrVal($name, "RSLrepetition", 6);
|
||||
Log3 $name, 3, "$ioName RSL_set: $name $cmd -> sendMsg: $message";
|
||||
IOWrite($hash, 'sendMsg', $message);
|
||||
#my $ret = IOWrite($hash, 'sendMsg', $c."_".AttrVal($name, "RSLrepetition", 6));
|
||||
#Log3 $hash, 5, "$name Set return : $ret";
|
||||
|
||||
#if (($cmd eq "on") && ($hash->{STATE} eq "off")){$cmd = "stop";}
|
||||
#if (($cmd eq "off") && ($hash->{STATE} eq "on")) {$cmd = "stop";}
|
||||
|
||||
#$hash->{CHANGED}[0] = $cmd;
|
||||
#$hash->{STATE} = $cmd;
|
||||
readingsSingleUpdate($hash,"state",$cmd,1);
|
||||
} else {
|
||||
return SetExtensions($hash, $cmdList, $name, @a)
|
||||
}
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
@ -243,6 +237,7 @@ sub SD_RSL_Parse($$) {
|
||||
########################################################
|
||||
sub SD_RSL_Undef($$) {
|
||||
my ($hash, $name) = @_;
|
||||
SetExtensionsCancel($hash);
|
||||
delete($modules{SD_RSL}{defptr}{$hash->{DEF}}) if($hash && $hash->{DEF});
|
||||
return undef;
|
||||
}
|
||||
@ -296,13 +291,11 @@ If autocreate is used, a device "<code>_ALL" like RSL_74A400_ALL
|
||||
<a name="SD_RSL_Set"></a>
|
||||
<b>Set</b>
|
||||
<ul>
|
||||
<code>set <name> <value></code>
|
||||
<code>set <name> <[on|off|toggle]></code><br>
|
||||
Switches the device on or off.<br><br>
|
||||
<code>set <name> <[on-for-timer|off-for-timer|on-till|off-till|blink|intervals]></code><br>
|
||||
Switches the socket for a specified duration. For Details see <a href="#setExtensions">set extensions</a>.<br><br>
|
||||
<br /><br />
|
||||
<code><value></code> can be one of the following values:<br>
|
||||
<pre>
|
||||
off
|
||||
on
|
||||
</pre>
|
||||
</ul>
|
||||
<a name="SD_RSL_Get"></a>
|
||||
<b>Get</b>
|
||||
@ -350,13 +343,11 @@ Beim Verwendung von Autocreate wird bei der Taste All anstatt channel und button
|
||||
<a name="SD_RSL_Set"></a>
|
||||
<b>Set</b>
|
||||
<ul>
|
||||
<code>set <name> <value></code>
|
||||
<code>set <name> <[on|off|toggle]></code><br
|
||||
Schaltet das Gerät ein oder aus.<br><br>
|
||||
<code>set <name> <[on-for-timer|off-for-timer|on-till|off-till|blink|intervals]></code><br>
|
||||
Schaltet das Gerät für einen bestimmten Zeitraum. Weitere Infos hierzu unter <a href="#setExtensions">set extensions</a>.<br><br>
|
||||
<br /><br />
|
||||
<code><value></code> kann einer der folgenden Werte sein:<br>
|
||||
<pre>
|
||||
off
|
||||
on
|
||||
</pre>
|
||||
</ul>
|
||||
<a name="SD_RSL_Get"></a>
|
||||
<b>Get</b>
|
||||
|
Loading…
Reference in New Issue
Block a user