Skip to content

Commit

Permalink
whb-type 09 added
Browse files Browse the repository at this point in the history
  • Loading branch information
patrikhall committed Jan 8, 2022
1 parent 547f037 commit 019ca89
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Supported sensors are (see sensors.txt for more details):
- NRZ/17240baud: 30.3143.IT, 30.3144.IT, 30.3147.IT, 30.3157.IT, 30.3159.IT and probably 30.3146.IT
- NRZ/8842baud: Technoline TX22
- NRZS/6000baud: WeatherHub sensors (TFA 30.3303.02, 30.3305.02, 30.3306.02, 30.3307.02 30.3311.02,
MA10410/TFA 35.1147.01, TFA 35.1147.01, 30.3304.02, 30.5043.01
MA10410/TFA 35.1147.01, TFA 35.1147.01, 30.3304.02, 30.5043.01, 30.3302.02
probably others like Technoline Mobile Alerts)

It is likely that the other LaCrosse-based sensors with 9600/17240baud also
Expand Down Expand Up @@ -310,7 +310,7 @@ currently just internally decoded but not used. You can see it with the "-DD" op

There is a "secret" type specific value (CRC init) that can only be safely
calculated with at least 2 *different* raw messages (3 are better). I have
determined it for 8 types (02, 03, 04, 06, 07, 08, 0b, 10, and 11) and also
determined it for 9 types (02, 03, 04, 06, 07, 08, 09, 0b, 10, and 11) and also
implemented the value decoding just for these sensors. For other types
please send me a few (different) raw messages received by the -D option.

Expand Down
1 change: 1 addition & 0 deletions sensors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ X) Probably never supported
30.3060.01 TFA_WHB X +3 4 6Byte X 6000 PSK-NRZM 4b2dd42b ? - WeatherHub station, indoor + 3*outdoor sensors
30.3304.02 TFA_WHB X X X 6Byte X 6000 PSK-NRZM 4b2dd42b ? - WeatherHub temp/humidity + cable temp sensor
30.5043.01 TFA_WHB X - X 6Byte X 6000 PSK-NRZM 4b2dd42b ? - WeatherHub Cosy Radar (3h/24h/7d/24h humidity average)
30.3302.02 TFA_WHB X X X 6Byte X 6000 PSK-NRZM 4b2dd42b 180s ? WeatherHub temp/humidity sensor

Notes:

Expand Down
38 changes: 38 additions & 0 deletions whb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ map<uint32_t, uint32_t> crc_initvals = {
{ 0x06, 0xa7a41254}, // Temp/hum + temp2
{ 0x07, 0x3303fb1d}, // Station MA10410 (TFA 35.1147.01)
{ 0x08, 0x29f0f49b}, // Rain sensor (+ temp)
{ 0x09, 0xa7a41254}, // Pro Temp/hum + temp2
{ 0x0b, 0xe7720ae4}, // Wind sensor
{ 0x10, 0x62d0afc1}, // Door sensor
{ 0x11, 0x8cba0708}, // 4 Thermo-hygro-sensors (TFA 30.3060.01)
Expand Down Expand Up @@ -307,6 +308,40 @@ void whb_decoder::decode_08(uint8_t *msg, uint64_t id, int rssi, int offset)
store_data(sd);
}
//-------------------------------------------------------------------------
// Pro Temp/hum + temp2
void whb_decoder::decode_09(uint8_t *msg, uint64_t id, int rssi, int offset)
{
uint16_t seq=BE16(msg)&0x3fff;;
uint16_t temp=BE16(msg+2)&0x7ff;
uint16_t temp2=BE16(msg+4)&0x7ff;
uint16_t hum=BE16(msg+6)&0xff;

uint16_t temp_prev=BE16(msg+8)&0x7ff;
uint16_t temp2_prev=BE16(msg+10)&0x7ff;
uint16_t hum_prev=BE16(msg+12)&0xff;
if (dbg>=0) {
printf("WHB09 ID %llx TEMP %g HUM %i TEMP2 %g, PTEMP %g PHUM %i PTEMP2 %g\n",
id, cvt_temp(temp),hum,cvt_temp(temp2), cvt_temp(temp_prev), hum_prev, cvt_temp(temp2_prev));
fflush(stdout);
}
sensordata_t sd;
sd.type=type;
sd.id=(id<<4LL);
sd.temp=cvt_temp(temp);
sd.humidity=hum;
sd.sequence=seq;
sd.alarm=0;
sd.rssi=rssi;
sd.flags=0;
sd.ts=time(0);
store_data(sd);

sd.id=(id<<4LL)|1;
sd.temp=cvt_temp(temp2);
sd.humidity=0;
store_data(sd);
}
//-------------------------------------------------------------------------
// Wind sensor
void whb_decoder::decode_0b(uint8_t *msg, uint64_t id, int rssi, int offset)
{
Expand Down Expand Up @@ -507,6 +542,9 @@ void whb_decoder::flush(int rssi, int offset)
case 0x08:
decode_08(msg, id, rssi, offset);
break;
case 0x09:
decode_09(msg, id, rssi, offset);
break;
case 0x0b:
decode_0b(msg, id, rssi, offset);
break;
Expand Down
1 change: 1 addition & 0 deletions whb.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class whb_decoder: public decoder
void decode_06(uint8_t *msg, uint64_t id, int rssi, int offset); // temp/hum + temp (TFA 30.3304.02)
void decode_07(uint8_t *msg, uint64_t id, int rssi, int offset); // Station MA10410 (TFA 35.1147.01)
void decode_08(uint8_t *msg, uint64_t id, int rssi, int offset); // rain
void decode_09(uint8_t *msg, uint64_t id, int rssi, int offset); // pro temp/hum + temp (TFA 30.3302.02)
void decode_0b(uint8_t *msg, uint64_t id, int rssi, int offset); // wind
void decode_10(uint8_t *msg, uint64_t id, int rssi, int offset); // door
void decode_11(uint8_t *msg, uint64_t id, int rssi, int offset); // 4 Thermo-hygro-sensors (TFA 30.3060.01)
Expand Down

0 comments on commit 019ca89

Please sign in to comment.