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 111 for TS-FT002 water tank level monitor with temperature #1000

Merged
merged 12 commits into from
Aug 5, 2021
72 changes: 18 additions & 54 deletions CHANGED
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
2021-08-04 - AVANTEK - Fix (#999)

2021-08-04 - AVANTEK - Fix (#999)
* Update 00_SIGNALduino.pm

* fix matchListSIGNALduino for AVANTEK (protocol 112 forget)
2021-08-02 - xFSK - cc110x commands & commandref (#990)

2021-08-02 - xFSK - cc110x commands & commandref (#990)
* Update 00_SIGNALduino.pm
* sort cc1101 sets alphabetical
* revised hardtabs for Perl::Critic
Expand All @@ -13,100 +12,72 @@
* revised output DataRate to kBaud
* revised spelling mistake Bandwidth kHz
* revised commandref

* Update 02_SIGNALduino_CheckccConfResponse.t
* revised test with new data

* t/FHEM/cc1101/01_func.t
* Basis Testgerüst für package cc1101 erstellt

* Unittest auf cc1101 erweitert

* Update 01_func.t
* revised PERL::Critic
* added CalcDataRate notes

* Corrected unittest

* 00_SIGNALduino.pm
* removed unneeded codepath

* 01_func.t
* tried to add test CalcbWidthReg

* Update 01_func.t
* correction tests for comparison of all contents

* Update 01_func.t
* revised test https://github.com/RFD-FHEM/RFFHEM/pull/990/files/436ca626de1bcd8c76e1111f97235c7dfa259fe9#r681258066

* Update 01_func.t
* revised test https://github.com/RFD-FHEM/RFFHEM/pull/990#pullrequestreview-720601023

2021-08-02 - Merge branch 'master' into master_cc110x_commands
2021-08-02 - Repair check results (#997)

2021-08-02 - Repair check results (#997)
* Update update.yml

- skip steps instead of complete job
- add job dependency

* PULL_REQUEST_TEMPLATE.md

- spell fix


2021-08-01 - Bresser 5in1 2 - Rename readings windDirection, windDirectionText, windGust and windSpeed (#995)

* Renaming Readings wind. *

14_SD_WS.pm - Rename readings windDirection, windDirectionText, windGust and windSpeed
SD_ProtocolData.pm - change register 0x03, Design Note DN009 - FIFOTHR.ADC_RETENTION - CC1101 will wake up with optimal ADC settings for low data rate (≤ 100 kbps)
14_SD_WS.pm - Rename readings windDirection, windDirectionText, windGust and windSpeed
SD_ProtocolData.pm - change register 0x03, Design Note DN009 - FIFOTHR.ADC_RETENTION - CC1101 will wake up with optimal ADC settings for low data rate (≤ 100 kbps)

2021-07-29 - Update update.yml

- Use Admin pat, to allow passing branch protection rules

2021-07-13 - AVANTEK - small fix send data (#991)

* Update 14_SD_BELL.pm

* fix AVANTEK (RX FIFO)

2021-07-10 - Fixes CPU and MEM usage patternExists (#988)

* 00_SIGNALduino.pm

SIGNALduino_PatternExists überarbeitet um hohe CPU Last und Speicherverbrauch zu umgehen
Fixes High memory and CPU usage in SIGNALduino_PatternExists #986

2021-07-09 - Merge branch 'master' into sidey79/issue986
2021-07-09 - added AVANTEK Wireless doorbell & LED night light (#981)

2021-07-09 - added AVANTEK Wireless doorbell & LED night light (#981)
* Update SD_ProtocolData.pm

* added AVANTEK DB-LE
* Register optimized
* revised comments
* optimized parameters

* Update README.md

* Update 00_SIGNALduino.pm
* added AVANTEK rfmode

* Update 14_SD_BELL.pm

* https://github.com/RFD-FHEM/RFFHEM/pull/981#discussion_r658270036 changed line
* added AVANTEK
* revised send cmd AVANTEK protocol
* added commandref

* Update 00_SIGNALduino.pm

* revised cmd sendMsg for xFSK

* Update 01_SIGNALduino_Set_sendMsg.t

* revised test sendMsg & added data to test

2021-06-30 - added AVANTEK protocol
* 14_SD_BELL.pm
* revised send cmd AVANTEK protocol
Expand All @@ -119,7 +90,6 @@ Fixes High memory and CPU usage in SIGNALduino_PatternExists #986
* fix Log3 output

2021-06-20 - little fix - attr whitelist_IDs (#983)

* SD_ProtocolData.pm
* added AVANTEK DB-LE & register optimized
* 14_SD_BELL.pm
Expand All @@ -128,51 +98,44 @@ Fixes High memory and CPU usage in SIGNALduino_PatternExists #986
- added AVANTEK rfmode

2021-06-20 - Update 00_SIGNALduino.pm

* revised save option whitelist_IDs (user see now ? on Save config)

2021-06-07 - Fix Multiple Send delay (#941)

* Multiple set commands are not processed
Fixes #823 for firmware 3.4.0 without delay

2021-06-07 - 00_SIGNALduino.pm

Version updated to current date
2021-06-07 - Update doc - SD_ProtocolData.pm (#975)

2021-06-07 - Update doc - SD_ProtocolData.pm (#975)
* Update SD_ProtocolData.pm

* added doc Normstahl Garage DOORS

2021-06-04 - Update SD_ProtocolData.pm

2021-06-04 - some PerlCritic points - Update 14_SD_WS.pm (#976)

* Update 14_SD_WS.pm

- revised hardTabs PerlCritic points & indentations
2021-06-03 - Update 14_SD_WS.pm

2021-06-03 - Update 14_SD_WS.pm
- revised hardTabs PerlCritic points & indentations
2021-06-02 - Hideki fix inverted message (#974)

2021-06-02 - Hideki fix inverted message (#974)
* Update SD_Protocols.pm

* added doc Normstahl Garage DOORS

2021-06-02 - Hideki fix inverted message (#974)
* Update SD_Protocols.pm
- fix https://github.com/RFD-FHEM/RFFHEM/issues/944

* 02_mcBit2Hideki.t

- added test with inverted bitmessage
- test für spezielle Bitlänge 89 erstellt
- provide number of bits for test
2021-05-31 - Update SD_Protocols.pm

2021-05-31 - Update SD_Protocols.pm
* fix https://github.com/RFD-FHEM/RFFHEM/issues/944
2021-05-28 - new protocol 108 for BRESSER 5-in-1 Weather Center, Bresser Professional Rain Gauge (#973)

2021-05-28 - new protocol 108 for BRESSER 5-in-1 Weather Center, Bresser Professional Rain Gauge (#973)
* Update 14_SD_WS.pm
* Update README.md
* Update SD_ProtocolData.pm
Expand All @@ -182,11 +145,12 @@ not all tests are finished, need some more testdata
- Fehlermeldung von bitsum auf checksum geändert
- Prüfung auf Mindestlänge um Perl Warnings zu vermeiden
- Berechnung der checksumme vereinfacht
2021-05-27 - SD_Protocols.pm

2021-05-27 - SD_Protocols.pm
- Fehlermeldung von bitsum auf checksum geändert
- Prüfung auf Mindestlänge um Perl Warnings zu vermeiden
- Berechnung der checksumme vereinfacht

2021-05-27 - new protocol 108 for BRESSER 5-in-1 Weather Center and BRESSER Professional Rain Gauge

2021-05-26 - PERL WARNING - Kopp Fix - https://github.com/RFD-FHEM/RFFHEM/issues/968 (#972)
Expand Down
63 changes: 55 additions & 8 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-07-29 20:39:27Z elektron-bbs $
# $Id: 14_SD_WS.pm 21666 2021-08-05 19:43:29Z elektron-bbs $
#
# The purpose of this module is to support serval
# weather sensors which use various protocol
Expand Down Expand Up @@ -32,15 +32,14 @@
# 01.05.2021 neues Protokoll 108: Bresser 5-in-1 Comfort Wetter Center, Profi Regenmesser
# 15.05.2021 neues Protokoll 110: ADE WS1907 Weather station with rain gauge
# 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

package main;

#use version 0.77; our $VERSION = version->declare('v3.4.3');

use strict;
use warnings;
# use Digest::CRC qw(crc);
# use Data::Dumper;

# Forward declarations
sub SD_WS_LFSR_digest8_reflect($$$$);
Expand Down Expand Up @@ -85,6 +84,7 @@ sub SD_WS_Initialize($)
"SD_WS_94_T.*" => { ATTR => "event-min-interval:.*:300 event-on-change-reading:.*", FILTER => "%NAME", GPLOT => "temp4:Temp,", autocreateThreshold => "3:180"},
'SD_WS_108.*' => { ATTR => 'event-min-interval:.*:300 event-on-change-reading:.*', FILTER => '%NAME', GPLOT => 'temp4:Temp,', autocreateThreshold => '5:120'},
'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'},
};

}
Expand Down Expand Up @@ -117,12 +117,10 @@ sub SD_WS_Undef($$)
return undef;
}


#############################
sub SD_WS_Parse($$)
{
my ($iohash, $msg) = @_;
#my $rawData = substr($msg, 2);
my $name = $iohash->{NAME};
my $ioname = $iohash->{NAME};
my ($protocol,$rawData) = split("#",$msg);
Expand Down Expand Up @@ -155,6 +153,7 @@ sub SD_WS_Parse($$)
my $rawRainCounter;
my $sendCounter;
my $beep;
my $distance;

my %decodingSubs = (
50 => # Protocol 50
Expand Down Expand Up @@ -818,6 +817,47 @@ sub SD_WS_Parse($$)
}
},
},
111 => {
# TS-FT002 Water tank level monitor with temperature
# 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 68 - 0 2 4 6 8 10 12 14 16
# 0101 1111 0101 1011 1000 1000 0110 0000 1111 0001 0001 0000 1100 0100 0000 0000 1100 1001 - 5F 5B 88 60 F1 10 C4 00 C9
# cccc cccc iiii iiii yyyy yyyy dddd dddd dddd bbbb tttt vvvv tttt tttt rrrr rrrr xxxx xxxx
# c: 8 bit sync, always 0x5F
# i: 8 bit ID
# y: 8 bit type, always 0x88
# d: 12 bit distance, med, migh, low (value in hex = cm, fill with 5DC on invalid, range 0 - 15 m)
# b: 4 bit battery indicator, (1 = OK, any other value = low) - Not available with TS-FT002!
# v: 4 bit interval (bit 3 = 0 180 s, bit 3 = 1 30 s, bit 0-2 = 1 5 s) - Not available with TS-FT002!
# t: 12 bit temperature (offset by 400 and scaled by 10)
# r: 8 bit rain (not used in XC-0331 and TS-FT002)
# x: 8 bit XOR of values from bytes 0 to 8 = 0
# all nibbles reversed, lsb first
sensortype => 'TS-FT002',
model => 'SD_WS_111_TL',
prematch => sub {my $rawData = shift; return 1 if ($rawData =~ /^5F[0-9A-F]{2}88[0-9A-F]{12}/); }, # 5F 01 88 012345678912
id => sub {my ($rawData,undef) = @_; return substr($rawData,2,2);}, # long-id in hex
distance => sub {my (undef,$bitData) = @_; return (SD_WS_bin2dec(reverse(substr($bitData,24,4))) * 16 + SD_WS_bin2dec(reverse(substr($bitData,28,4))) * 256 + SD_WS_bin2dec(reverse(substr($bitData,32,4))));},
# bat => sub {my (undef,$bitData) = @_; return substr($bitData,36,4) eq '0001' ? "ok" : "low";},
# interval => sub {my (undef,$bitData) = @_; return '180' if substr($bitData,44,4) eq '0000';
# return '30' if substr($bitData,44,4) eq '1000';
# return '5' if substr($bitData,44,4) eq '0111';
# return '0';
# },
temp => sub {my (undef,$bitData) = @_; return ((SD_WS_bin2dec(reverse(substr($bitData,48,4))) * 16 + SD_WS_bin2dec(reverse(substr($bitData,52,4))) * 256 + SD_WS_bin2dec(reverse(substr($bitData,40,4))) - 400 ) / 10);},
crcok => sub { my (undef,$bitData) = @_;
my $xor = SD_WS_binaryToNumber($bitData, 0, 7);
for (my $n = 8; $n < 72; $n += 8) {
$xor ^= SD_WS_binaryToNumber($bitData, $n, $n + 7);
}
if ($xor == 0) {
return 1;
} else {
Log3 $name, 3, "$name: SD_WS_111 Parse msg $msg - ERROR check $xor != 0";
return 0;
}
},
},
);

Log3 $name, 4, "$name: SD_WS_Parse protocol $protocol, rawData $rawData";
Expand Down Expand Up @@ -1142,13 +1182,12 @@ sub SD_WS_Parse($$)
$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}));

if ($model eq "SD_WS_33_T" || $model eq "SD_WS_58_T") { # for SD_WS_33 or SD_WS_58 discrimination T - TH
$model = $decodingSubs{$protocol}{model}."H" if $hum != 0; # for models with Humidity
}
$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}));
Log3 $iohash, 4, "$name: SD_WS_Parse decoded protocol-id $protocol ($SensorTyp), sensor-id $id";
}
else {
Expand Down Expand Up @@ -1176,7 +1215,6 @@ sub SD_WS_Parse($$)
$deviceCode = $model; # for sensors without channel
$deviceCode .= '_' . $channel if (defined $channel);
}
#print Dumper($modules{SD_WS}{defptr});

my $def = $modules{SD_WS}{defptr}{$deviceCode};
$def = $modules{SD_WS}{defptr}{$deviceCode} if(!$def);
Expand Down Expand Up @@ -1278,6 +1316,10 @@ sub SD_WS_Parse($$)
$state .= " " if (length($state) > 0);
$state .= "R: $rain"
}
if (defined($distance)) {
$state .= " " if (length($state) > 0);
$state .= "D: $distance"
}
### 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 @@ -1314,6 +1356,7 @@ sub SD_WS_Parse($$)
readingsBulkUpdate($hash, "rawRainCounter", $rawRainCounter) if (defined($rawRainCounter));
readingsBulkUpdate($hash, "rain_total", $rain_total) if (defined($rain_total));
readingsBulkUpdate($hash, "sendCounter", $sendCounter) if (defined($sendCounter));
readingsBulkUpdate($hash, "distance", $distance) if (defined($distance));
readingsEndUpdate($hash, 1); # Notify is done by Dispatch

return $name;
Expand Down Expand Up @@ -1419,6 +1462,7 @@ sub SD_WS_WH2SHIFT($){
<li>TECVANCE TV-4848</li>
<li>Thermometer TFA 30.3228.02, TFA 30.3229.02, FT007T, FT007TP, F007T, F007TP</li>
<li>Thermo-Hygrometer TFA 30.3208.02, FT007TH, F007TH</li>
<li>TS-FT002 Water tank level monitor with temperature</li>
<li>TX-EZ6 for Weatherstation TZS First Austria</li>
<li>WH2 (TFA Dostmann/Wertheim 30.3157 (sold in Germany), Agimex Rosenborg 66796 (sold in Denmark),ClimeMET CM9088 (Sold in UK)</li>
<li>Weatherstation Auriol IAN 283582 Version 06/2017 (Lidl), Modell-Nr.: HG02832D</li>
Expand Down Expand Up @@ -1451,6 +1495,7 @@ sub SD_WS_WH2SHIFT($){
<li>batteryChanged (1)</li>
<li>batteryState (low or ok)</li>
<li>channel (number of channel</li>
<li>distance (distance in cm)</li>
<li>humidity (humidity (1-100 % only if available)</li>
<li>humidityTrend (consistent, rising, falling)</li>
<li>sendmode (automatic or manual)</li>
Expand Down Expand Up @@ -1535,6 +1580,7 @@ sub SD_WS_WH2SHIFT($){
<li>TECVANCE TV-4848</li>
<li>Temperatur-Sensor TFA 30.3228.02, TFA 30.3229.02, FT007T, FT007TP, F007T, F007TP</li>
<li>Temperatur/Feuchte-Sensor TFA 30.3208.02, FT007TH, F007TH</li>
<li>TS-FT002 Wassertank Füllstandswächter mit Temperatur</li>
<li>TX-EZ6 fuer Wetterstation TZS First Austria</li>
<li>WH2 (TFA Dostmann/Wertheim 30.3157 (Deutschland), Agimex Rosenborg 66796 (Denmark), ClimeMET CM9088 (UK)</li>
<li>Wetterstation Auriol IAN 283582 Version 06/2017 (Lidl), Modell-Nr.: HG02832D</li>
Expand Down Expand Up @@ -1568,6 +1614,7 @@ sub SD_WS_WH2SHIFT($){
<li>batteryChanged (1)</li>
<li>batteryState (low oder ok)</li>
<li>channel (Sensor-Kanal)</li>
<li>distance (Entfernung in cm)</li>
<li>humidity (Luftfeuchte, 1-100 %)</li>
<li>humidityTrend (Trend Luftfeuchte, gleichbleibend, steigend, fallend)</li>
<li>rain (Regenmenge l/m&sup2;))</li>
Expand Down
Loading