Skip to content

Commit

Permalink
new protocol 115 for Bresser 6-in-1 and new 5-in-1 Comfort Wetter Cen…
Browse files Browse the repository at this point in the history
…ter (#1010)

* 00_SIGNALduino.pm - add rfmode Bresser_6in1
* 14_SD_WS.pm - add protocol 115
* SD_ProtocolData.pm - add definition for protocol 115
* SD_Protocols.pm - add check for Bresser 6-in-1
* README.md - add entry for Bresser 6-in-1 Comfort Wetter Center 
Co-authored-by: sidey79 <7968127+sidey79@users.noreply.github.com>
* 02_ConvBresser_6in1.t - Added test for new sub
* SD_Protocols.pm - Error messaage adapted like other subs
* SD_Protocolst - Testdata corrected
  • Loading branch information
elektron-bbs committed Aug 30, 2021
1 parent f6516a4 commit f007244
Show file tree
Hide file tree
Showing 8 changed files with 217 additions and 32 deletions.
19 changes: 5 additions & 14 deletions CHANGED
Original file line number Diff line number Diff line change
@@ -1,46 +1,37 @@
2021-08-18 - Update protocol 64 for sensor WH2A (#1009)

2021-08-18 - Update protocol 64 for sensor WH2A (#1009)
SD_ProtocolData.pm - correction length_max
14_SD_WS.pm - fix sub SD_WS_Parse, changes due to perlcritic
README.md - change of entry WH2

2021-08-14 - SIGNALduino_calcRSSI check input parameter (#1007)

* 02_SIGNALduino_calcRSSI.t:

- Test extended
- Bug reproduced

* 00_SIGNALduino.pm

- SIGNALduino_calcRSSI Check input parameters

2021-08-13 - Fixes perlcritic return undef in 14_SD_WS (#1006)
2021-08-11 - Fixes perlcritic return undef; (#979)

2021-08-11 - Fixes perlcritic return undef; (#979)
14_BresserTemeo.pm:
Fixes perlcritic return undef;

14_SD_RSL.pm:
Fixes perlcritic return undef;

14_SD_WS.pm:
Fixes perlcritic return undef;

14_SD_WS09.pm:
Fixes perlcritic return undef;

41_OREGON.pm:
Fixes perlcritic return undef;
2021-08-08 - new protocol 114 for TR401 (#1002)

2021-08-06 - new protocol 114 for TR401 ( #1002 )

2021-08-08 - new protocol 114 for TR401 (#1002)
* 00_SIGNALduino.pm: added protocol 114 to SD_UT match
* SD_ProtocolData.pm: added protocol 114
* 14_SD_UT.pm: added model TR401
* README.md: Updated
2021-08-08 - new protocol 113 for GFGT 433 B1 Wireless Grill Thermometer (#1003)

2021-08-08 - new protocol 113 for GFGT 433 B1 Wireless Grill Thermometer (#1003)
* SD_ProtocolData.pm - Definition for protocol 113 added
* 14_SD_WS.pm - Demodulation for protocol 113 added
* README.md - Entry for GFGT 433 B1 added
Expand Down
18 changes: 15 additions & 3 deletions FHEM/00_SIGNALduino.pm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $Id: 00_SIGNALduino.pm v3.5.2 2021-08-13 20:19:26Z sidey79 $
# $Id: 00_SIGNALduino.pm v3.5.2 2021-08-29 21:54:48Z elektron-bbs $
#
# v3.5.2 - https://github.com/RFD-FHEM/RFFHEM/tree/master
# The module is inspired by the FHEMduino project and modified in serval ways for processing the incoming messages
Expand Down Expand Up @@ -39,7 +39,7 @@ use List::Util qw(first);


use constant {
SDUINO_VERSION => '3.5.2+20210813', # Datum wird automatisch bei jedem pull request aktualisiert
SDUINO_VERSION => '3.5.2+20210829', # Datum wird automatisch bei jedem pull request aktualisiert
SDUINO_INIT_WAIT_XQ => 1.5, # wait disable device
SDUINO_INIT_WAIT => 2,
SDUINO_INIT_MAXRETRY => 3,
Expand Down Expand Up @@ -272,7 +272,7 @@ my %matchListSIGNALduino = (
my %symbol_map = (one => 1 , zero =>0 ,sync => '', float=> 'F', 'start' => '');

## rfmode for attrib & supported rfmodes
my @rfmode = ('Avantek','Bresser_5in1','KOPP_FC','Lacrosse_mode1','Lacrosse_mode2','Lacrosse_mode4','PCA301','SlowRF');
my @rfmode = ('Avantek','Bresser_5in1','Bresser_6in1','KOPP_FC','Lacrosse_mode1','Lacrosse_mode2','Lacrosse_mode4','PCA301','SlowRF');

############################# package main
sub SIGNALduino_Initialize {
Expand Down Expand Up @@ -4756,6 +4756,12 @@ USB-connected devices (SIGNALduino):<br>
<li>rfmode<br>
Configures the RF transceiver of the SIGNALduino (CC1101). The available arguments:
<ul>
<li>Bresser_5in1<br>
modulation 2-FSK, Datarate=8.23 kbps, Sync Word=2DD4, FIFO-THR=28 Byte, frequency 868.35 MHz
</li>
<li>Bresser_6in1<br>
modulation 2-FSK, Datarate=8.23 kbps, Sync Word=2DD4, FIFO-THR=20 Byte, frequency 868.35 MHz
</li>
<li>KOPP_FC<br>
modulation GFSK, Datarate=4.7855 kbps, Sync Word=AA54, frequency 868.3MHz
</li>
Expand Down Expand Up @@ -5297,6 +5303,12 @@ USB-connected devices (SIGNALduino):<br>
<li>rfmode<br>
Konfiguriert den RF Transceiver des SIGNALduino (CC1101). Verf&uuml;gbare Argumente sind:
<ul>
<li>Bresser_5in1<br>
Modulation 2-FSK, Datenrate=8.23 kbps, Sync Word=2DD4, FIFO-THR=28 Byte, Frequenz 868.35 MHz
</li>
<li>Bresser_6in1<br>
Modulation 2-FSK, Datenrate=8.23 kbps, Sync Word=2DD4, FIFO-THR=20 Byte, Frequenz 868.35 MHz
</li>
<li>KOPP_FC<br>
Modulation GFSK, Datenrate=4.7855 kbps, Sync Word=AA54, Frequenz 868.3MHz
</li>
Expand Down
92 changes: 87 additions & 5 deletions FHEM/14_SD_WS.pm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $Id: 14_SD_WS.pm 21666 2021-08-17 19:14:52Z elektron-bbs $
# $Id: 14_SD_WS.pm 21666 2021-08-29 21:54:48Z elektron-bbs $
#
# The purpose of this module is to support serval
# weather sensors which use various protocol
Expand Down Expand Up @@ -34,6 +34,7 @@
# 03.06.2021 PerlCritic - HardTabs durch Leerzeichen ersetzt & Einrueckungen sortiert (keine Code/Syntaxaenderung vorgenommen)
# 06.06.2021 neues Protokoll 111: TS-FT002 Water tank level monitor with temperature
# 16.07.2021 neues Protokoll 113: Wireless Grill Thermometer, Model name: GFGT 433 B1
# 31.07.2021 neues Protokoll 115: Bresser 6-in-1 Comfort Wetter Center

package main;

Expand Down Expand Up @@ -87,6 +88,7 @@ sub SD_WS_Initialize($)
'SD_WS_110_TR.*' => { ATTR => 'event-min-interval:.*:300 event-on-change-reading:.*', FILTER => '%NAME', GPLOT => 'temp4:Temp,', autocreateThreshold => '3:180'},
'SD_WS_111_TL.*' => { ATTR => 'event-min-interval:.*:300 event-on-change-reading:.*', FILTER => '%NAME', GPLOT => 'temp4:Temp,', autocreateThreshold => '3:600'},
'SD_WS_113_T.*' => { ATTR => 'event-min-interval:.*:60 event-on-change-reading:.*', FILTER => '%NAME', GPLOT => 'temp4:Temp,', autocreateThreshold => '10:180'},
'SD_WS_115.*' => { ATTR => 'event-min-interval:.*:300 event-on-change-reading:.*', FILTER => '%NAME', GPLOT => 'temp4hum4:Temp/Hum,', autocreateThreshold => '5:120'},
};
return;
}
Expand Down Expand Up @@ -156,6 +158,7 @@ sub SD_WS_Parse($$)
my $sendCounter;
my $beep;
my $distance;
my $uv;

my %decodingSubs = (
50 => # Protocol 50
Expand Down Expand Up @@ -887,6 +890,83 @@ sub SD_WS_Parse($$)
},
crcok => sub {return 1;}, # Check could not be determined yet.
} ,
115 => {
# https://github.com/merbanan/rtl_433/blob/master/src/devices/bresser_6in1.c
# The compact 6-in-1 multifunction outdoor sensor transmits the data on 868.3 MHz.
# The device uses FSK-PCM encoding, the device sends a transmission every 12 seconds.
# There are at least two different message types:
# temperatur, hum, uv and rain (alternating messages)
# wind data (every message)
# A transmission starts with a preamble of 0xAA.
# Preamble: aa aa aa aa aa 2d d4
#
# 1 2 3
# 0123456789012345678901234567890123456789
# ----------------------------------------
# 3DA820B00C1618FFFFFF1808152294FFF01E0000 Msg 1, 40 Nibble from SIGNALduino, T: 15.2 H: 94 G:0 W: 0 D:180
# CCCCIIIIIIIIFFGGGWWWDDD?TTT?HH????SS Msg 1, 36 Nibble
# CCCCIIIIIIIIFFGGGWWWDDD?ffRRRRVVV?SS Msg 2, 36 Nibble
# C = CRC16
# I = station ID
# F = flags, 4 bit (1: weather station, 2: indoor?, 4: soil probe), 1 bit battery (1=ok, 0=low), 3 bit channel
# G = wind gust in 1/10 m/s, inverted, BCD coded, GGG = FE6 =~ 019 => 1.9 m/s.
# W = wind speed in 1/10 m/s, inverted, BCD coded, LSB first nibble, MSB last two nibble, WWW = EFE =~ 101 => 1.1 m/s.
# D = wind direction in grad, BCD coded, DDD = 158 => 158 °
# ? = unknown, always 0x8
# T = temperature in 1/10 °C, only if byte 12 ne 0xFF, BCD coded, TTT = 312 => 31.2 °C
# ? = unknown
# H = humidity in percent, only if byte 12 ne 0xFF, BCD coded, HH = 23 => 23 %
# R = rain counter, only if byte 12 eq 0xFF, inverted, BCD coded
# V = uv, only if byte 12 eq 0xFF and byte 15/16 not 0xFF01, inverted, BCD coded
# ? = unknown
# S = checksum (sum over byte 2 - 17 must be 255)
sensortype => 'Bresser_6in1, new Bresser_5in1',
model => 'SD_WS_115',
prematch => sub { return 1; }, # no precheck known
id => sub {my ($rawData,undef) = @_; return substr($rawData,4,8); },
bat => sub {my (undef,$bitData) = @_; return substr($bitData,52,1) eq '1' ? 'ok' : 'low';},
channel => sub {my (undef,$bitData) = @_; return (SD_WS_binaryToNumber($bitData,53,55));},
windgust => sub {my ($rawData,undef) = @_;
$windgust = substr($rawData,14,3);
$windgust =~ tr/0123456789ABCDEF/FEDCBA9876543210/;
return if ($windgust !~ m/^\d+$/xms);
return $windgust * 0.1;
},
windspeed => sub {my ($rawData,undef) = @_;
$windspeed = substr($rawData,18,2) . substr($rawData,17,1);
$windspeed =~ tr/0123456789ABCDEF/FEDCBA9876543210/;
return if ($windspeed !~ m/^\d+$/xms);
return $windspeed * 0.1;
},
winddir => sub {my ($rawData,undef) = @_;
$winddir = substr($rawData,20,3);
return if ($winddir !~ m/^\d+$/xms);
return ($winddir * 1, $winddirtxtar[round(($winddir / 22.5),0)]);
},
temp => sub {my ($rawData,undef) = @_;
return if (substr($rawData,24,2) eq 'FF');
$rawTemp = (substr($rawData,24,1) . substr($rawData,25,1) . substr($rawData,26,1)) * 0.1;
if ($rawTemp > 60) {$rawTemp -= 100};
return $rawTemp;
},
hum => sub {my ($rawData,undef) = @_;
return if (substr($rawData,24,2) eq 'FF');
return substr($rawData,28,2) + 0;
},
rain => sub {my ($rawData,undef) = @_;
return if (substr($rawData,24,2) ne 'FF');
$rain = substr($rawData,26,4);
$rain =~ tr/0123456789ABCDEF/FEDCBA9876543210/;
return $rain * 0.1;
},
uv => sub {my ($rawData,undef) = @_;
return if (substr($rawData,24,2) ne 'FF' || substr($rawData,30,3) !~ m/^\d+$/xms);
$uv = substr($rawData,30,3);
return if ($uv !~ m/^\d+$/xms);
return $uv * 0.1;
},
crcok => sub {return 1;}, # checks are in SD_Protocols.pm sub ConvBresser_6in1
},
);

Log3 $name, 4, "$name: SD_WS_Parse protocol $protocol, rawData $rawData";
Expand Down Expand Up @@ -1220,6 +1300,7 @@ sub SD_WS_Parse($$)
$sendmode = $decodingSubs{$protocol}{sendmode}->( $rawData,$bitData ) if (exists($decodingSubs{$protocol}{sendmode}));
$trend = $decodingSubs{$protocol}{trend}->( $rawData,$bitData ) if (exists($decodingSubs{$protocol}{trend}));
$distance = $decodingSubs{$protocol}{distance}->( $rawData,$bitData ) if (exists($decodingSubs{$protocol}{distance}));
$uv = $decodingSubs{$protocol}{uv}->( $rawData,$bitData ) if (exists($decodingSubs{$protocol}{uv}));
Log3 $iohash, 4, "$name: SD_WS_Parse decoded protocol-id $protocol ($SensorTyp), sensor-id $id";
}
else {
Expand Down Expand Up @@ -1394,6 +1475,7 @@ sub SD_WS_Parse($$)
readingsBulkUpdate($hash, "rain_total", $rain_total) if (defined($rain_total));
readingsBulkUpdate($hash, "sendCounter", $sendCounter) if (defined($sendCounter));
readingsBulkUpdate($hash, "distance", $distance) if (defined($distance));
readingsBulkUpdate($hash, "uv", $uv) if (defined($uv));
readingsEndUpdate($hash, 1); # Notify is done by Dispatch

return $name;
Expand Down Expand Up @@ -1488,7 +1570,7 @@ sub SD_WS_WH2SHIFT($){
<li>ADE WS1907 Weather station with rain gauge</li>
<li>Atech wireless weather station</li>
<li>BBQ temperature sensor GT-TMBBQ-01s (transmitter), GT-TMBBQ-01e (receiver)</li>
<li>Bresser 5-in-1 Comfort Weather Center, 7009994, Professional rain gauge, Temeo</li>
<li>Bresser 5-in-1 and 6-in-1 Comfort Weather Center, 7009994, Professional rain gauge, Temeo</li>
<li>Conrad S522</li>
<li>EuroChron EFTH-800, EFS-3110A (temperature and humidity sensor)</li>
<li>NC-3911, NC-3912 refrigerator thermometer</li>
Expand Down Expand Up @@ -1543,7 +1625,7 @@ sub SD_WS_WH2SHIFT($){
<li>temperature (&deg;C)</li>
<li>temperatureTrend (consistent, rising, falling)</li>
<li>type (type of sensor)</li>
<li>windDirectionDegree (Wind direction, 0-337,5°, in steps of 22,5°)</li>
<li>windDirectionDegree (Wind direction, grad)</li>
<li>windDirectionText (Wind direction, N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW)</li>
<li>windGust (Gust of wind, m/s)</li>
<li>windSpeed (Wind speed, m/s)</li>
Expand Down Expand Up @@ -1607,7 +1689,7 @@ sub SD_WS_WH2SHIFT($){
<li>ADE WS1907 Wetterstation mit Regenmesser</li>
<li>Atech Wetterstation</li>
<li>BBQ Temperatur Sensor GT-TMBBQ-01s (Sender), GT-TMBBQ-01e (Empfaenger)</li>
<li>Bresser 5-in-1 Comfort Wetter Center, 7009994, Profi Regenmesser, Temeo</li>
<li>Bresser 5-in-1 und 6-in-1 Comfort Wetter Center, 7009994, Profi Regenmesser, Temeo</li>
<li>Conrad S522</li>
<li>EuroChron EFTH-800, EFS-3110A (Temperatur- und Feuchtigkeitssensor)</li>
<li>Kabelloses Grillthermometer, Modellname: GFGT 433 B1</li>
Expand Down Expand Up @@ -1663,7 +1745,7 @@ sub SD_WS_WH2SHIFT($){
<li>temperature (Temperatur &deg;C)</li>
<li>temperatureTrend (Trend Temperatur gleichbleibend, steigend, fallend)</li>
<li>type (Sensortypen)</li>
<li>windDirectionDegree (Windrichtung, 0-337,5°, in Schritten von 22,5°)</li>
<li>windDirectionDegree (Windrichtung, Grad)</li>
<li>windDirectionText (Windrichtung, N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW)</li>
<li>windGust (Windboe, m/s)</li>
<li>windSpeed (Windgeschwindigkeit, m/s)</li>
Expand Down
27 changes: 22 additions & 5 deletions FHEM/lib/SD_ProtocolData.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###########################################################################################################################################
# $Id: SD_ProtocolData.pm 3.4.4 2021-08-17 19:14:52Z elektron-bbs $
# $Id: SD_ProtocolData.pm 3.4.4 2021-08-29 21:54:48Z elektron-bbs $
# The file is part of the SIGNALduino project.
# All protocol definitions are contained in this file.
#
Expand Down Expand Up @@ -86,7 +86,7 @@ package lib::SD_ProtocolData;
use strict;
use warnings;

our $VERSION = '1.34';
our $VERSION = '1.35';

our %protocols = (
"0" => ## various weather sensors (500 | 9100)
Expand Down Expand Up @@ -2983,9 +2983,26 @@ package lib::SD_ProtocolData;
length_min => '12',
length_max => '12',
},

# "115" => reserved @elektron-bbs

"115" => ## BRESSER 6-in-1 Weather Center, Bresser new 5-in-1 sensors 7002550
# https://github.com/RFD-FHEM/RFFHEM/issues/607#issuecomment-888542022 @ Alex-S1981 2021-07-28
# The sensor alternately sends two different messages every 12 seconds.
# T: 15.2 H: 93 W: 0.8 MN;D=3BF120B00C1618FF77FF0458152293FFF06B0000;R=242;
# W: 0.6 R: 5.6 MN;D=1E6C20B00C1618FF99FF0458FFFFA9FF015B0000;R=241;
{
name => 'Bresser 6in1',
comment => 'BRESSER 6-in-1 weather center',
id => '115',
knownFreqs => '868.35',
datarate => '8.207',
sync => '2DD4',
modulation => '2-FSK',
rfmode => 'Bresser_6in1',
register => ['0001','0246','0344','042D','05D4','06FF','07C0','0802','0D21','0E65','0FE8','1088','114C','1202','1322','14F8','1551','1916','1B43','1C68'],
preamble => 'W115#',
clientmodule => 'SD_WS',
length_min => '36',
method => \&lib::SD_Protocols::ConvBresser_6in1,
},
########################################################################
#### ### register informations from other hardware protocols #### ####

Expand Down
35 changes: 35 additions & 0 deletions FHEM/lib/SD_Protocols.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1793,6 +1793,41 @@ sub ConvBresser_5in1 {
return substr($hexData, 28, 24);
}

=item ConvBresser_6in1()
This function checks CRC16 over bytes 2 - 17 and sum over bytes 2 - 17 (must be 255).
Input: $hexData
Output: $hexData
scalar converted message on success
or array (1,"Error message")
=cut

sub ConvBresser_6in1 {
my $self = shift // carp 'Not called within an object';
my $hexData = shift // croak 'Error: called without $hexdata as input';
my $hexLength = length ($hexData);

return ( 1, 'ConvBresser_6in1, hexData is to short' ) if ( $hexLength < 36 ); # check double, in def length_min set

my $crc = substr( $hexData, 0, 4 );
my $ctx = Digest::CRC->new(width => 16, poly => 0x1021);
my $calcCrc = sprintf( "%04X", $ctx->add( pack 'H*', substr( $hexData, 4, 30 ) )->digest );
$self->_logging(qq[ConvBresser_6in1, calcCRC16 = 0x$calcCrc, CRC16 = 0x$crc],5);
return ( 1, qq[ConvBresser_6in1, checksumCalc:0x$calcCrc != checksum:0x$crc] ) if ($calcCrc ne $crc);

my $sum = 0;
for (my $i = 2; $i < 18; $i++) {
$sum += hex(substr($hexData,($i) * 2, 2));
}
$sum &= 0xFF;
$self->_logging(qq[ConvBresser_6in1, sum = $sum],5);
return ( 1, qq[ConvBresser_6in1, sum $sum != 255] ) if ($sum != 255);

return $hexData;
}

############################# package lib::SD_Protocols, test exists
=item ConvPCA301()
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Supported Devices / Protocols
|BF-301 | Remote control|
|benon (Semexo OHG) | Remote control (BH-P)|
|BOSCH / Neff / Refsta Topdraft | Remote control (SF01 01319004, SF01 01319004 v2)|
|BRESSER 5-in-1, Professional Rain Gauge, TemeoTrend | Weather Station, Rain Gauge, Thermo-/Hygro Sensor |
|BRESSER 5-in-1, 6-in-1, Professional Rain Gauge, TemeoTrend | Weather Station, Rain Gauge, Thermo-/Hygro Sensor |
|CAME TOP 432EV | Remote control |
|CTW600, WH1080, WH2315 | Weather station |
|Clarus | remote power socket|
Expand Down
8 changes: 4 additions & 4 deletions controls_signalduino.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
UPD 2021-08-14_10:14:35 228769 FHEM/00_SIGNALduino.pm
UPD 2021-08-29_20:30:08 229349 FHEM/00_SIGNALduino.pm
UPD 2020-06-15_17:41:39 17876 FHEM/10_FS10.pm
UPD 2020-05-26_11:51:12 20465 FHEM/10_SD_GT.pm
UPD 2021-08-11_21:38:30 10096 FHEM/14_BresserTemeo.pm
Expand All @@ -8,11 +8,11 @@ UPD 2020-10-03_11:48:15 11170 FHEM/14_SD_AS.pm
UPD 2021-07-13_20:29:34 29223 FHEM/14_SD_BELL.pm
UPD 2021-08-11_21:38:30 12573 FHEM/14_SD_RSL.pm
UPD 2021-08-08_19:14:43 167137 FHEM/14_SD_UT.pm
UPD 2021-08-18_20:38:01 95125 FHEM/14_SD_WS.pm
UPD 2021-08-29_20:30:08 100249 FHEM/14_SD_WS.pm
UPD 2020-04-13_23:15:56 18426 FHEM/14_SD_WS07.pm
UPD 2021-08-11_21:38:30 35313 FHEM/14_SD_WS09.pm
UPD 2020-04-13_23:15:56 14325 FHEM/14_SD_WS_Maverick.pm
UPD 2021-08-11_21:38:30 37904 FHEM/41_OREGON.pm
UPD 2020-12-17_23:16:30 15582 FHEM/90_SIGNALduino_un.pm
UPD 2021-08-18_20:38:01 217734 FHEM/lib/SD_ProtocolData.pm
UPD 2021-06-02_05:49:05 71700 FHEM/lib/SD_Protocols.pm
UPD 2021-08-29_20:30:08 218835 FHEM/lib/SD_ProtocolData.pm
UPD 2021-08-29_23:52:52 72899 FHEM/lib/SD_Protocols.pm
Loading

0 comments on commit f007244

Please sign in to comment.