I will add the assignments in the driver. On Saturday, September 23, 2023 at 12:38:22 PM UTC+12 Tom Keffer wrote:
> Good advice! > > On Fri, Sep 22, 2023 at 5:35 PM gjr80 <[email protected]> wrote: > >> The other other variation on Tom's advice to use extensions.py, >> particularly if you are (still keen on) writing your own driver, is to >> include the unit group assignments in the driver file. They statements only >> need to be somewhere where they are executed each time WeeWX starts. If the >> fields are inextricably linked to the driver having everything in one place >> can be of benefit. I've used this approach with some of the drivers I have >> written. >> >> Gary >> >> On Saturday, 23 September 2023 at 10:11:16 UTC+10 [email protected] wrote: >> >>> Exactly. >>> >>> Or, alternatively, you can assign them to appropriate unit groups >>> <http://www.weewx.com/docs/customizing.htm#Assigning_a_unit_group> in >>> the file user/extensions.py: >>> >>> *import weewx.units* >>> >>> *weewx.units.obs_group_dict['signal1'] = 'group_radiation'* >>> *weewx.units.obs_group_dict['signal2'] = 'group_temperature'* >>> *weewx.units.obs_group_dict['signal3'] = 'group_radiation'* >>> >>> >>> Then you would not need to specify a format and label. It would also >>> allow you to do things like >>> >>> *The temperature is $current.signal2.degree_C >>> ($current.signal2.degree_F)* >>> >>> >>> to publish the temperature in both ºC and ºF. >>> >>> -tk >>> >>> On Fri, Sep 22, 2023 at 4:38 PM Craig Young <[email protected]> >>> wrote: >>> >>>> Thanks Tom. Signal1 for my station is the signal voltage from a >>>> pyrgometer. Signal2 is the temperature of the pyrgometer sensor (C) and >>>> Signal3 is the long wave intensity (W/m2) calculated by the datalogger. >>>> So >>>> if I understand correctly, the weewx engine will pass these values >>>> untouched through the various services and add to the DB as real numbers. >>>> I can then deal with them manually when creating the report. >>>> >>>> On Saturday, September 23, 2023 at 11:00:54 AM UTC+12 Tom Keffer wrote: >>>> >>>>> Signals are for ill-defined measurements. >>>>> >>>>> Unit groups exist for two reasons: >>>>> >>>>> 1. To pick an appropriate unit for a type of measurement. For >>>>> example, ºC for temperatures. >>>>> 2. To pick an appropriate format and label. >>>>> >>>>> Signals don't fit neatly into these reasons. They don't take a unit, >>>>> and it's not obvious what format and what label they should use. So, they >>>>> were left out of units.py and defaults.py. >>>>> >>>>> You can use the signal types without adding them to a unit group. You >>>>> just won't be able to convert them to a different unit (which they don't >>>>> have anyway), and there will be no automatic formatting and labelling. If >>>>> you need a format, use a .format() suffix. If you need a format, just add >>>>> it on. For example: >>>>> >>>>> *$current.signal1.format("%d") widgets* >>>>> >>>>> >>>>> Alternatively, if your signal is actually some kind of counter, you >>>>> could assign them to group_count. Then they would use "%d" for the >>>>> format, >>>>> and an empty string for the label. >>>>> >>>>> >>>>> >>>>> On Fri, Sep 22, 2023 at 3:22 PM Craig Young <[email protected]> >>>>> wrote: >>>>> >>>>>> In the wview_extended.py schema there is a group of types for signals >>>>>> (signal1, signal2, .. signal8) and stored in the DB as reals. I looked >>>>>> in >>>>>> units.py but did not see signals listed. >>>>>> >>>>>> On Saturday, September 23, 2023 at 9:40:17 AM UTC+12 Craig Young >>>>>> wrote: >>>>>> >>>>>>> What units group do the observation type Signals fall under? Or, >>>>>>> if I use a signal do I need to update a configuration file to place it >>>>>>> into >>>>>>> a units group. >>>>>>> >>>>>> -- >>>>>> 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 [email protected]. >>>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/weewx-user/b9fa5024-38c9-4d95-8e4b-5c9bb4f0ddb8n%40googlegroups.com >>>>>> >>>>>> <https://groups.google.com/d/msgid/weewx-user/b9fa5024-38c9-4d95-8e4b-5c9bb4f0ddb8n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> >>>>> -- >>>> 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 [email protected]. >>>> >>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/weewx-user/2dd9fe34-ffde-4e8f-aaf6-b205009b76a7n%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/weewx-user/2dd9fe34-ffde-4e8f-aaf6-b205009b76a7n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >> 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 [email protected]. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/weewx-user/bfef0c77-5e59-4d78-b1a8-f557b0dddaa6n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/weewx-user/bfef0c77-5e59-4d78-b1a8-f557b0dddaa6n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/07e3cf1b-6dc3-41a7-94c7-09e692952501n%40googlegroups.com.
