mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-04 17:36:39 +00:00
generate devices with hexcodes as state for unknown types
git-svn-id: https://svn.fhem.de/fhem/trunk@2337 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
a9047496b2
commit
432ea5ad80
@ -37,6 +37,8 @@ my $TRX_ELSE_debug = 0;
|
|||||||
|
|
||||||
my $time_old = 0;
|
my $time_old = 0;
|
||||||
|
|
||||||
|
my $DOT = q{_};
|
||||||
|
|
||||||
sub
|
sub
|
||||||
TRX_ELSE_Initialize($)
|
TRX_ELSE_Initialize($)
|
||||||
{
|
{
|
||||||
@ -65,9 +67,10 @@ TRX_ELSE_Define($$)
|
|||||||
my $name = $a[0];
|
my $name = $a[0];
|
||||||
my $code = $a[2];
|
my $code = $a[2];
|
||||||
|
|
||||||
$hash->{CODE} = $code;
|
my $device_name = "TRX_UNKNOWN".$DOT.$code;
|
||||||
#$modules{TRX_ELSE}{defptr}{$name} = $hash;
|
|
||||||
$modules{TRX_ELSE}{defptr}{$code} = $hash;
|
$hash->{TRX_LIGHT_CODE} = $code;
|
||||||
|
$modules{TRX_ELSE}{defptr}{$device_name} = $hash;
|
||||||
AssignIoPort($hash);
|
AssignIoPort($hash);
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
@ -82,9 +85,6 @@ TRX_ELSE_Undef($$)
|
|||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
my $DOT = q{_};
|
|
||||||
|
|
||||||
sub
|
sub
|
||||||
TRX_ELSE_Parse($$)
|
TRX_ELSE_Parse($$)
|
||||||
{
|
{
|
||||||
@ -125,10 +125,30 @@ TRX_ELSE_Parse($$)
|
|||||||
if (($msg != 0x00) && ($msg != 0x01)) {
|
if (($msg != 0x00) && ($msg != 0x01)) {
|
||||||
Log 0, "TRX_ELSE: error transmit NACK=".sprintf("%02x",$msg);
|
Log 0, "TRX_ELSE: error transmit NACK=".sprintf("%02x",$msg);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
Log 0, "TRX_ELSE: hex=$msg";
|
#Log 0, "TRX_ELSE: hex=$msg";
|
||||||
|
|
||||||
|
my $type_hex = sprintf("%02x", $type);
|
||||||
|
|
||||||
|
my $device_name = "TRX".$DOT."UNKNOWN".$DOT.$type_hex;
|
||||||
|
|
||||||
|
my $def = $modules{TRX_ELSE}{defptr}{$device_name};
|
||||||
|
if (!$def) {
|
||||||
|
Log 1, "UNDEFINED $device_name TRX_ELSE $type_hex";
|
||||||
|
Log 3, "TRX_ELSE: TRX_ELSE Unknown device $device_name, please define it";
|
||||||
|
return "UNDEFINED $device_name TRX_ELSE $type_hex";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readingsBeginUpdate($def);
|
||||||
|
|
||||||
|
#my $sensor = "hexline";
|
||||||
|
my $current = $msg;
|
||||||
|
#readingsBulkUpdate($def, $sensor, $current);
|
||||||
|
|
||||||
|
readingsBulkUpdate($def, "state", $current);
|
||||||
|
|
||||||
|
|
||||||
|
readingsEndUpdate($def, 1);
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -141,8 +161,25 @@ TRX_ELSE_Parse($$)
|
|||||||
<a name="TRX_ELSE"></a>
|
<a name="TRX_ELSE"></a>
|
||||||
<h3>TRX_ELSE</h3>
|
<h3>TRX_ELSE</h3>
|
||||||
<ul>
|
<ul>
|
||||||
The TRX_ELSE module is invoked by TRX if a code is received by RFXCOM RFXtrx433 RF receiver that is currently not handled by a TRX_-Module. There is nothing to be defined for this module. You need to define an RFXtrx433 receiver first. See <a href="#TRX">TRX</a>.
|
The TRX_ELSE module is invoked by TRX if a code is received by RFXCOM RFXtrx433 RF receiver that is currently not handled by a TRX_-Module. You need to define an RFXtrx433 receiver first.
|
||||||
|
See <a href="#TRX">TRX</a>.
|
||||||
|
<br>
|
||||||
<a name="TRX_SECURITYdefine"></a>
|
<a name="TRX_SECURITYdefine"></a>
|
||||||
|
<br>
|
||||||
|
<b>Define</b>
|
||||||
|
<ul>
|
||||||
|
<code>define <name> TRX_ELSE <hextype></code> <br>
|
||||||
|
<br>
|
||||||
|
<code><hextype></code>
|
||||||
|
<ul>
|
||||||
|
specifies the hexvalue (00 - ff) of the type received by the RFXtrx433 transceiver. <br>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
Example: <br>
|
||||||
|
<code>define TRX_UNKNOWN_9A TRX_ELSE 9A</code>
|
||||||
|
<br>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
=end html
|
=end html
|
||||||
|
Loading…
x
Reference in New Issue
Block a user