Tom, it's exactly what I did. I'm quite well versed with mysql, so adding the column is not a problem. I've even shown the extract for the column in my first post!
So, to sum up: 1. I've added the field to the python schema and also set its group; 2. added the filed to the software-generated list of fields; 3. added the maxSolarRad field to the archive table in mysql (it's actually MariaDB, but that's not important now). Yet it still filled my db with nulls even in daylight. I can't test it any more as it's already too dark. I will rebuild the daily records when the values start appear in the db. Unless it's a requirement for it to work at all, in that case I'll do it right away. On Sunday, October 28, 2018 at 6:02:37 PM UTC+1, Thomas Keffer wrote: > > Replicating is necessary for sqlite --- it has no mechanism for adding a > column to a database table. > > However, if you are using MySQL, then you can just add a column. Here are > the instructions <http://www.mysqltutorial.org/mysql-add-column/>. > > But, you must still rebuild the daily summaries, because they will not be > aware of the new type. Use the wee_database tool with the --rebuild-daily > <http://weewx.com/docs/utilities.htm#Action_--rebuild-daily> option to do > this. > > -tk > > On Sun, Oct 28, 2018 at 9:45 AM kobuki <nls...@gmail.com <javascript:>> > wrote: > >> Thanks for the explanation. I did see the instructions for wee_database >> but I'm perfectly fine with the current database. I see no point in >> replicating it - what is the exact reasoning behind it? Isn't it possible >> to tell WeeWx to use the current db with the modified archive table? The >> new one should be completely identical to the old one after adding the >> extra column, after all. It has a lot of data, too. >> >> On Sunday, October 28, 2018 at 4:07:02 PM UTC+1, Thomas Keffer wrote: >>> >>> There are several things that could be going wrong. >>> >>> First, the schema is used only when the database is first being created. >>> After that, the schema is read from the database --- it's not enough to >>> just add a new type to schemas.wview.schema. You have to rebuild the >>> database with the new type. The utility wee_database can do this. It >>> will create a new database with the new schema, then populate it with data >>> from the old database. See the section *Add a new type to the archive >>> database <http://weewx.com/docs/customizing.htm#add_archive_type>* in >>> the Customizing Guide. >>> >>> When you're done, double check that the new database, in fact, includes >>> the new type. This can be done by running the mysql utility with the >>> command >>> >>> *describe weewx.archive* >>> >>> Finally, make sure that values of maxSolarRad are non-NULL. You can do >>> this by running weewxd directly from the command line >>> <http://weewx.com/docs/usersguide.htm#Running_directly>. Watch the >>> values as they go by and see if they are None. >>> >>> -tk >>> >>> >>> On Sun, Oct 28, 2018 at 5:41 AM kobuki <nls...@gmail.com> wrote: >>> >>>> Hi, >>>> >>>> I've added maxSolarRad to my WeeWx in the following way. First, I >>>> added these lines to the /usr/share/weewx/user/extensions.py file: >>>> >>>> import weewx.units >>>> import schemas.wview >>>> >>>> extended_schema = schemas.wview.schema + [('maxSolarRad', 'REAL')] >>>> weewx.units.obs_group_dict['maxSolarRad'] = 'group_radiation' >>>> >>>> Then made changes to /etc/weewx/weewx.conf: >>>> >>>> [DataBindings] >>>> [[wx_binding]] >>>> database = archive_mysql >>>> table_name = archive >>>> manager = weewx.wxmanager.WXDaySummaryManager >>>> # schema = schemas.wview.schema >>>> schema = user.extensions.extended_schema >>>> >>>> ... >>>> >>>> [StdWXCalculate] >>>> [[Calculations]] >>>> ... >>>> maxSolarRad = software >>>> >>>> Naturally, I added a new column to the archive table in my weewx mysql >>>> schema: >>>> >>>> `maxSolarRad` double DEFAULT NULL, >>>> >>>> Then restarted WeeWx, I see in the logs that maxSolarRad is being >>>> handled with a certain algorithm, but the maxSolarRad column is filled >>>> with NULL values in the database. >>>> >>>> Could anyone explain what I'm missing from the above procedure to make >>>> it work? Thanks in advance... >>>> >>>> -- >>>> 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. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- >> 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 <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.