Glad it's working for you. Single-malt Scotch works best for me.
On Sun, Jul 16, 2023 at 2:23 PM Messy Potamia <messypota...@gmail.com> wrote: > I followed that guidance, removed my hack to units.py, placed the > entries in user/lakedata.py, and it's great. > to wit: > LakeElev 594.74 ftMSL > > Yeah. > Thank you again. This is probably what I should've done way back in > the 3.9 days. > Phil > > On Sun, Jul 16, 2023 at 11:00 PM Messy Potamia <messypota...@gmail.com> > wrote: > > > > Before I read your reply I edited units.py and added LakeElev to > > group_altitude at the bottom of the ...Dicts whatever-that-is, gave it > > some time, had a bourbon, and lo and behold it is now printing out > > lake elevation as ""LakeElev 594.75 feet" instead of 594.750000 > > But I'm going to read your section Assigning a unit group to see what > > I did wrong. Don't know how I missed that. > > Thanks > > Phil > > > > On Sun, Jul 16, 2023 at 10:44 PM Tom Keffer <tkef...@gmail.com> wrote: > > > > > > The answer is that you're confusing units (such as "inHg") with > observation types (such as "LakeElev"). > > > > > > The [[[[StringFormats]]]] section uses units as keys, not observation > types. If LakeElev is measured in meters, it will use whatever formatting > has been specified for meters. > > > > > > I suspect that you have not specified which unit group LakeElev is in, > so WeeWX is just printing out the raw, unformatted value. See the section > Assigning a unit group for how to do this. Once it's a member of a unit > group (say "group_altitude") it will use whatever unit that group is > measured in (usually meters or feet) and follow the formatting conventions > for that unit. > > > > > > Or, maybe you have already done that and something else is wrong, in > which case, come back and give us more details. > > > > > > -tk > > > > > > On Sun, Jul 16, 2023 at 11:45 AM Messy Potamia <messypota...@gmail.com> > wrote: > > >> > > >> re: "3. I'm not following your question about "LakeElev". I don't know > > >> what that is." > > >> I have a ultrasonic range sensor (MaxBotix) which uses ttyS0 on the pi > > >> which some python code (which has been working very well for several > > >> years and still is) which writes a single line of text containing two > > >> values to a file. My /home/weewx/bin/user/lakedata.py reads the first > > >> value, converts it to a float, and stores it in the new parameter I > > >> added to the weewx.sdb using the utility to add a column. Using a > > >> sqlitebrowser i verified that column is populating every 5 minutes. > > >> The name of the column is LakeElev; weewx is successfully displaying > > >> that data since I've added it to the proper skins/configs. > > >> The only problem is, even after reading & rereading the guides, I > > >> don't get how I tell weewx to treat that as a fully organized > > >> measurement. For instance, added "[[[[StringFormats]]]] > > >> inHg = %.2f" to weewx.conf and it indeed gives the desired > > >> format to barometer. However, my attempts to provide a format to > > >> LakeElev has met with acute disaster. Here's a segment from my > > >> weewx.conf with comments: > > >> > > >> [[[[StringFormats]]]] > > >> > > >> count = %d > > >> foot = %.2f > > >> inch2 = %.1f > > >> inHg = %.2f > > >> # LakeElev = %.2f #DOES NOTHING > > >> # $current.LakeElev.format(format_string="%.2f") > > >> #CRASHES STDREPORT THREAD > > >> # current.LakeElev.format(format_string="%.2f") > > >> #CRASHES ENGINE > > >> > > >> As you can see I still don't know what I'm doing. Here's the contents > > >> of my lakedata.py, which is working fine, but notice the #Note I wrote > > >> to myself in it: > > >> > > >> #!/usr/bin/env python > > >> > > >> #file user/lakedata.py > > >> import weewx > > >> import weewx.units > > >> from weewx.engine import StdService > > >> > > >> class AddLakedata(StdService): > > >> > > >> def __init__(self, engine, config_dict): > > >> # Initialize my superclass first: > > >> super(AddLakedata, self).__init__(engine, config_dict) > > >> # Bind to any new archive record events: > > >> self.bind(weewx.NEW_ARCHIVE_RECORD, > self.new_archive_packet) > > >> > > >> def new_archive_packet(self, event): > > >> > > >> #(code that reads two measurements from a file) > > >> with open("/home/pi/wxdata/weewxmbdata.dat") as f: > > >> for line in f: > > >> numbers_str = line.split() > > >> numbers_float = [float(x) for x in > numbers_str] > > >> value1 = numbers_float[0] > > >> value2 = numbers_float[1] > > >> > > >> event.record['LakeElev'] = value1 > > >> # event.record['lakeWaveheight'] = value2 > > >> > > >> # > > >> #Am I supposed to assign this to a units group? Which is best? What > if I don't? > > >> > > >> > > >> > > >> Okay something tells me there's a few things i'm leaving out in adding > > >> this parameter. Like I said, back in the 3.9. days I modified some > > >> file (units.py?) but was told that wasn't the best way to add my > > >> lakedata parameters (which back then included LakeElevation and > > >> WaveHeight). > > >> I'd like to do this the preferred way. > > >> > > >> Thanks again, so much - - - > > >> Phil > > >> > > >> On Sun, Jul 16, 2023 at 4:22 PM Tom Keffer <tkef...@gmail.com> wrote: > > >> > > > >> > Sorry. I had assumed you were still using your v3.9.1 Seasons skin. > If that's the case, the tag $current.barometer is in the file > Seasons/current.inc. > > >> > > > >> > Incidentally, there's no reason not to continue using your old skin. > > >> > > > >> > But, if you are actually using a V4 skin, then to answer your > questions: > > >> > > > >> > 1. The line "#set observations = ..." is actually saying get the > set of observations from $DisplayOptions. If DisplayOptions does not have > an entry, then the fallback is to use just outTemp and barometer. See the > configuration file skin.conf for what's in DisplayOptions. > > >> > > > >> > 2. You can specify an override for the barometer formatting for the > unit "inHg" in weewx.conf: > > >> > > > >> > [StdReport] > > >> > ... > > >> > [[Defaults]] > > >> > ... > > >> > [[[Units]]] > > >> > ... > > >> > [[[[StringFormats]]]] > > >> > inHg = %.2f > > >> > > > >> > 3. I'm not following your question about "LakeElev". I don't know > what that is. > > >> > > > >> > > > >> > On Sun, Jul 16, 2023 at 12:33 AM Messy Potamia < > messypota...@gmail.com> wrote: > > >> >> > > >> >> Where do those 2 formatting statements go? > > >> >> Also, why, in current.inc, is the line > > >> >> #set $observations = > > >> >> $to_list($DisplayOptions.get('observations_current', ['outTemp', > > >> >> 'barometer'])) > > >> >> containing only outTemp and barometer? Where are the rest of the > items > > >> >> displayed in Current Conditions? Sorry I'm just not getting the > > >> >> formatting layout big picture. Yes I'm reading the customization > guide > > >> >> but I'm having questions as I read it. > > >> >> Thanks! > > >> >> > > >> >> On Sun, Jul 16, 2023 at 12:22 AM Tom Keffer <tkef...@gmail.com> > wrote: > > >> >> > > > >> >> > For altitude, format it like any other tag. See the section > Formatting options in the Customizing Guide. For example, if you do not > want anything beyond the decimal point: > > >> >> > > > >> >> > $station.altitude.format("%.0f") > > >> >> > > > >> >> > Same with barometer. To show 2 digits: > > >> >> > > > >> >> > $current.barometer.format("%.2f") > > >> >> > > > >> >> > Whether it is in bold is a function of whatever CSS styling you > are using. > > >> >> > > > >> >> > -tk > > >> >> > > > >> >> > > > >> >> > On Sat, Jul 15, 2023 at 2:55 PM messyp...@gmail.com < > messypota...@gmail.com> wrote: > > >> >> >> > > >> >> >> I got the added measurement added to the database, and into > the skins, however I don't need Lake Elevation to be show in so many > digits. I previously (3.9.1) had it showing 2 digits to the right of the > decimal. > > >> >> >> Also, I don't know what happened but now the Barometer has > changed its formatting to bold and more decimal places. > > >> >> >> Where do I fix this? > > >> >> >> Thanks - - - > > >> >> >> Current Conditions > > >> >> >> > > >> >> >> Outside Temperature > > >> >> >> 86.1°F > > >> >> >> Dew Point > > >> >> >> 73.8°F > > >> >> >> Outside Humidity > > >> >> >> 67% > > >> >> >> Barometer > > >> >> >> 29.799 inHg (-0.033) > > >> >> >> Wind > > >> >> >> 0 mph N/A ( N/A) > > >> >> >> Rain Today > > >> >> >> 0.02 in > > >> >> >> Rain Rate > > >> >> >> 0.00 in/h > > >> >> >> Inside Temperature > > >> >> >> 92.6°F > > >> >> >> LakeElev > > >> >> >> 594.770000 > > >> >> >> Inside Humidity > > >> >> >> 64% > > >> >> >> > > >> >> >> -- > > >> >> >> 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. > > >> >> >> To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-user/c2c9ce27-f091-4ddb-afad-616d6c287bfdn%40googlegroups.com > . > > >> >> > > > >> >> > -- > > >> >> > You received this message because you are subscribed to a topic > in the Google Groups "weewx-user" group. > > >> >> > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/weewx-user/9hY3_PBqY5E/unsubscribe. > > >> >> > To unsubscribe from this group and all its topics, send an email > to weewx-user+unsubscr...@googlegroups.com. > > >> >> > To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-user/CAPq0zEAaMotCOwYy6y0sqiPK-n8Jzz1F2ZzRB0t5ofQtfJefBQ%40mail.gmail.com > . > > >> >> > > >> >> -- > > >> >> 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. > > >> >> To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-user/CAB7-S75_iZULqbfyqN7s8bMqYfG9q%2B17k7pOjJrvsLj2qU1Q2w%40mail.gmail.com > . > > >> > > > >> > -- > > >> > You received this message because you are subscribed to a topic in > the Google Groups "weewx-user" group. > > >> > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/weewx-user/9hY3_PBqY5E/unsubscribe. > > >> > To unsubscribe from this group and all its topics, send an email to > weewx-user+unsubscr...@googlegroups.com. > > >> > To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-user/CAPq0zEAfhRDtxg7L3Dbhu_WtVPyhurobZqtNGJXqDzs%3Dr30YiQ%40mail.gmail.com > . > > >> > > >> -- > > >> 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. > > >> To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-user/CAB7-S77C0xBBmP%3Dmse%3DOVHFV_-dSJRKbMNGB7q7b8Qn3jZvFOg%40mail.gmail.com > . > > > > > > -- > > > You received this message because you are subscribed to a topic in the > Google Groups "weewx-user" group. > > > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/weewx-user/9hY3_PBqY5E/unsubscribe. > > > To unsubscribe from this group and all its topics, send an email to > weewx-user+unsubscr...@googlegroups.com. > > > To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-user/CAPq0zEDyYZMH8Nfe-thQL99r-g3WtkRFHvnQM9-TWtFkUuVogA%40mail.gmail.com > . > > -- > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-user/CAB7-S76j3_nfQHA9GVUZ3AM_TYU_ySvLT0%3Dtv0bSmjmsHbdEtw%40mail.gmail.com > . > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAPq0zECfzmJY1G9wfTCqyrvpD6_%3DBjiC-dQdtT7DyW-QOx3_4g%40mail.gmail.com.