mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
14_SD_RSL.pm: added support for "all" button
git-svn-id: https://svn.fhem.de/fhem/trunk@18675 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
5fa74a5eb2
commit
9db6763760
@ -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: Updated implementation for "all" button on devices
|
||||
- feature: 14_SD_WS: support sensors E0001PA,S522,TX-EZ6,other
|
||||
reading sendmode humidityTrend, temperatureTrend,
|
||||
windspeed, batteryState added
|
||||
|
@ -1,9 +1,11 @@
|
||||
###########################################
|
||||
# SIGNALduini RSL Modul. Modified version of FHEMduino Modul by Wzut
|
||||
# SIGNALduino RSL Modul. Modified version of FHEMduino Modul by Wzut
|
||||
#
|
||||
# $Id$
|
||||
# Supports following devices:
|
||||
# - Conrad RSL
|
||||
# Ralf9 2019
|
||||
# Sidey89 2019
|
||||
#####################################
|
||||
|
||||
package main;
|
||||
@ -15,41 +17,41 @@ my %sets = ( "on:noArg" => "", "off:noArg" => "");
|
||||
|
||||
my @RSLCodes;
|
||||
|
||||
# Tastenpaar [1 - 3] , Schiebeschalter/Kanal [I - IV] , an-aus [1 - 0]
|
||||
$RSLCodes[0][0][0] = 62; # ? / ? off
|
||||
$RSLCodes[0][0][1] = 54; # ? / ? on
|
||||
$RSLCodes[1][1][0] = 1; # 1 / I off
|
||||
$RSLCodes[1][1][1] = 14; # 1 / I on
|
||||
$RSLCodes[1][2][0] = 46; # 2 / I off
|
||||
$RSLCodes[1][2][1] = 38; # 2 / I on
|
||||
$RSLCodes[1][3][0] = 30; # 3 / I off
|
||||
$RSLCodes[1][3][1] = 22; # 3 / I on
|
||||
$RSLCodes[1][4][0] = 53; # 4 / I off - nicht auf 12 Kanal FB
|
||||
$RSLCodes[1][4][1] = 57; # 4 / I on - nicht auf 12 Kanal FB
|
||||
$RSLCodes[2][1][0] = 13; # 1 / II off
|
||||
$RSLCodes[2][1][1] = 5; # 1 / II on
|
||||
$RSLCodes[2][2][0] = 37; # 2 / II off
|
||||
$RSLCodes[2][2][1] = 41; # 2 / II on
|
||||
$RSLCodes[2][3][0] = 21; # 3 / II off
|
||||
$RSLCodes[2][3][1] = 25; # 3 / II on
|
||||
$RSLCodes[2][4][0] = 56; # 4 / II off - nicht auf 12 Kanal FB
|
||||
$RSLCodes[2][4][1] = 48; # 4 / II on - nicht auf 12 Kanal FB
|
||||
$RSLCodes[3][1][0] = 4; # 1 / III off
|
||||
$RSLCodes[3][1][1] = 8; # 1 / III on
|
||||
$RSLCodes[3][2][0] = 40; # 2 / III off
|
||||
$RSLCodes[3][2][1] = 32; # 2 / III on
|
||||
$RSLCodes[3][3][0] = 24; # 3 / III off
|
||||
$RSLCodes[3][3][1] = 16; # 3 / III on
|
||||
$RSLCodes[3][4][0] = 50; # 4 / III off - nicht auf 12 Kanal FB
|
||||
$RSLCodes[3][4][1] = 60; # 4 / III on - nicht auf 12 Kanal FB
|
||||
$RSLCodes[4][1][0] = 10; # 1 / IV off
|
||||
$RSLCodes[4][1][1] = 2; # 1 / IV on
|
||||
$RSLCodes[4][2][0] = 34; # 2 / IV off
|
||||
$RSLCodes[4][2][1] = 44; # 2 / IV on
|
||||
$RSLCodes[4][3][0] = 18; # 3 / IV off
|
||||
$RSLCodes[4][3][1] = 28; # 3 / IV on
|
||||
$RSLCodes[4][4][0] = 35; # 4 / IV off - nicht auf 12 Kanal FB
|
||||
$RSLCodes[4][4][1] = 19; # 4 / IV on - nicht auf 12 Kanal FB
|
||||
# Schiebeschalter/Kanal [I - IV] , Tastenpaar [1 - 4] , an-aus [1 - 0]
|
||||
$RSLCodes[0][0][0] = 0xBE; # ? / ? off
|
||||
$RSLCodes[0][0][1] = 0xB6; # ? / ? on
|
||||
$RSLCodes[1][1][0] = 0x81; # I 1 / off
|
||||
$RSLCodes[1][1][1] = 0x8E; # I 1 / on
|
||||
$RSLCodes[1][2][0] = 0xAE; # I 2 / off
|
||||
$RSLCodes[1][2][1] = 0xA6; # I 2 / on
|
||||
$RSLCodes[1][3][0] = 0x9E; # I 3 / off
|
||||
$RSLCodes[1][3][1] = 0x96; # I 3 / on
|
||||
$RSLCodes[1][4][0] = 0xB5; # I 4 / off - nicht auf 12 Kanal FB
|
||||
$RSLCodes[1][4][1] = 0xB9; # I 4 / on - nicht auf 12 Kanal FB
|
||||
$RSLCodes[2][1][0] = 0x8D; # II 1 / off
|
||||
$RSLCodes[2][1][1] = 0x85; # II 1 / on
|
||||
$RSLCodes[2][2][0] = 0xA5; # II 2 / off
|
||||
$RSLCodes[2][2][1] = 0xA9; # II 2 / on
|
||||
$RSLCodes[2][3][0] = 0x95; # II 3 / off
|
||||
$RSLCodes[2][3][1] = 0x99; # II 3 / on
|
||||
$RSLCodes[2][4][0] = 0xB8; # II 4 / off - nicht auf 12 Kanal FB
|
||||
$RSLCodes[2][4][1] = 0xB0; # II 4 / on - nicht auf 12 Kanal FB
|
||||
$RSLCodes[3][1][0] = 0x84; # III 1 / off
|
||||
$RSLCodes[3][1][1] = 0x88; # III 1 / on
|
||||
$RSLCodes[3][2][0] = 0xA8; # III 2 / off
|
||||
$RSLCodes[3][2][1] = 0xA0; # III 2 / on
|
||||
$RSLCodes[3][3][0] = 0x98; # III 3 / off
|
||||
$RSLCodes[3][3][1] = 0x90; # III 3 / on
|
||||
$RSLCodes[3][4][0] = 0xB2; # III 4 / off - nicht auf 12 Kanal FB
|
||||
$RSLCodes[3][4][1] = 0xBC; # III 4 / on - nicht auf 12 Kanal FB
|
||||
$RSLCodes[4][1][0] = 0x8A; # IV 1 / off
|
||||
$RSLCodes[4][1][1] = 0x82; # IV 1 / on
|
||||
$RSLCodes[4][2][0] = 0xA2; # IV 2 / off
|
||||
$RSLCodes[4][2][1] = 0xAC; # IV 2 / on
|
||||
$RSLCodes[4][3][0] = 0x92; # IV 3 / off
|
||||
$RSLCodes[4][3][1] = 0x9C; # IV 3 / on
|
||||
$RSLCodes[4][4][0] = 0xA3; # IV 4 / off All
|
||||
$RSLCodes[4][4][1] = 0x93; # IV 4 / on All
|
||||
|
||||
sub SD_RSL_Initialize($)
|
||||
{
|
||||
@ -80,6 +82,10 @@ sub SD_RSL_Define($$)
|
||||
|
||||
my $name = $a[0];
|
||||
my ($device,$channel,$button) = split("_",$a[2]);
|
||||
if ($channel eq "ALL") {
|
||||
$channel = 4;
|
||||
$button = 4;
|
||||
}
|
||||
return "wrong syntax: use channel 1 - 4" if(($channel > 4)); # || ($channel < 1 ));
|
||||
return "wrong syntax: use button 1 - 4" if(($button > 4)); # || ($button < 1));
|
||||
return "wrong syntax: use code 000000 - FFFFFF" if (length($device) != 6);
|
||||
@ -93,8 +99,8 @@ sub SD_RSL_Define($$)
|
||||
# code auf 32Bit umrechnen int 16777216 = 0x1000000
|
||||
#$hash->{OnCode} = ($RSLCodes[$channel][$button][1]*16777216) + hex($device);
|
||||
#$hash->{OffCode} = ($RSLCodes[$channel][$button][0]*16777216) + hex($device);
|
||||
$hash->{OnCode} = "10" . sprintf('%06b', ($RSLCodes[$channel][$button][1])) . sprintf('%24b',hex($device));
|
||||
$hash->{OffCode} = "10" . sprintf('%06b', ($RSLCodes[$channel][$button][0])) . sprintf('%24b',hex($device));
|
||||
$hash->{OnCode} = sprintf('%02X', ($RSLCodes[$channel][$button][1]));
|
||||
$hash->{OffCode} = sprintf('%02X', ($RSLCodes[$channel][$button][0]));
|
||||
|
||||
AssignIoPort($hash);
|
||||
|
||||
@ -106,9 +112,12 @@ sub SD_RSL_Set($@)
|
||||
{
|
||||
my ($hash, @a) = @_;
|
||||
my $name = $hash->{NAME};
|
||||
my $ioHash = $hash->{IODev};
|
||||
my $ioName = $ioHash->{NAME};
|
||||
my $cmd = $a[1];
|
||||
my $c;
|
||||
my $message;
|
||||
my $device = substr($hash->{DEF},0,6);
|
||||
|
||||
return join(" ", sort keys %sets) if((@a < 2) || ($cmd eq "?"));
|
||||
|
||||
@ -117,10 +126,9 @@ sub SD_RSL_Set($@)
|
||||
|
||||
return "Unknown argument $cmd, choose on or off" if(!$c);
|
||||
|
||||
my $io = $hash->{IODev};
|
||||
## Send Message to IODev using IOWrite
|
||||
$message = 'P1#' . $c . '#R' . AttrVal($name, "RSLrepetition", 6);
|
||||
Log3 $name, 4, $io->{NAME} . " RSL_SET_sendCommand: $name -> message: $message";
|
||||
$message = 'P1#0x' . $c . $device . '#R' . AttrVal($name, "RSLrepetition", 6);
|
||||
Log3 $name, 4, "$ioName RSL_SET_sendCommand: $name -> message: $message";
|
||||
IOWrite($hash, 'sendMsg', $message);
|
||||
#my $ret = IOWrite($hash, 'sendMsg', $c."_".AttrVal($name, "RSLrepetition", 6));
|
||||
#Log3 $hash, 5, "$name Set return : $ret";
|
||||
@ -151,14 +159,14 @@ sub RSL_getButtonCode($$)
|
||||
## Groupcode
|
||||
$DeviceCode = substr($msg,2,6);
|
||||
$receivedButtonCode = substr($msg,0,2);
|
||||
Log3 $hash, 5, "SD_RSL Message Devicecode: $DeviceCode Buttoncode: $receivedButtonCode";
|
||||
Log3 $hash, 4, "SD_RSL Message Devicecode: $DeviceCode Buttoncode: $receivedButtonCode";
|
||||
|
||||
if ((hex($receivedButtonCode) & 0xc0) != 0x80) {
|
||||
Log3 $hash, 4, "SD_RSL Message Error: received Buttoncode $receivedButtonCode begins not with bin 10";
|
||||
return "";
|
||||
}
|
||||
$parsedButtonCode = hex($receivedButtonCode) & 63; # nur 6 Bit bitte
|
||||
Log3 $hash, 4, "SD_RSL Message parsed Devicecode: $DeviceCode Buttoncode: $parsedButtonCode";
|
||||
$parsedButtonCode = hex($receivedButtonCode); # & 63; # nur 6 Bit bitte
|
||||
Log3 $hash, 5, "SD_RSL Message parsed Devicecode: $DeviceCode Buttoncode: $parsedButtonCode";
|
||||
|
||||
for (my $i=0; $i<5; $i++)
|
||||
{
|
||||
@ -176,8 +184,13 @@ sub RSL_getButtonCode($$)
|
||||
if (($button >-1) && ($channel > -1))
|
||||
{
|
||||
Log3 $hash, 4, "RSL button return/result: ID: $DeviceCode $receivedButtonCode DEVICE: $DeviceCode $channel $button ACTION: $action";
|
||||
if ($channel == 4 && $button == 4) {
|
||||
return $DeviceCode."_ALL ".$action;
|
||||
}
|
||||
else {
|
||||
return $DeviceCode."_".$channel."_".$button." ".$action;
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
@ -205,7 +218,7 @@ sub SD_RSL_Parse($$)
|
||||
|
||||
if(!$def)
|
||||
{
|
||||
Log3 $hash, 3, "UNDEFINED Remotebutton send to define: $deviceCode";
|
||||
Log3 $hash, 3, "$name RSL_Parse UNDEFINED Remotebutton send to define: $deviceCode";
|
||||
return "UNDEFINED RSL_$deviceCode SD_RSL $deviceCode";
|
||||
}
|
||||
|
||||
@ -252,8 +265,8 @@ sub SD_RSL_Attr(@)
|
||||
my $hash = $defs{$a[1]};
|
||||
my $iohash = $defs{$a[3]};
|
||||
my $cde = $hash->{DEF};
|
||||
delete($modules{SIGNALduino_FA20RF}{defptr}{$cde});
|
||||
$modules{SIGNALduino_FA20RF}{defptr}{$iohash->{NAME} . "." . $cde} = $hash;
|
||||
delete($modules{SD_RSL}{defptr}{$cde});
|
||||
$modules{SD_RSL}{defptr}{$iohash->{NAME} . "." . $cde} = $hash;
|
||||
return undef;
|
||||
}
|
||||
|
||||
@ -267,20 +280,23 @@ sub SD_RSL_Attr(@)
|
||||
|
||||
<a name="SD_RSL"></a>
|
||||
<h3>RSL</h3>
|
||||
The SD_RSL module decrypts and sends Conrad RSL messages sent by the SIGNALduino.<br>
|
||||
The SD_RSL module decrypts and creates Conrad RSL messages sent / received by a SIGNALduino device.<br>
|
||||
If autocreate is used, a device "<code>_ALL" like RSL_74A400_ALLis created instead of channel and button = 4.<br>
|
||||
|
||||
<br>
|
||||
<a name="SD_RSL_Define"></a>
|
||||
<b>Define</b>
|
||||
<ul>
|
||||
<p><code>define <name> SD_RSL <code>_<channel>_<button></code>
|
||||
<p><code>define <name> SD_RSL <code>_<channel>[_<button>]</code>
|
||||
<br>
|
||||
<br>
|
||||
<code><name></code> is any name assigned to the device.
|
||||
|
||||
For a better overview it is recommended to use a name in the form "RSL_B1A800_1_2"
|
||||
<br /><br />
|
||||
<code><code></code> The code is 00000-FFFFFF
|
||||
<br /><br />
|
||||
<code><channel></code> The channel is 1-4
|
||||
<code><channel></code> The channel is 1-4 or ALL
|
||||
<br /><br />
|
||||
<code><button></code> The button is 1-4
|
||||
<br /><br />
|
||||
@ -300,7 +316,7 @@ The SD_RSL module decrypts and sends Conrad RSL messages sent by the SIGNALduino
|
||||
<b>Get</b>
|
||||
<ul>
|
||||
N/A
|
||||
</ul>
|
||||
</ul><br>
|
||||
<a name="SD_RSL_Attr"></a>
|
||||
<b>Attribute</b>
|
||||
<ul>
|
||||
@ -309,9 +325,65 @@ The SD_RSL module decrypts and sends Conrad RSL messages sent by the SIGNALduino
|
||||
<li><a href="#eventMap">eventMap</a></li>
|
||||
<li><a href="#ignore">ignore</a></li>
|
||||
<li><a href="#readingFnAttributes">readingFnAttributes</a></li>
|
||||
<a name="RSLrepetition"></a>
|
||||
<li>RSLrepetition<br>
|
||||
Set the repeats for sending signal.
|
||||
</li>
|
||||
</ul>
|
||||
=end html
|
||||
|
||||
=begin html_DE
|
||||
|
||||
<a name="SD_RSL"></a>
|
||||
<h3>RSL</h3>
|
||||
Das SD_RSL-Modul decodiert und erstellt Conrad-RSL-Nachrichten, die vom SIGNALduino gesendet bzw. empfangen werden.<br>
|
||||
Beim Verwendung von Autocreate wird bei der Taste All anstatt channel und button = 4 "<code>_ALL" angelegt, z.B. RSL_74A400_ALL<br>
|
||||
<br>
|
||||
<a name="SD_RSL_Define"></a>
|
||||
<b>Define</b>
|
||||
<ul>
|
||||
<p><code>define <name> SD_RSL <code>_<channel>[_<button>]</code>
|
||||
<br>
|
||||
<br>
|
||||
<code><name></code> ist ein Name, der dem Gerät zugewiesen ist.
|
||||
Zur besseren Übersicht wird empfohlen, einen Namen in dieser Form zu verwenden "RSL_B1A800_1_2"
|
||||
<br /><br />
|
||||
<code><code></code> Der Code ist 00000-FFFFFF
|
||||
<br /><br />
|
||||
<code><channel></code> Der Kanal ist 1-4 oder ALL
|
||||
<br /><br />
|
||||
<code><button></code> Der Knopf ist 1-4
|
||||
<br /><br />
|
||||
</ul>
|
||||
<a name="SD_RSL_Set"></a>
|
||||
<b>Set</b>
|
||||
<ul>
|
||||
<code>set <name> <value></code>
|
||||
<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>
|
||||
<ul>
|
||||
N/A
|
||||
</ul><br>
|
||||
<a name="SD_RSL_Attr"></a>
|
||||
<b>Attribute</b>
|
||||
<ul>
|
||||
<li><a href="#IODev">IODev</a></li>
|
||||
<li><a href="#do_not_notify">do_not_notify</a></li>
|
||||
<li><a href="#eventMap">eventMap</a></li>
|
||||
<li><a href="#ignore">ignore</a></li>
|
||||
<li><a href="#readingFnAttributes">readingFnAttributes</a></li>
|
||||
<a name="RSLrepetition"></a>
|
||||
<li>RSLrepetition<br>
|
||||
Stellen Sie die Wiederholungen für das Senden des Signals ein.
|
||||
</li>
|
||||
</ul>
|
||||
=end html_DE
|
||||
|
||||
=cut
|
Loading…
Reference in New Issue
Block a user