jaycedowell / rtl_osv21

RTL SDR software for reading Oregon Scientific v2.1 sensors
GNU General Public License v2.0
5 stars 6 forks source link

thn132N & BTHGN 129 intergration #2

Closed deennoo closed 9 years ago

deennoo commented 9 years ago

Hello,

i got to new sensor THN132N (indoor temp) & BTHGN129 (outdoor temp hum and bar).

I succefully had them to RTL_433 using :

For BTHGN129 (Sensor Id 5D53, 185 Bit Message lenght)

} else if (sensor_id == 0x5d53) { if (validate_os_v2_message(msg, 185, num_valid_v2_bits, 19) == 0) { unsigned int comfort = msg[7] >>4; char _comfort_str="Normal"; if (comfort == 4) comfort_str = "Comfortable"; else if (comfort == 8) comfort_str = "Dry"; else if (comfort == 0xc) comfort_str = "Humid"; unsigned int forecast = msg[9]>>4; char *forecast_str="Cloudy"; if (forecast == 3) forecast_str = "Rainy"; else if (forecast == 6) forecast_str = "Partly Cloudy"; else if (forecast == 0xc) forecast_str = "Sunny"; float temp_c = get_os_temperature(msg, 0x5d53); fprintf(stderr,"Weather Sensor BTHGN 129 Temp: %3.1f°C %3.1f°F Humidity: %d%%", temp_c, ((temp_c_9)/5)+32, get_os_humidity(msg, 0x5d53));
fprintf(stderr, " (%s) Pressure: %dmbar (%s)\n", comfort_str, ((msg[7] & 0x0f) | (msg[8] & 0xf0))+856, forecast_str);
}

Copying BHTR968 code and just update the sensor id

and

For THN132N (sensor id: ec40)

return 1; } else if (sensor_id == 0xec40 && num_valid_v2_bits==153) { if ( validate_os_v2_message(msg, 153, num_valid_v2_bits, 12) == 0) { int channel = ((msg[2] >> 4)&0x0f); if (channel == 4) channel = 3; // sensor 3 channel number is 0x04 float temp_c = get_os_temperature(msg, sensor_id); if (sensor_id == 0xec40) fprintf(stderr, "Thermo Sensor THR228N Channel %d ", channel); fprintf(stderr, "Temp: %3.1f°C %3.1f°F\n", temp_c, ((temp_c_9)/5)+32); } return 1; } else if (sensor_id == 0xec40 && num_valid_v2_bits==129) { if ( validate_os_v2_message(msg, 129, num_valid_v2_bits, 12) == 0) { int channel = ((msg[2] >> 4)&0x0f); if (channel == 4) channel = 3; // sensor 3 channel number is 0x04 int battery_low = (msg[3] >> 2 & 0x01);
unsigned char rolling_code = ((msg[2] << 4)&0xF0) | ((msg[3] >> 4)&0x0F); float temp_c = get_os_temperature(msg, sensor_id); if (sensor_id == 0xec40) fprintf(stderr, "Thermo Sensor THN132N, Channel %d, Battery: %s, Rolling-code 0x%0X, ", channel, battery_low?"Low":"Ok", rolling_code); fprintf(stderr, "Temp: %3.1f°C %3.1f°F\n", temp_c, ((temp_c_9)/5)+32); }

I try to Introduce them using your format by modifing parser.py by adding Sensor Id & Sensors name but this is a epic fail from me.

For BTHGN 129 Only Barometre is send to WU Personnal Weather Station. (no temp and no Humidity) nothing for THN132N.

Do you have some trick ?

jaycedowell commented 9 years ago

In order to deal with different sensors that can report the same type of measurement the parser.parseBitStream() function uses a basic "order of preference" hierarchy (lines 352 to 369). You may need to tweak this order to get the values from the TBN132N into the "output" dictionary that is used to update WU.

deennoo commented 9 years ago

THN132n is inside i don't want to post it on my PSW.

I want to use my bthgn129 value who give me (temp, hum and pressure)

deennoo commented 9 years ago

Got a probleme by decoding my BTHGN129:

what i got from terminal :

Found 1 device(s): 0: Generic, RTL2832U, SN: 77771111153705700

Using device 0: Generic RTL2832U Found Rafael Micro R820T tuner Exact sample rate is: 1000000.026491 Hz

User cancel, exiting... 2071.15272999 2071.15971994 67511.1597891 WUnderground PWS update status: success

is those value are the one transmit to PWS ? if yes that explain why value are false on my page.

Can you help ?

deennoo commented 9 years ago

ok all done ! barometric adjustement to provid for BTHGN129,

how do you want to recieve the information for this sensor (to adjust your code)

jaycedowell commented 9 years ago

The easier thing is probably to make the changes in your fork and then to send in a pull request.