mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-23 20:52:13 +00:00
cleanups
git-svn-id: https://svn.fhem.de/fhem/trunk@1430 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
014d2eb71f
commit
63596edd68
@ -1,30 +1,27 @@
|
|||||||
#################################################################################
|
#################################################################################
|
||||||
# 45_TRX.pm
|
# 45_TRX.pm
|
||||||
# Module for FHEM
|
|
||||||
#
|
#
|
||||||
# Tested with RFXtrx-Receiver (433.92MHz, USB)
|
# FHEM Module for RFXtrx433
|
||||||
# (see http://www.RFXCOM.com/).
|
|
||||||
# To use this module, you need to define an RFXTRX transceiver:
|
|
||||||
# define RFXTRX TRX /dev/ttyUSB0
|
|
||||||
#
|
#
|
||||||
# The module also has code to access a RFXtrx transceiver attached via LAN.
|
# Derived from 00_CUL.pm: Copyright (C) Rudolf Koenig"
|
||||||
#
|
#
|
||||||
# To use it define the IP-Adresss and the Port:
|
# Copyright (C) 2012 Willi Herzig
|
||||||
# define RFXTRX TRX 192.168.169.111:10001
|
|
||||||
# optionally you may issue not to initialize the device (useful if you share an RFXtrx device with other programs)
|
|
||||||
# define RFXTRX TRX 192.168.169.111:10001 noinit
|
|
||||||
#
|
#
|
||||||
# The RFXtrx transceivers supports lots of protocols that may be implemented for FHEM
|
# This program is free software; you can redistribute it and/or
|
||||||
# writing the appropriate FHEM modules. See the
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# Willi Herzig, 2012
|
# This program is distributed in the hope that it will be useful,
|
||||||
#
|
|
||||||
# This script is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
#################################################################################
|
# You should have received a copy of the GNU General Public License
|
||||||
# derived from 00_CUL.pm
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
# The GNU General Public License may also be found at http://www.gnu.org/licenses/gpl-2.0.html .
|
||||||
#
|
#
|
||||||
###########################
|
###########################
|
||||||
# $Id$
|
# $Id$
|
||||||
@ -260,6 +257,52 @@ TRX_DoInit($)
|
|||||||
} else {
|
} else {
|
||||||
Log 1, "TRX: Init OK";
|
Log 1, "TRX: Init OK";
|
||||||
$hash->{STATE} = "Initialized" if(!$hash->{STATE});
|
$hash->{STATE} = "Initialized" if(!$hash->{STATE});
|
||||||
|
# Analyse result and display it:
|
||||||
|
if ($buf =~ m/^\x0d\x01\x00(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)/) {
|
||||||
|
my $status = "";
|
||||||
|
|
||||||
|
my $seqnbr = $1;
|
||||||
|
my $cmnd = $2;
|
||||||
|
my $msg1 = ord($3);
|
||||||
|
my $msg2 = ord($4);
|
||||||
|
my $msg3 = ord($5);
|
||||||
|
my $msg4 = ord($6);
|
||||||
|
my $msg5 = ord($7);
|
||||||
|
my $freq = {
|
||||||
|
0x50 => '310MHz',
|
||||||
|
0x51 => '315MHz',
|
||||||
|
0x52 => '433.92MHz receiver only',
|
||||||
|
0x53 => '433.92MHz transceiver',
|
||||||
|
0x55 => '868.00MHz',
|
||||||
|
0x56 => '868.00MHz FSK',
|
||||||
|
0x57 => '868.30MHz',
|
||||||
|
0x58 => '868.30MHz FSK',
|
||||||
|
0x59 => '868.35MHz',
|
||||||
|
0x5A => '868.35MHz FSK',
|
||||||
|
0x5B => '868.95MHz'
|
||||||
|
}->{$msg1} || 'unknown Mhz';
|
||||||
|
$status .= $freq;
|
||||||
|
$status .= ", " . sprintf "firmware=%d",$msg2;
|
||||||
|
$status .= ", protocols enabled: ";
|
||||||
|
$status .= sprintf "undecoded, " if ($msg3 & 0x80);
|
||||||
|
$status .= "ProGuard " if ($msg4 & 0x20);
|
||||||
|
$status .= "FS20 " if ($msg4 & 0x10);
|
||||||
|
$status .= "LaCrosse " if ($msg4 & 0x08);
|
||||||
|
$status .= "Hideki " if ($msg4 & 0x04);
|
||||||
|
$status .= "LightwaveRF " if ($msg4 & 0x02);
|
||||||
|
$status .= "Mertik " if ($msg4 & 0x01);
|
||||||
|
$status .= "Visonic " if ($msg5 & 0x80);
|
||||||
|
$status .= "ATI " if ($msg5 & 0x40);
|
||||||
|
$status .= "OREGON " if ($msg5 & 0x20);
|
||||||
|
$status .= "KOPPLA " if ($msg5 & 0x10);
|
||||||
|
$status .= "HOMEEASY " if ($msg5 & 0x08);
|
||||||
|
$status .= "AC " if ($msg5 & 0x04);
|
||||||
|
$status .= "ARC " if ($msg5 & 0x02);
|
||||||
|
$status .= "X10 " if ($msg5 & 0x01);
|
||||||
|
my $hexline = unpack('H*', $buf);
|
||||||
|
Log 4, "TRX: Init status hexline='$hexline'";
|
||||||
|
Log 1, "TRX: Init status: '$status'";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -1,12 +1,26 @@
|
|||||||
#################################################################################
|
#################################################################################
|
||||||
# 46_TRX_ELSE.pm
|
# 46_TRX_ELSE.pm
|
||||||
# Modul for FHEM for unkown RFXTRX messages
|
|
||||||
#
|
#
|
||||||
# This script is distributed in the hope that it will be useful,
|
# FHEM module unkown RFXtrx433 messages
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012 Willi Herzig
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
##################################
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
# The GNU General Public License may also be found at http://www.gnu.org/licenses/gpl-2.0.html .
|
||||||
|
###################################
|
||||||
#
|
#
|
||||||
# values for "set global verbose"
|
# values for "set global verbose"
|
||||||
# 4: log unknown protocols
|
# 4: log unknown protocols
|
||||||
|
@ -1,24 +1,28 @@
|
|||||||
#################################################################################
|
#################################################################################
|
||||||
# 46_TRX_LIGHT.pm
|
# 46_TRX_LIGHT.pm
|
||||||
#
|
#
|
||||||
# Modul for FHEM for
|
# FHEM module for lighting protocols:
|
||||||
# "X10" -> X10 lighting
|
# X10 lighting, ARC, ELRO AB400D, Waveman, Chacon EMW200,
|
||||||
# "ARC" -> ARC
|
# IMPULS, AC (KlikAanKlikUit, NEXA, CHACON, HomeEasy UK),
|
||||||
# "AB400D" -> ELRO AB400D
|
# HomeEasy EU, ANSLUT, Ikea Koppla
|
||||||
# "WAVEMAN" -> Waveman
|
|
||||||
# "EMW200" -> Chacon EMW200
|
|
||||||
# "IMPULS" -> IMPULS
|
|
||||||
# "AC" -> KlikAanKlikUit, NEXA, CHACON, HomeEasy UK
|
|
||||||
# "HOMEEASY" -> HomeEasy EU
|
|
||||||
# "ANSLUT" -> ANSLUT
|
|
||||||
# "KOPPLA" -> Ikea Koppla
|
|
||||||
#
|
#
|
||||||
# - ms14a: motion sensor
|
# Copyright (C) 2012 Willi Herzig
|
||||||
# - x10: generic X10 sensor
|
|
||||||
#
|
#
|
||||||
# This script is distributed in the hope that it will be useful,
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
# The GNU General Public License may also be found at http://www.gnu.org/licenses/gpl-2.0.html .
|
||||||
#
|
#
|
||||||
##################################
|
##################################
|
||||||
#
|
#
|
||||||
|
@ -1,35 +1,25 @@
|
|||||||
#################################################################################
|
#################################################################################
|
||||||
# 46_TRX_SECURITY.pm
|
# 46_TRX_SECURITY.pm
|
||||||
#
|
#
|
||||||
# Modul for FHEM for X10, KD101, Visonic
|
# FHEM module for X10, KD101, Visonic
|
||||||
# - X10 security messages tested for
|
|
||||||
# - ds10a: X10 Door / Window Sensor or compatible devices
|
|
||||||
# - ss10a: X10 motion sensor
|
|
||||||
# - sd90: Marmitek smoke detector
|
|
||||||
# - kr18: X10 remote control
|
|
||||||
#
|
#
|
||||||
##################################
|
# Copyright (C) 2012 Willi Herzig
|
||||||
#
|
#
|
||||||
# Willi Herzig, 2012
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This script is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
##################################
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# Some code from X10security code is derived from http://www.xpl-perl.org.uk/.
|
# You should have received a copy of the GNU General Public License
|
||||||
# xpl-perl/lib/xPL/RF/X10Security.pm:
|
# along with this program; if not, write to the Free Software
|
||||||
# Thanks a lot to Mark Hindess who wrote xPL.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#
|
#
|
||||||
#SEE ALSO
|
# The GNU General Public License may also be found at http://www.gnu.org/licenses/gpl-2.0.html .
|
||||||
# Project website: http://www.xpl-perl.org.uk/
|
|
||||||
# AUTHOR: Mark Hindess, soft-xpl-perl@temporalanomaly.com
|
|
||||||
#
|
|
||||||
#Copyright (C) 2007, 2009 by Mark Hindess
|
|
||||||
#
|
|
||||||
#This library is free software; you can redistribute it and/or modify
|
|
||||||
#it under the same terms as Perl itself, either Perl version 5.8.7 or,
|
|
||||||
#at your option, any later version of Perl 5 you may have available.
|
|
||||||
#
|
#
|
||||||
##################################
|
##################################
|
||||||
#
|
#
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#################################################################################
|
#################################################################################
|
||||||
# 46_TRX_WEATHER.pm
|
# 46_TRX_WEATHER.pm
|
||||||
# Module for FHEM to decode weather sensor messages for RFXtrx
|
# FHEM module to decode weather sensor messages for RFXtrx
|
||||||
#
|
#
|
||||||
# The following devices are implemented to be received:
|
# The following devices are implemented to be received:
|
||||||
#
|
#
|
||||||
@ -36,21 +36,34 @@
|
|||||||
# * "WGR918_A" is STR918, WGR918
|
# * "WGR918_A" is STR918, WGR918
|
||||||
# * "TFA_WIND" is TFA
|
# * "TFA_WIND" is TFA
|
||||||
#
|
#
|
||||||
# derived from 41_OREGON.pm
|
# Copyright (C) 2012 Willi Herzig
|
||||||
#
|
|
||||||
# Willi Herzig, 2012
|
|
||||||
#
|
#
|
||||||
# This script is distributed in the hope that it will be useful,
|
# This script is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
#
|
#
|
||||||
|
# Some code was derived and modified from xpl-perl
|
||||||
|
# from the following two files:
|
||||||
|
# xpl-perl/lib/xPL/Utils.pm:
|
||||||
|
# xpl-perl/lib/xPL/RF/Oregon.pm:
|
||||||
|
#
|
||||||
|
#SEE ALSO
|
||||||
|
# Project website: http://www.xpl-perl.org.uk/
|
||||||
|
# AUTHOR: Mark Hindess, soft-xpl-perl@temporalanomaly.com
|
||||||
|
#
|
||||||
|
# Copyright (C) 2007, 2009 by Mark Hindess
|
||||||
|
#
|
||||||
|
# This library is free software; you can redistribute it and/or modify
|
||||||
|
# it under the same terms as Perl itself, either Perl version 5.8.7 or,
|
||||||
|
# at your option, any later version of Perl 5 you may have available.
|
||||||
|
|
||||||
##################################
|
##################################
|
||||||
#
|
#
|
||||||
# values for "set global verbose"
|
# values for "set global verbose"
|
||||||
# 4: log unknown protocols
|
# 4: log unknown protocols
|
||||||
# 5: log decoding hexlines for debugging
|
# 5: log decoding hexlines for debugging
|
||||||
#
|
#
|
||||||
# $Id: $
|
# $Id$
|
||||||
package main;
|
package main;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
@ -90,7 +103,6 @@ TRX_WEATHER_Define($$)
|
|||||||
my $code = $a[2];
|
my $code = $a[2];
|
||||||
|
|
||||||
$hash->{CODE} = $code;
|
$hash->{CODE} = $code;
|
||||||
#$modules{TRX_WEATHER}{defptr}{$name} = $hash;
|
|
||||||
$modules{TRX_WEATHER}{defptr}{$code} = $hash;
|
$modules{TRX_WEATHER}{defptr}{$code} = $hash;
|
||||||
AssignIoPort($hash);
|
AssignIoPort($hash);
|
||||||
|
|
||||||
@ -106,73 +118,25 @@ TRX_WEATHER_Undef($$)
|
|||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#########################################
|
|
||||||
# From xpl-perl/lib/xPL/Util.pm:
|
|
||||||
sub hi_nibble {
|
|
||||||
($_[0]&0xf0)>>4;
|
|
||||||
}
|
|
||||||
sub lo_nibble {
|
|
||||||
$_[0]&0xf;
|
|
||||||
}
|
|
||||||
sub nibble_sum {
|
|
||||||
my $c = $_[0];
|
|
||||||
my $s = 0;
|
|
||||||
foreach (0..$_[0]-1) {
|
|
||||||
$s += hi_nibble($_[1]->[$_]);
|
|
||||||
$s += lo_nibble($_[1]->[$_]);
|
|
||||||
}
|
|
||||||
$s += hi_nibble($_[1]->[$_[0]]) if (int($_[0]) != $_[0]);
|
|
||||||
return $s;
|
|
||||||
}
|
|
||||||
|
|
||||||
# --------------------------------------------
|
|
||||||
# From xpl-perl/lib/xPL/RF/Oregon.pm:
|
|
||||||
# This function creates a simple key from a device type and message
|
|
||||||
# length (in bits). It is used to as the index for the parts table.
|
|
||||||
sub type_length_key {
|
|
||||||
($_[0] << 8) + $_[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# sensor types
|
# sensor types
|
||||||
|
|
||||||
my %types =
|
my %types =
|
||||||
(
|
(
|
||||||
# TEMP
|
# TEMP
|
||||||
type_length_key(0x50, 0x08) =>
|
0x5008 => { part => 'TEMP', method => \&common_temp, },
|
||||||
{
|
|
||||||
part => 'TEMP', method => \&common_temp,
|
|
||||||
},
|
|
||||||
# HYDRO
|
# HYDRO
|
||||||
type_length_key(0x51, 0x08) =>
|
0x5108 => { part => 'HYDRO', method => \&common_hydro, },
|
||||||
{
|
|
||||||
part => 'HYDRO', method => \&common_hydro,
|
|
||||||
},
|
|
||||||
# TEMP HYDRO
|
# TEMP HYDRO
|
||||||
type_length_key(0x52, 0x0a) =>
|
0x520a => { part => 'TEMPHYDRO', method => \&common_temphydro, },
|
||||||
{
|
|
||||||
part => 'TEMPHYDRO', method => \&common_temphydro,
|
|
||||||
},
|
|
||||||
# TEMP HYDRO BARO
|
# TEMP HYDRO BARO
|
||||||
type_length_key(0x54, 0x0d) =>
|
0x540d => { part => 'TEMPHYDROBARO', method => \&common_temphydrobaro, },
|
||||||
{
|
|
||||||
part => 'TEMPHYDROBARO', method => \&common_temphydrobaro,
|
|
||||||
},
|
|
||||||
# RAIN
|
# RAIN
|
||||||
type_length_key(0x55, 0x0b) =>
|
0x550b => { part => 'RAIN', method => \&common_rain, },
|
||||||
{
|
|
||||||
part => 'RAIN', method => \&common_rain,
|
|
||||||
},
|
|
||||||
# WIND
|
# WIND
|
||||||
type_length_key(0x56, 0x10) =>
|
0x5610 => { part => 'WIND', method => \&common_anemometer, },
|
||||||
{
|
|
||||||
part => 'WIND', method => \&common_anemometer,
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
|
|
||||||
#my $DOT = q{.};
|
#my $DOT = q{.};
|
||||||
@ -234,7 +198,7 @@ sub pressure {
|
|||||||
current => $hpa,
|
current => $hpa,
|
||||||
units => 'hPa',
|
units => 'hPa',
|
||||||
forecast => $forecast,
|
forecast => $forecast,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub simple_battery {
|
sub simple_battery {
|
||||||
@ -253,7 +217,7 @@ sub simple_battery {
|
|||||||
device => $dev,
|
device => $dev,
|
||||||
type => 'battery',
|
type => 'battery',
|
||||||
current => $battery,
|
current => $battery,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub battery {
|
sub battery {
|
||||||
@ -273,22 +237,10 @@ sub battery {
|
|||||||
device => $dev,
|
device => $dev,
|
||||||
type => 'battery',
|
type => 'battery',
|
||||||
current => $battery,
|
current => $battery,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
my @uv_str =
|
|
||||||
(
|
|
||||||
qw/low low low/, # 0 - 2
|
|
||||||
qw/medium medium medium/, # 3 - 5
|
|
||||||
qw/high high/, # 6 - 7
|
|
||||||
'very high', 'very high', 'very high', # 8 - 10
|
|
||||||
);
|
|
||||||
|
|
||||||
sub uv_string {
|
|
||||||
$uv_str[$_[0]] || 'dangerous';
|
|
||||||
}
|
|
||||||
|
|
||||||
# Test if to use longid for device type
|
# Test if to use longid for device type
|
||||||
sub use_longid {
|
sub use_longid {
|
||||||
my ($longids,$dev_type) = @_;
|
my ($longids,$dev_type) = @_;
|
||||||
@ -368,8 +320,8 @@ sub common_anemometer {
|
|||||||
current => $dir,
|
current => $dir,
|
||||||
string => $dirname,
|
string => $dirname,
|
||||||
units => 'degrees',
|
units => 'degrees',
|
||||||
}
|
};
|
||||||
;
|
|
||||||
simple_battery($bytes, $dev_str, \@res, 15);
|
simple_battery($bytes, $dev_str, \@res, 15);
|
||||||
|
|
||||||
return @res;
|
return @res;
|
||||||
@ -510,7 +462,6 @@ sub common_temphydro {
|
|||||||
if ($bytes->[4] > 0) {
|
if ($bytes->[4] > 0) {
|
||||||
$dev_str .= $DOT.sprintf("%d", $bytes->[4]);
|
$dev_str .= $DOT.sprintf("%d", $bytes->[4]);
|
||||||
}
|
}
|
||||||
#Log 1,"dev_str=$dev_str";
|
|
||||||
|
|
||||||
my @res = ();
|
my @res = ();
|
||||||
|
|
||||||
@ -607,7 +558,6 @@ sub common_rain {
|
|||||||
if ($bytes->[4] > 0) {
|
if ($bytes->[4] > 0) {
|
||||||
$dev_str .= $DOT.sprintf("%d", $bytes->[4]);
|
$dev_str .= $DOT.sprintf("%d", $bytes->[4]);
|
||||||
}
|
}
|
||||||
#Log 1,"dev_str=$dev_str";
|
|
||||||
|
|
||||||
my @res = ();
|
my @res = ();
|
||||||
|
|
||||||
@ -632,16 +582,12 @@ sub common_rain {
|
|||||||
current => $train,
|
current => $train,
|
||||||
units => 'mm',
|
units => 'mm',
|
||||||
};
|
};
|
||||||
|
|
||||||
battery($bytes, $dev_str, \@res, 10);
|
battery($bytes, $dev_str, \@res, 10);
|
||||||
return @res;
|
return @res;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub raw {
|
|
||||||
$_[0]->{raw} or $_[0]->{raw} = pack 'H*', $_[0]->{hex};
|
|
||||||
}
|
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
|
|
||||||
sub
|
sub
|
||||||
TRX_WEATHER_Parse($$)
|
TRX_WEATHER_Parse($$)
|
||||||
{
|
{
|
||||||
@ -683,13 +629,12 @@ TRX_WEATHER_Parse($$)
|
|||||||
my $type = $rfxcom_data_array[0];
|
my $type = $rfxcom_data_array[0];
|
||||||
|
|
||||||
my $sensor_id = unpack('H*', chr $type);
|
my $sensor_id = unpack('H*', chr $type);
|
||||||
#Log 1, "TRX_WEATHER: sensor_id=$sensor_id";
|
|
||||||
|
|
||||||
my $key = type_length_key($type, $num_bytes);
|
my $key = ($type << 8) + $num_bytes;
|
||||||
|
|
||||||
|
my $rec = $types{$key};
|
||||||
|
|
||||||
my $rec = $types{$key} || $types{$key&0xfffff};
|
|
||||||
unless ($rec) {
|
unless ($rec) {
|
||||||
#Log 3, "TRX_WEATHER: ERROR: Unknown sensor_id=$sensor_id num_bytes=$num_bytes message='$hexline'.";
|
|
||||||
Log 4, "TRX_WEATHER: ERROR: Unknown sensor_id=$sensor_id message='$hexline'";
|
Log 4, "TRX_WEATHER: ERROR: Unknown sensor_id=$sensor_id message='$hexline'";
|
||||||
Log 1, "TRX_WEATHER: ERROR: Unknown sensor_id=$sensor_id message='$hexline'";
|
Log 1, "TRX_WEATHER: ERROR: Unknown sensor_id=$sensor_id message='$hexline'";
|
||||||
return "TRX_WEATHER: ERROR: Unknown sensor_id=$sensor_id \n";
|
return "TRX_WEATHER: ERROR: Unknown sensor_id=$sensor_id \n";
|
||||||
@ -867,11 +812,6 @@ Log 1, "TRX_WEATHER: ERROR: Unknown sensor_id=$sensor_id message='$hexline'";
|
|||||||
$def->{CHANGED}[$n++] = $val;
|
$def->{CHANGED}[$n++] = $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
#$def->{READINGS}{state}{TIME} = $tm;
|
|
||||||
#$def->{READINGS}{state}{VAL} = $val;
|
|
||||||
#$def->{CHANGED}[$n++] = "state: ".$val;
|
|
||||||
|
|
||||||
DoTrigger($name, undef);
|
DoTrigger($name, undef);
|
||||||
|
|
||||||
return $val;
|
return $val;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user