RTL 433 - Celsius instead of Fahrenheit

1,350 views
Skip to first unread message

bdf0506

unread,
May 31, 2018, 9:26:02 PM5/31/18
to weewx-user
I am trying to setup the RTL-SDR driver with WeeWx. I'm able to run the raw rtl433 program, and notice that one sensor is showing temperature in Celsius, and another is in Fahrenheit. Is there any way to convert the Celsius one into Fahrenheit before it gets inserted into the database? Or do I have to somehow let WeeWx deal with this on the web front end after it is inserted into the database?

Output is below.


[root@server02 ~]$ rtl_433 -U -F json -R40
Registering protocol [1] "Acurite 592TXR Temp/Humidity, 5n1 Weather Station, 6045 Lightning"
Registered 1 out of 102 device decoding protocols
Found 1 device(s)


trying device
0: Realtek, RTL2838UHIDIR, SN: 00000001
Found Rafael Micro R820T tuner
Using device 0: Generic RTL2832U OEM
Exact sample rate is: 250000.000414 Hz
[R82XX] PLL not locked!
Sample rate set to 250000.
Bit detection level set to 0 (Auto).
Tuner gain set to Auto.
Reading samples in async mode...
Tuned to 433920000 Hz.
{"time" : "2018-06-01 01:18:58", "model" : "Acurite 5n1 sensor", "sensor_id" : 3420, "channel" : "A", "sequence_num" : 0, "battery" : "OK", "message_type" : 56, "wind_speed_mph" : 0.000, "temperature_F" : 76.500, "humidity" : 85}
{"time" : "2018-06-01 01:18:58", "model" : "Acurite 5n1 sensor", "sensor_id" : 3420, "channel" : "A", "sequence_num" : 1, "battery" : "OK", "message_type" : 56, "wind_speed_mph" : 0.000, "temperature_F" : 76.500, "humidity" : 85}
{"time" : "2018-06-01 01:18:58", "model" : "Acurite 5n1 sensor", "sensor_id" : 3420, "channel" : "A", "sequence_num" : 2, "battery" : "OK", "message_type" : 56, "wind_speed_mph" : 0.000, "temperature_F" : 76.500, "humidity" : 85}
{"time" : "2018-06-01 01:19:03", "model" : "Acurite tower sensor", "id" : 4909, "sensor_id" : 4909, "channel" : "B", "temperature_C" : 19.100, "humidity" : 51, "battery_low" : 0}
{"time" : "2018-06-01 01:19:03", "model" : "Acurite tower sensor", "id" : 4909, "sensor_id" : 4909, "channel" : "B", "temperature_C" : 19.100, "humidity" : 51, "battery_low" : 0}
{"time" : "2018-06-01 01:19:03", "model" : "Acurite tower sensor", "id" : 4909, "sensor_id" : 4909, "channel" : "B", "temperature_C" : 19.100, "humidity" : 51, "battery_low" : 0}

Greg Troxel

unread,
Jun 1, 2018, 6:54:15 AM6/1/18
to bdf0506, weewx-user

bdf0506 <bdfu...@gmail.com> writes:

> I am trying to setup the RTL-SDR driver with WeeWx. I'm able to run the raw
> rtl433 program, and notice that one sensor is showing temperature in
> Celsius, and another is in Fahrenheit. Is there any way to convert the
> Celsius one into Fahrenheit before it gets inserted into the database? Or
> do I have to somehow let WeeWx deal with this on the web front end after it
> is inserted into the database?

Amusingly, I just one each of the same sensors, but have not setup the
weewx injector yet.

rtl_sdr has three units options:

[-C] native|si|customary Convert units in decoded output.

If the weewx injector doesn't convert, it seems best to choose si or
customary to match your database's native units.

But, I would expect the weewx rtl ingestor documentation to have advice
about this.
signature.asc

bdf0506

unread,
Jun 2, 2018, 12:31:20 PM6/2/18
to weewx-user
Thanks Greg! I didn't even see that option in the config, must have looked right over it.

This below syntax works to get all temps to display in Fahrenheit.

[root@server02: ~]$ rtl_433 -q -U -C customary -R40 -F json         
Detached kernel driver
Found Rafael Micro R820T tuner
Exact sample rate is: 250000.000414 Hz
[R82XX] PLL not locked!
Sample rate set to 250000.
Bit detection level set to 0 (Auto).
Tuner gain set to Auto.
Tuned to 433920000 Hz.
{"time" : "2018-06-02 16:28:07", "model" : "Acurite tower sensor", "id" : 2867, "sensor_id" : 2867, "channel" : "A", "temperature_F" : 71.240, "humidity" : 52, "battery_low" : 0}
{"time" : "2018-06-02 16:28:07", "model" : "Acurite tower sensor", "id" : 2867, "sensor_id" : 2867, "channel" : "A", "temperature_F" : 71.240, "humidity" : 52, "battery_low" : 0}
{"time" : "2018-06-02 16:28:07", "model" : "Acurite tower sensor", "id" : 2867, "sensor_id" : 2867, "channel" : "A", "temperature_F" : 71.240, "humidity" : 52, "battery_low" : 0}
{"time" : "2018-06-02 16:28:21", "model" : "Acurite 5n1 sensor", "sensor_id" : 3420, "channel" : "A", "sequence_num" : 0, "battery" : "OK", "message_type" : 56, "wind_speed_mph" : 0.000, "temperature_F" : 78.300, "humidity" : 95}
{"time" : "2018-06-02 16:28:21", "model" : "Acurite 5n1 sensor", "sensor_id" : 3420, "channel" : "A", "sequence_num" : 1, "battery" : "OK", "message_type" : 56, "wind_speed_mph" : 0.000, "temperature_F" : 78.300, "humidity" : 95}
{"time" : "2018-06-02 16:28:21", "model" : "Acurite 5n1 sensor", "sensor_id" : 3420, "channel" : "A", "sequence_num" : 2, "battery" : "OK", "message_type" : 56, "wind_speed_mph" : 0.000, "temperature_F" : 78.300, "humidity" : 95}


bdf0506

unread,
Jun 2, 2018, 2:37:57 PM6/2/18
to weewx-user
Turns out this was excessive. While you can use that option in the rtl_433 options, WeeWx doesn't want you to.

When i told it to get F instead of C, the program couldn't find the temperatures, based on the parsing in perl. I edited the sdr.py script and changed a line below, that way it could parse this correctly.
pkt['temperature'] = Packet.get_float(obj, 'temperature_C')
to
pkt['temperature'] = Packet.get_float(obj, 'temperature_F')

All seemed well in the world since it was now printing out temps in F as I went to see what my sensors were so that I can map them properly

However.... when I told weewx.conf to use the -C customary option it did. But then as it inserted it into the database, it was assuming it was getting a temperature in C, and converted it to F. So essentially, my temps were way too high, due to converting an already F temp to a F temp, and they were so high that they were outside the bounds defined in the configs and it failed.

So after all, you want to keep the default of C and let it do its thing... it will convert it just fine to F by the time it makes it to the database!

mwall

unread,
Jun 4, 2018, 10:12:19 AM6/4/18
to weewx-user
the sdr driver could be more robust.  it would be nice to handle either imperial or metric for any type of sensor.  on the other hand, it would be nice if the rtl_433 modules would be consistent about their output, or at least versioned so that the sdr driver can know what format/units to expect.

as long as you feed it a format/units that it knows, the sdr driver will take care of the unit conversions automatically using the weewx plumbing.

merge requests are welcome


Greg from Oz

unread,
Jun 4, 2018, 8:13:19 PM6/4/18
to weewx-user
If the whole world went to Celsius it would be easier :-) no more conversions........
Reply all
Reply to author
Forward
0 new messages