Phil,
No need to modify vantage.py, in fact modifying one of the core WeeWX files is seldom a good solution when others exist. You open yourself up to losing your changes over an upgrade or if you place your modified file in /home/weewx/bin/user (or /usr/share/weewx/user) so it is safe from upgrades, you risk missing changes to the core WeeWX files. In this case you can use StdCalibrate to create your new field. Once you create your new field, if you change you db schema to include it your new field will be automatically saved in the database. Once it is in the database you can plot it. Let's assume the name of the field that has your current sunshine data is 'sunshine_field'. As an experiment try this swapping 'sunshine_field' for the field name that presently has your sunshine data:
1. edit weewx.conf and add the highlighted lines under [StdCalibrate] [[Corrections]]:
[StdCalibrate]
[[Corrections]]
....
sunshine_seconds = sunshine_data * 36
2. look through weewx.conf and see if you have an [Accumulator] stanza, if so add the highlighted lines, if you don't have an [Accumulator] stanza create one and add the highlighted lines:
[Accumulator]
[[sunshine_seconds]]
extractor = sum
3. save weewx.conf.
4. stop WeeWX if it is running and
run WeeWX directly. You should see loop packets (lines starting with LOOP:) every few seconds and archive records (lines starting with REC:) every archive interval. You should see your 'sunshine_field' and you should see the new
sunshine_seconds field. Note that
sunshine_seconds is not being saved to database yet as (presumably) you have not yet added a
sunshine_seconds field to your db schema, once you do it will be saved to database and you can then use the field in plots.
You can stop WeeWX with ctrl-C or ctrl-Z and restart the daemon.
I failed to mention the [Accumulator] stanza before, the [Accumulator] stanza, among other things, is used to tell WeeWX how to create an archive record field out of the accumulated loop data for that field. In this case, just like rain, we want the sum of the data over the archive interval (most obs want the default which is average, eg temperature, pressure etc)
Gary