Rainer,
There are a few approaches that would solve you problem. You could use the StdCalibrate service to simply assign your existing sensor data to a another field or if you needed to do something beyond the limited capabilities of the StdCalibrate service could write your own custom service to do what you need. The other alternative for data that comes from a driver with a sensor/field map is to simply change the sensor/field map so that the driver places the data concerned into the field you wish to use right from the start.
Please note, in the following examples I have used extraTemp2 as the field to be recycled, this is a poor choice for a couple of reasons; firstly it is quite possible a GW1000 user would want to use extraTemp2 for additional temperature sensors. Secondly, extraTemp2 normally holds temperature data and we will now be storing non-temperature data in the field, better to use a field that stores the same type of data if possible (more precisely the same unit type, eg pressure, concentration, speed etc). In this case the use of WeeWX field no2 or pm1_0 may have been better.
In your case I would customise the GW1000 driver field map. In this example let's assume you want to store your second PM2.5 sensor in WeeWX field
extraTemp2 and your GW1000 is emitting data from your second
PM2.5 sensor in field
pm25_2. In order to change the sensor map for the GW1000 we need to know two things, what field we are mapping from and what field we are mapping to. We know we are mapping to
extraTemp2 but we are not actually mapping from
pm25_2, we are actually mapping from GW1000 internal field
pm252 (in many cases the internal GW1000 field is the same as the field name that appears in the loop packet but some are different for a number of reasons that I will not go into here). You will find details of the GW1000 driver default field map and internal field names in the GW1000 driver
Field map wiki entry. If we want to alter just a small number of field map entries we can do so using the
[[field_map_extensions]] stanza (if we wanted to re-define the entire field map we would use the
[[field_map]] stanza) under
[GW1000] in
weewx.conf as follows:
[GW1000]
....
[[field_map_extensions]]
extraTemp2 = pm252
There is one other step you will need to follow and that is to ensure that your 'recycled' field is set to the appropriate unit group. All fields in the WeeWX database schema are assigned to a unit group, that way WeeWX knows the data in, for example, WeeWX field
outTemp is a temperature and not a pressure. In this case, we have used
extraTemp2 and by default WeeWX will treat any data in that field as temperature. We need to change that, this can be done in a number of ways but the simplest is to simply assign the appropriate unit group in the file
extensions.py (
extensions.py is located in
/home/weewx/bin/user or
/usr/share/weewx/user depending on how you installed WeeWX). In this case edit
extensions.py and add the following lines to the bottom of the file:
import weewx.units
weewx.units.obs_group_dict['extraTemp2'] = 'group_concentration'
In this case we have re-assigned field extraTemp2 to belong to the unit group group_concentration (the WeeWX unit group used for concentrations). A similar but slightly different approach is covered in the Assigning a unit group section in the Customization Guide.
Note the extensions.py modification was necessary because the destination field and and source data are of different unit groups, if they were the same then there is no need to change any unit groups.
Save weewx.conf and extensions.py and restart WeeWX and the PM2.5 data from the second sensor will appear in field extraTemp2 in loop packets emitted by the GW1000 driver. WeeWX will accumulate this loop data and extraTemp2 will be included in archive records synthesised by WeeWX. You can then use extraTemp2 in tags in WeeWX report templates.
That covers the GW1000 field map approach. For the sake of completeness I will cover the StdCalibrate approach as well.
To achieve the same result with the
StdCalibrate service we add an entry under
[StdCalibrate] [[Corrections]] in weewx.conf. In this case we would use:
[StdCalibrate]
....
[[Corrections]]
....
extraTemp2 = pm25_2
Note that in this case we used field pm25_2 as we are actually using the field from the loop packet and archive record rather than an internal field in the GW1000 driver.
You would also need to make the same addition to extensions.py to deal with the units as was done with the GW1000 field map example above.
Gary