Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new protocol 110 for ADE WS1907 Weather station #970

Merged
merged 12 commits into from
May 23, 2021
23 changes: 8 additions & 15 deletions CHANGED
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
2021-05-15 - FSK check msg length (#959)

* check message lenght FSK
before: check only min message length
after: chek min and max message lenght
2021-05-05 - check message lenght FSK
2021-05-22 - new protocol 110 for ADE WS1907 Weather station

before: check only min message length
after: chek min and max message lenght
2021-05-01 - enable delete attribute rfmode (#958)
2021-05-15 - FSK check msg length (#959)
before: check only min message length
after: chek min and max message lenght

* 00_SIGNALduino.pm
- enable delete attribute rfmode
- Added tests for delete and partial rfmode attr
- Added exact match of rfmode instead of pattern matching
Co-authored-by: sidey79 <7968127+sidey79@users.noreply.github.com>
2021-04-30 - 00_SIGNALduino.pm
2021-04-30 - enable delete attribute rfmode
- Added tests for delete and partial rfmode attr
- Added exact match of rfmode instead of pattern matching
Co-authored-by: sidey79 <7968127+sidey79@users.noreply.github.com>

2021-04-26 - delete attribute rfmode
00_SIGNALduinio.pm: Bugfix: "Rfmode" attribute could not be deleted.

2021-04-25 - Revolt enhacement (#956)
SD_ProtocolData.pm: Feature: Added crc checksum verification to avoid autocrate on broken transmissions
SD_Protocols.pm: changed length
Expand Down
67 changes: 66 additions & 1 deletion FHEM/14_SD_WS.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
##############################################
# $Id: 14_SD_WS.pm 21666 2020-04-13 21:14:53Z Sidey $
# $Id: 14_SD_WS.pm 21666 2020-05-22 21:30:00Z Sidey $
#
# The purpose of this module is to support serval
# weather sensors which use various protocol
Expand Down Expand Up @@ -28,6 +28,7 @@
# 22.02.2020 Protokoll 58: neuer Sensor TFA 30.3228.02, FT007T Thermometer Sensor
# 25.08.2020 Protokoll 27: neuer Sensor EFS-3110A
# 27.09.2020 neues Protokoll 106: BBQ Temperature Sensor GT-TMBBQ-01s (Sender), GT-TMBBQ-01e (Empfaenger)
# 15.05.2021 neues Protokoll 110: ADE WS1907 Weather station with rain gauge

package main;

Expand Down Expand Up @@ -78,6 +79,7 @@ sub SD_WS_Initialize($)
"SD_WS_89_TH.*" => { ATTR => "event-min-interval:.*:300 event-on-change-reading:.*", FILTER => "%NAME", GPLOT => "temp4hum4:Temp/Hum,", autocreateThreshold => "3:180"},
"SD_WS_94_T.*" => { ATTR => "event-min-interval:.*:300 event-on-change-reading:.*", FILTER => "%NAME", GPLOT => "temp4:Temp,", autocreateThreshold => "3:180"},
"SD_WS_106_T.*" => { ATTR => "event-min-interval:.*:300 event-on-change-reading:.*", FILTER => "%NAME", GPLOT => "temp4:Temp,", autocreateThreshold => "5:60"},
'SD_WS_110_TR.*' => { ATTR => 'event-min-interval:.*:300 event-on-change-reading:.*', FILTER => '%NAME', GPLOT => 'temp4:Temp,', autocreateThreshold => '3:180'},
};

}
Expand Down Expand Up @@ -139,6 +141,7 @@ sub SD_WS_Parse($$)
my $trend;
my $trendTemp;
my $trendHum;
my $rain;
my $rain_total;
my $rawRainCounter;
my $sendCounter;
Expand Down Expand Up @@ -666,6 +669,57 @@ sub SD_WS_Parse($$)
},
crcok => sub {return 1;}, # CRC test method does not exist
} ,
110 => {
# ADE WS1907 Weather station with rain gauge
# 0 1 2 3 4 5 6 7 8
# 0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64
# 1011 1111 1001 1010 0110 0001 1011 0100 1001 0001 1011 1111 1001 1010 0110 0001 01
# iiii iiii iiii iiii bd?? ccc? rrrr rrrr rrrr rrrr tttt tttt tttt tttt ssss ssss ??
# i: 16 bit ID
# b: 1 bit battery indicator, 0 if battery ok, 1 if battery is low.
# d: 1 bit device reset, set to 1 briefly after battery insert
# c: 3 bit transmission counter, rolls over
# r: 16 bit rain counter (LSB first)
# t: 16 bit temperature (LSB first, unsigned fahrenheit offset by 90 and scaled by 10)
# s: 8 bit checksum over byte 0 - 6 & 0xFF
# ?: unknown
sensortype => 'ADE WS1907',
model => 'SD_WS_110_TR',
prematch => sub {return 1;}, # no precheck known
id => sub {my (undef,$bitData) = @_; return substr($rawData,0,4);}, # long-id in hex
bat => sub {my (undef,$bitData) = @_; return substr($bitData,16,1) eq "0" ? "ok" : "low";},
batChange => sub {my (undef,$bitData) = @_; return substr($bitData,17,1);},
sendCounter => sub {my (undef,$bitData) = @_; return (SD_WS_binaryToNumber($bitData,20,22));},
rawRainCounter => sub {my (undef,$bitData) = @_;
my $rawRainCounterMessage = SD_WS_binaryToNumber($bitData,32,39) * 256 + SD_WS_binaryToNumber($bitData,24,31);
if ($rawRainCounterMessage > 65525) {
return $rawRainCounterMessage - 65526;
} else {
return $rawRainCounterMessage + 10;
}
},
rain => sub {my (undef,$bitData) = @_;
my $rawRainCounterMessage = SD_WS_binaryToNumber($bitData,32,39) * 256 + SD_WS_binaryToNumber($bitData,24,31);
if ($rawRainCounterMessage > 65525) {
return ($rawRainCounterMessage - 65526) * 0.1;
} else {
return ($rawRainCounterMessage + 10) * 0.1;
}
},
temp => sub {my (undef,$bitData) = @_; return round(((SD_WS_binaryToNumber($bitData,48,55) * 256 + SD_WS_binaryToNumber($bitData,40,47)) - 1220) * 5 / 90.0 , 1); },
crcok => sub { my (undef,$bitData) = @_;
my $sum = 0;
for (my $n = 0; $n < 56; $n += 8) {
$sum += SD_WS_binaryToNumber($bitData, $n, $n + 7)
}
if (($sum &= 0xFF) == SD_WS_binaryToNumber($bitData, 56, 63)) {
return 1;
} else {
Log3 $name, 3, "$name: SD_WS_110 Parse msg $msg - ERROR checksum $sum != " . SD_WS_binaryToNumber($bitData, 56, 63);
return 0;
}
},
},
);

Log3 $name, 4, "$name: SD_WS_Parse protocol $protocol, rawData $rawData";
Expand Down Expand Up @@ -983,6 +1037,7 @@ sub SD_WS_Parse($$)
$bat = $decodingSubs{$protocol}{bat}->( $rawData,$bitData ) if (exists($decodingSubs{$protocol}{bat}));
$batChange = $decodingSubs{$protocol}{batChange}->( $rawData,$bitData ) if (exists($decodingSubs{$protocol}{batChange}));
$rawRainCounter = $decodingSubs{$protocol}{rawRainCounter}->( $rawData,$bitData ) if (exists($decodingSubs{$protocol}{rawRainCounter}));
$rain = $decodingSubs{$protocol}{rain}->( $rawData,$bitData ) if (exists($decodingSubs{$protocol}{rain}));
$rain_total = $decodingSubs{$protocol}{rain_total}->( $rawData,$bitData ) if (exists($decodingSubs{$protocol}{rain_total}));
$sendCounter = $decodingSubs{$protocol}{sendCounter}->( $rawData,$bitData ) if (exists($decodingSubs{$protocol}{sendCounter}));
$beep = $decodingSubs{$protocol}{beep}->( $rawData,$bitData ) if (exists($decodingSubs{$protocol}{beep}));
Expand Down Expand Up @@ -1114,8 +1169,13 @@ sub SD_WS_Parse($$)
$state .= "W: $windspeed"
}
if (defined($rain_total)) {
$state .= " " if (length($state) > 0);
$state .= "R: $rain_total"
}
if (defined($rain)) {
$state .= " " if (length($state) > 0);
$state .= "R: $rain"
}
### protocol 33 has different bits per sensor type
if ($protocol eq "33") {
if (AttrVal($name,'model',0) eq "S522") { # Conrad S522
Expand Down Expand Up @@ -1145,6 +1205,7 @@ sub SD_WS_Parse($$)
readingsBulkUpdate($hash, "sendmode", $sendmode) if (defined($sendmode) && length($sendmode) > 0);
readingsBulkUpdate($hash, "type", $SensorTyp, 0) if (defined($SensorTyp));
readingsBulkUpdate($hash, "beep", $beep) if (defined($beep));
readingsBulkUpdate($hash, 'rain', $rain) if (defined($rain));
readingsBulkUpdate($hash, "rawRainCounter", $rawRainCounter) if (defined($rawRainCounter));
readingsBulkUpdate($hash, "rain_total", $rain_total) if (defined($rain_total));
readingsBulkUpdate($hash, "sendCounter", $sendCounter) if (defined($sendCounter));
Expand Down Expand Up @@ -1237,6 +1298,7 @@ sub SD_WS_WH2SHIFT($){
The SD_WS module processes the messages from various environmental sensors received from an IO device (CUL, CUN, SIGNALDuino, SignalESP etc.).<br><br>
<b>Known models:</b>
<ul>
<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 7009994</li>
Expand Down Expand Up @@ -1279,6 +1341,7 @@ sub SD_WS_WH2SHIFT($){
<li>humidity (humidity (1-100 % only if available)</li>
<li>humidityTrend (consistent, rising, falling)</li>
<li>sendmode (automatic or manual)</li>
<li>rain (l/m&sup2;))</li>
<li>rain_total (l/m&sup2;))</li>
<li>state (T: H: W: R:)</li>
<li>temperature (&deg;C)</li>
Expand Down Expand Up @@ -1341,6 +1404,7 @@ sub SD_WS_WH2SHIFT($){
<br>
<b>Unterst&uumltzte Modelle:</b><br><br>
<ul>
<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 7009994</li>
Expand Down Expand Up @@ -1382,6 +1446,7 @@ sub SD_WS_WH2SHIFT($){
<li>channel (Sensor-Kanal)</li>
<li>humidity (Luftfeuchte (1-100 %)</li>
<li>humidityTrend (gleichbleibend, steigend, fallend)</li>
<li>rain (Regenmenge l/m&sup2;))</li>
<li>rain_total (l/m&sup2;))</li>
<li>sendmode (Der Sendemodus, automatic oder manuell mittels Taster am Sender)</li>
<li>state (T: H: W: R:)</li>
Expand Down
27 changes: 25 additions & 2 deletions FHEM/lib/SD_ProtocolData.pm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ package lib::SD_ProtocolData;
use strict;
use warnings;

our $VERSION = '1.28';
our $VERSION = '1.29';

our %protocols = (
"0" => ## various weather sensors (500 | 9100)
Expand Down Expand Up @@ -2833,7 +2833,30 @@ package lib::SD_ProtocolData;
modulematch => '^W106#',
length_min => '22',
length_max => '22',
}
},
"110" => # ADE WS1907 Wetterstation mit Funk-Regenmesser
# https://github.com/RFD-FHEM/RFFHEM/issues/965 docolli 2021-05-14
# T: 16.3 R: 26.6 MU;P0=970;P1=-112;P2=516;P3=-984;P4=2577;P5=-2692;P6=7350;D=01234343450503450503434343434505034343434343434343434343434343434505050503450345034343434343450345050345034505034503456503434505050343434343450503450503434343434505034343434343434343434343434343434505050503450345034343434343450345050345034505034503456503;CP=0;R=12;O;
# T: 12.6 R: 80.8 MU;P0=7344;P1=384;P2=-31380;P3=272;P4=-972;P5=2581;P6=-2689;P7=990;D=12345454545676745676745454545456745454545456767676745454545454545676767456745456767674545454545674567674545456745454545606745456767674545454545676745676745454545456745454545456767676745454545454545676767456745456767674545454545674567674545456745454545606;CP=7;R=19;O;
# T: 11.8 R: 82.1 MU;P0=-5332;P1=6864;P2=-2678;P3=994;P4=-977;P5=2693;D=01234545232323454545454523234523234545454545234545454523452345232345454545454523232345452323454545454545454523452323454545452323454521234545232323454545454523234523234545454545234545454523452345232345454545454523232345452323454545454545454523452323454545;CP=3;R=248;O;
# The sensor sends about every 45 seconds.
{
name => 'ADE_WS_1907',
comment => 'Weather station with rain gauge',
id => '110',
knownFreqs => '433.92',
one => [-3,1], # 2700,-900
zero => [-1,3], # -900,2700
start => [8], # 7200
clockabs => 900,
format => 'twostate',
clientmodule => 'SD_WS',
modulematch => '^W110#',
preamble => 'W110#',
reconstructBit => '1',
length_min => '65',
length_max => '66',
},
########################################################################
#### ### register informations from other hardware protocols #### ####

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Supported Devices / Protocols

|Device | Function|
| ------------- | ----------- |
|ADE WS1907 | Weather station with rain gauge |
|AC114-01B | Remote control |
|BeSmart S4 | Remote control |
|Ambient Weather F007T, F007TP, F007TH | Thermo-Hygrometer, Thermometer |
Expand Down
4 changes: 2 additions & 2 deletions controls_signalduino.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ UPD 2020-10-03_11:48:15 11170 FHEM/14_SD_AS.pm
UPD 2021-03-22_23:45:38 28536 FHEM/14_SD_BELL.pm
UPD 2019-11-16_19:42:18 12593 FHEM/14_SD_RSL.pm
UPD 2021-01-28_20:20:20 163235 FHEM/14_SD_UT.pm
UPD 2020-09-30_22:58:49 70728 FHEM/14_SD_WS.pm
UPD 2021-05-22_21:32:02 74355 FHEM/14_SD_WS.pm
UPD 2020-04-13_23:15:56 18426 FHEM/14_SD_WS07.pm
UPD 2020-04-15_23:37:36 35356 FHEM/14_SD_WS09.pm
UPD 2020-04-13_23:15:56 14325 FHEM/14_SD_WS_Maverick.pm
UPD 2018-07-04_21:56:16 37910 FHEM/41_OREGON.pm
UPD 2020-12-17_23:16:30 15582 FHEM/90_SIGNALduino_un.pm
UPD 2021-04-25_23:13:29 206385 FHEM/lib/SD_ProtocolData.pm
UPD 2021-05-22_21:13:02 208284 FHEM/lib/SD_ProtocolData.pm
UPD 2021-04-25_23:13:29 69564 FHEM/lib/SD_Protocols.pm