weatherstorm / Sofaskin-CW9009

Sofaskin-CW9009 skin for Weewx is a modified version of the Sofaskin developed by Sven at https://neoground.com/portfolio/neowx/. He no longer supports the original skin. Please see the readme for dependency requirements to use this skin.
http://www.centuryfarmweather.com
MIT License
17 stars 11 forks source link

illumination query #18

Closed harmlessdrudge closed 3 years ago

harmlessdrudge commented 3 years ago

I've discovered that my driver supports "illuminance" but with the name "luminosity". Substituting variable names now yields a value in the outputs displayed but it's an unlabeled value, currently, 0.000000, not a five digit nr with "lx" or "lux". In looking at the .conf file I can't see any derivations. Do you have anything in your weewx.conf file related to this?

BTW your 2nd OpenWeather map link on yr About page has a paste error (double http) -- just noticed.

weatherstorm commented 3 years ago

Sorry for the late reply. I am not sure what the best way to fix this going forward. I edited the Units.py file in here: Units.py, before they actually added illuminance as a variable in weewx in 4.0. The only problem with this is that when you update weewx, it replaces Units.py with a new version so you have to remember that after you update. This seems like a simple fix though. I couldn’t find a solution that fit your exact situation in their documentation but I wonder if something like this would work.

Add this line:

weewx.units.obs_group_dict['luminosity'] = 'group_illuminance'

To your weewx.conf [Engine] Section equaling data_services.

#   This section configures the internal weewx engine.

[Engine]

    # The following section specifies which services should be run and in what order.
    [[Services]]
        prep_services = weewx.engine.StdTimeSynch
        data_services = weewx.units.obs_group_dict['luminosity'] = 'group_illuminance'
        process_services = weewx.engine.StdConvert, weewx.engine.StdCalibrate, weewx.engine.StdQC, weewx.wxservices.StdWXCalculate
        xtype_services = weewx.wxxtypes.StdWXXTypes, weewx.wxxtypes.StdPressureCooker, weewx.wxxtypes.StdRainRater, weewx.wxxtypes.StdDelta
        archive_services = weewx.engine.StdArchive
        restful_services = weewx.restx.StdStationRegistry, weewx.restx.StdWunderground, weewx.restx.StdPWSweather, weewx.restx.StdCWOP, weewx.restx.StdWOW, weewx.restx.StdAWEKAS
        report_services = weewx.engine.StdPrint, weewx.engine.StdReport

group_illuminance has lux or lx assigned to it already in units.py so adding your variable luminosity should give it the same units. Not sure if this will work but give it a shot and see,

harmlessdrudge commented 3 years ago

Ok, thanks and no worries. I'll look at this, but I didn't want to make changes that might get hit by future updates and which I didn't fully understand (luminosity is supported, it's only the display that is off, as far as I can tell) so for now I just added

.format("%.0f") lux

to each output of the luminosity variable and this works fine. I'll check in with Gary once I've finished. Apart from this his driver works with nothing to do other than edit the list of sensors depending on what additional sensors one is using (4 extra thermo-hydro units in my case, one of which, in a sheltered location outdoors, overrides the main array.)

weatherstorm commented 3 years ago

That solution is definitely easier than mine. I also don't know if they will keep the same variables for each. I am glad that they finally added it but the variable naming convention on some of these new fields doesn't match there naming convention. We will see. I am glad you found a simple solution.

harmlessdrudge commented 3 years ago

I discovered yesterday that I had a typo in my weewx.conf file [[[[groups]]]] section:

groups.luminosity = lux

(instead of group.luminosity) which didn't generate an error, afaik, and which I had missed. I don't know yet if fixing this will remove the need for the workaround. I'll check shortly.

Now that I've got 5 years worth of data from my old station loaded into a new database schema I'm just about to delete some bad data and rebuild the daily summaries, then I think I'll be finished -- for now! -- I might look into a lightning detector later :-)