Field mapping - Is there a list/description?

160 views
Skip to first unread message

jmc...@gmail.com

unread,
Jan 12, 2021, 4:50:23 PM1/12/21
to weewx-user
Is there any list of fields and what it means in docs?

I have some fields in my station but I'm not sure which field should be mapped to which field in DB.

rain_mm => Currently mapped to 'rain'
temperature_C => outTemp
humidity => outHumidity

wind_avg_km_h => not mapped, I'm not sure which is the correct field in DB
wind_max_km_h => not mapped, I'm not sure which is the correct field in DB
wind_dir_deg => not mapped, I'm not sure which is the correct field in DB


I'm not an expert, so I don't have idea if I should use wind_avg_km_h for windSpeed, for example.

I'm sorry if it's a dumb question.

jmc...@gmail.com

unread,
Jan 12, 2021, 5:11:10 PM1/12/21
to weewx-user

Also, a second question:

My station is reporting "0.6" in "rain_mm" field. It's a very light rain now. I'm not sure if this is for the last hour or last 15 minutes.
The thing is that database is clean and in report generate, this is what i'm getting for rain:

Rain Rate 88.8 mm/h
Rain Today 36.0 mm


What am I missing?

My units are set (globally in weewx.config) to METRIC.

jmc...@gmail.com

unread,
Jan 12, 2021, 5:38:35 PM1/12/21
to weewx-user
changed rain_mm from 'rain' to 'rainRate' and it's better....it's showing 1.2mm/h when my station is reporting 0.6....still twice the value.
I also added 'mm_per_hour' in my driver config for rain, but still twice. I'm not sure what's wrong. 

Tom Keffer

unread,
Jan 12, 2021, 5:41:32 PM1/12/21
to weewx-user
There is no master list of all the database variables.

However, there are some comments about rain in the section Porting to new hardware of the Customizing Guide. In particular, the field 'rain' should be the amount of rain that fell during the period. That is, if it's LOOP packets, it's the amount of rain that fell since the last LOOP packet, not, for example, the amount of rain for the day.

I suspect your field rain_mm is the amount of rain that has fallen since midnight. As explained in the porting guide, you'll have to take deltas of that field to get the field rain.

So, to answer your questions:

rain_mm => If this is rain since midnight, it should be mapped to dayRain, which is not in the standard database schema, but is used by some uploaders. 
temperature_C => outTemp. Correct. 
humidity => outHumidity. Correct.

wind_avg_km_h => There is no field for averages. It's calculated by WeeWX when needed.
wind_max_km_h => Field windGust
wind_dir_deg => Field windDir

Please read the porting guide. Make sure your driver emits packets using a consistent unit system. The unit system used by the database doesn't matter. Incoming data will be converted automatically.

-tk



--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/ad3fe2f1-b6a6-4fc3-a2ce-23389815d8a0n%40googlegroups.com.

jmc...@gmail.com

unread,
Jan 12, 2021, 6:03:09 PM1/12/21
to weewx-user
I don't think its based on daily rain. Why? Because it's a very simple station and i'm pretty sure it doesn't have internal clock. I don't have any way to set the clock in station....so how would it calculate midnight?!


I have a rain bucket attached to it.
To get data, I'm using rtl_433 to 'capture' the wireless data, generate a JSON and send to my MQTT server. In Weewx, i'm using WeeWX-MQTTSubscribe to get the data from MQTT server.
Everything is working fine now, except for the rain, which still twice the reported value.

Tom Keffer

unread,
Jan 12, 2021, 7:48:05 PM1/12/21
to weewx-user
Things to think about:

Makes sense that the lack of a clock would imply something else. But, what is it? Take a measured amount of water and pour it into the rain bucket. What do you see in the captured data?

Perhaps you have a unit conversion problem? The packet can use US, METRIC, or METRICWX unit systems (see the Appendix Units in the Customizing Guide for definitions), but whichever one you choose, all the data in the packet must conform to the chosen system.

You definitely do not want to set rainRate. It is typically a derived value, calculated by weewx from the stream of loop data. A few weather stations can calculate it themselves, but I'd be surprised if yours is one of them.

Finally, unless you have other reasons for wanting to use MQTT as an intermediary, there is a rtl-433 driver available for WeeWX. You could simplify your system by going directly from sensor to database by using it.


Jonis Maurin Ceará

unread,
Jan 13, 2021, 6:53:11 AM1/13/21
to weewx...@googlegroups.com
Hi Tom!

Tks for your answer.

Makes sense that the lack of a clock would imply something else. But, what is it? Take a measured amount of water and pour it into the rain bucket. What do you see in the captured data?
Well, I think the value is cummulative, but not for the last 24h, it's forever (until reboots). At least it's what I'm seeing now. I'm monitoring my MQTT and about 23h the sensor was reporting 2.1. Rain stopped (until now, 08h35) and the sensor is still reporting 2.1 . I'll wait until 23h to see if it will 'zero' the value after 24h. The station doesn't have a clock, but it can 'count'....so reset after X hours is possible even without a clock.

Perhaps you have a unit conversion problem? The packet can use US, METRIC, or METRICWX unit systems (see the Appendix Units in the Customizing Guide for definitions), but whichever one you choose, all the data in the packet must conform to the chosen system.
My sensor reports in mm, and I think it's correct.....the sensor name irself is called 'rain_mm'. Since I'm using  MQTTSubscribeDriver driver, I have this set in driver section:
[[topics]]
        unit_system = METRIC
        use_topic_as_fieldname = true
        use_server_datetime = True

Them, my StdReports are set for METRIC too:
[[Defaults]]
        [[[Units]]]
            # The following section sets what unit to use for each unit group.
            # NB: The unit is always in the singular. I.e., 'mile_per_hour',
            # NOT 'miles_per_hour'
            [[[[Groups]]]]
                group_altitude = meter    # Options are 'foot' or 'meter'
                group_degree_day = degree_C_day    # Options are 'degree_F_day' or 'degree_C_day'
                group_distance = km    # Options are 'mile' or 'km'
                group_pressure = mbar    # Options are 'inHg', 'mmHg', 'mbar', 'hPa', or 'kPa'
                group_rain = mm    # Options are 'inch', 'cm', or 'mm'
                group_rainrate = mm_per_hour    # Options are 'inch_per_hour', 'cm_per_hour', or 'mm_per_hour'
                group_speed = km_per_hour    # Options are 'mile_per_hour', 'km_per_hour', 'knot', or 'meter_per_second'
                group_speed2 = km_per_hour2    # Options are 'mile_per_hour2', 'km_per_hour2', 'knot2', or 'meter_per_second2'
                group_temperature = degree_C    # O


And in the StdConvert section, I left as 'US'. Should I change it to METRIC too?? It's a brand new database, not merging new/old data.


You definitely do not want to set rainRate. It is typically a derived value, calculated by weewx from the stream of loop data. A few weather stations can calculate it themselves, but I'd be surprised if yours is one of them.
Maybe this is my mistake. I'm using rainRate for my rain_mm value. But when I tried just 'rain', the values went totally crazy. I mean, 0.6 in sensor was displaying about  88mm rainRate and 36mm total rain. There is an option in the driver called 'contains_total'. I'm almost sure that my sensor reports only totals (see my last answer in this e-mail), but I'll make sure after 23h today. If this is the case, in which field should I use this driver option, 'rain' or 'rainRate'?
This is the description of this option:

contains_total:
Set to true if the incoming data is cumulative value (for example, rain total) and the WeeWX field expects an increment value.. The default is false




Finally, unless you have other reasons for wanting to use MQTT as an intermediary, there is a rtl-433 driver available for WeeWX. You could simplify your system by going directly from sensor to database by using it.
Well, here is why I'm not using rtl-433 driver directly:
1) I'm running Weewx on my server (inside my house)
2) Signal from the station could not get into my server if my dongle was plugged there.
3) I already have some raspberry pi's outside for other functions. I just added a dongle to one rpi and started sending data to my MQTT server.
4) I plan to include more sensor data from other sensors in the same MQTT broker. Using this driver it's easier  to merge all these sensors.
4) I use all these MQTT data for my Home Assistant application too.



You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/ZMR4MWVakJk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAPq0zEB%3D0a4LUzY9c%2Boav9mVcXLCN_L9kr2GzpWntBY6MsziSg%40mail.gmail.com.

bell...@gmail.com

unread,
Jan 13, 2021, 8:48:08 AM1/13/21
to weewx-user
Hi,
If the incoming data, rain_mm, is cumulative then you want the WeeWX field rain and the option contains_total = true. This will convert the cumulative value into an increment value that WeeWX expects.
rich

Jonis Maurin Ceará

unread,
Jan 13, 2021, 10:13:06 AM1/13/21
to weewx...@googlegroups.com
Tks Rich, I'll do these changes right now and test.

Tom, you've said:
wind_avg_km_h => There is no field for averages. It's calculated by WeeWX when needed.
wind_max_km_h => Field windGust
wind_dir_deg => Field windDir

I commented th 'wind_avg_km_h' and left only "wind_max_km_h" to windGust.....but with this configuration, I got nothing on wind speed or gust, just direction.
Both fields has values in MQTT......but if I don't map wind_avg_km_h to windSpeed, I got nothing in reports. I'm not sure if I should map or not this avg field to windSpeed.

 


Tom Keffer

unread,
Jan 13, 2021, 10:29:25 AM1/13/21
to weewx-user
It sounds like your field "wind_avg_km_h" is actually current wind speed. Hopefully, by "average" they mean over the last few seconds, not minutes.

Jonis Maurin Ceará

unread,
Jan 13, 2021, 1:38:18 PM1/13/21
to weewx...@googlegroups.com
Rich, no success :(
I've changed like you suggested, "rain" field and "contains_total = True". Now it started to rain again and my bucket is reporting 8.0 (was 2.1 before rain start), but weewx is reporting 51mm/h!
I'm really lost now.

One thing I'm sure: my sensor has been reporting total rain since it started.....it's not resetting (at least not until 24h).


bell...@gmail.com

unread,
Jan 13, 2021, 2:04:36 PM1/13/21
to weewx-user
Take a look at http://weewx.com/docs/customizing.htm#units It sounds like you might have a mix of ‘METRIC’ and ‘METRICWX’ data reporting. Let’s leave the unit_system as ‘METRIC’, but override the units of the rain field to mm by setting ‘units = mm’ in the rain_mm section. This will convert the rain from mm to cm and all the data will now be in the correct units for the METRIC unit_system. 
While we are debugging, I am going to focus on getting the rain value correct.  This is what MQTTSubscribe ‘controls’. If we get that correct, WeeWX will ‘magically’ compute the rainRate.
rich 

Jonis Maurin Ceará

unread,
Jan 13, 2021, 2:31:57 PM1/13/21
to weewx...@googlegroups.com
Ok, but I don't have METRIXWX in anywhere in my weewx configuration.

Anyway, I'm following your instructions.
This is my current setup:

 [[topics]]
        unit_system = METRIC
        use_topic_as_fieldname = true
        use_server_datetime = True
        [[[rtl_433/devices/Fineoffset-WHx080/temperature_C]]]
            name = outTemp
        [[[rtl_433/devices/Fineoffset-WHx080/humidity]]]
            name = outHumidity
        [[[rtl_433/devices/Fineoffset-WHx080/rain_mm]]]
            name = rain
            contains_total = True
            units = mm


Just deleted the database (to re-create) and monitoring MQTT. Just stopped raining, MQTT is displaying 13.5 for rain_mm topic. Let's see how it goes when it starts raining again.


Jonis Maurin Ceará

unread,
Jan 13, 2021, 2:35:01 PM1/13/21
to weewx...@googlegroups.com
You are the man! hahahahhaa

Last value on MQTT before start weewx: rain_mm => 13.8
Started weewx with empty database.
After 10 minutes, MQTT was reporting 15.6 and weewx generated a new report with total rain (today) value of 1.8 and rain rate of 5.4mm/h (automatically calculated).

If I'm not wrong, this is right! 15.6 - 13.8 = 1.8!




bell...@gmail.com

unread,
Jan 13, 2021, 3:16:24 PM1/13/21
to weewx-user

Let me try to give a better explanation. As Tom noted earlier, it doesn’t matter what the units of the data in the packet is. But, for a given packet all of the data ha to belong to one of the WeeWX unit_system, US, METRIC, or METRICWX.

Setting the unit_system under MQTTSubscribe controls what unit_system is in the packet that MQTTSubscribe creates. Normally (hopefully?) this the units of the data coming across MQTT. But, if any data coming over does not match the units expected by the unit_system value, it can be overridden by the unit value. 

Or in other words, the unit_system and units value tell MQTTSubscribe the units of the incoming data. MQTTSubscribe will do any necessary conversion so that all the data in the packet belongs to the unit_system value.

And I’m sure that is now clear as mud...

rich

bell...@gmail.com

unread,
Jan 13, 2021, 3:18:25 PM1/13/21
to weewx-user
Great! Sorry I missed the mm/cm earlier.
rich

Reply all
Reply to author
Forward
0 new messages