Hallo Harmut, Don't worry about clear_v2_data() mentioning 'clear' rather than 'update'. The original code 'cleared' fields extraTemp1 and extraTemp2 by writing NULL to each field. So if you like it updated each field by saving NULL in each field. You have modified the code to update different fields and instead of updating the field with NULL you are updating with a calculated value. The key part is the use of the updateValue method (in dbmanager_wx.updateValue(_rec['dateTime'], 'maxSolarRad', msr)).
I think the code is working as expected and updating the archive table. table "archive_day_maxSolarRad" after UPDATE > dateTime min mintime max maxtime > sum count wsum sumtime > 1383174000 0 1383254340 0 1383254340 > 0 21 0 6300 > 1383260400 0 1383260640 295.461855977661 1383303541 > 18656.2263424185 288 5596867.90272548 86400 > 1383346800 0 1383347041 289.813642518552 1383389941 > 18163.9155725552 288 5449174.67176655 86400 > 1383433200 0 1383433441 284.239023967007 1383476341 > 17683.3831545144 287 5305014.94635428 86400 > > The above tells me that table archive_day_maxSolarRad has data and that data can only have come from the maxSolarRad field in the archive table. Timestamp 1383174000 is from 31 October 2013 which appears to be the first day of your data. So at some stage the command has worked and put maxSolarRad data in an archive (maybe not the archive you want). Let's run the code again and logically follow/check the data. If we use the weewx.conf and weewxwd_config.py you last posted then running the command: $ weewxwd_config --clear-v2-data would use the binding wx_binding which would use database archive_mysql which uses MySQL database weewxacer. If this is the MySQL database you want to update continue. If not, you will need to use another binding by adding the --wx-binding=BINDING_NAME option to specify another binding name and thus use another database. For example $ weewxwd_config --clear-v2-data --wx-binding=wx3080_binding would result in MySQL databse weewx3080 being used. After you have run the above command what is in MySQL database weewxacer? (Assuming you stuck with wx_binding ie MySQL database weewxacer) $ mysql -u root -p mysql> USE weewxacer mysql> SELECT dateTime,maxSolarRad FROM archive ORDER BY dateTime DESC LIMIT 10; This should show you the dateTime and maxSolarRad fields from the 10 most recent records. What does it display? maxSolarRad could be 0 if this is run at night time, change '10' to something like '150' to look at around 12 hours or so of data. The following will show the first 10 records. What does this show, your data starts around 10PM on 31 October 2013 so again thismight show you 0 only. You can increase the '10' to somethign like '150' to see what happens over 12 hours or so. mysql> SELECT dateTime,maxSolarRad FROM archive ORDER BY dateTime ASC LIMIT 10; Gary On Tuesday, 7 March 2017 21:30:57 UTC+10, Hartmut Schweidler wrote: > > Hallo Gary, > > So it should look after the complete update > But the UPDATE does not work yet. > The entry of the values in the database is missing > > "in the headline of def clear_v2_data > Clear any legacy humidex and apparent temperature data from the > Weewx (not Weewx-WD) database." > > I want to replace the clear by update > > I have same code elements from you wd adjusted for me > > Thank you for this great work and also Thank all the others > > Hartmut > > Am Dienstag, 7. März 2017 11:43:57 UTC+1 schrieb gjr80: >> >> Hallo Hartmut, >> >> So I see data has appeared in the maxSolarRad daily >> summary(archive_day_maxSolarRad), that implies there must be maxSolarRad >> data in your archive. So is everything as you expect or is there still a >> problem? >> >> Gary >> >>
