plots and how to display a constant value ie a limit

173 views
Skip to first unread message

Ian Prescott

unread,
Mar 8, 2022, 1:01:43 AM3/8/22
to weewx-user
Hi
Could somebody show me how to correctly display a limit / constant value on a plot
some time ago I alerted to a post about how to show a constant value in a plot.
I have searched but I haven't found the right words to find that post again
but I copied it and use it in my skin.conf
        [[[daywind]]]
#            [[[[windSpeed]]]]
#            [[[[windGust]]]]

# place limit line on graph
            [[[[windMax]]]]
#                data_type = function              | this
#                label = ' '                                 | does
#                function_definition = 10.5       | not
#                function_type = windSpeed   | work
#                color = red

                data_type = 10.5
                label = ' '
                color = orange
                width = 1
            [[[[windSpeed]]]]
                color = 0xb48242
            [[[[windGust]]]]
                color = 0x4242b4
I think it is a useful feature for me and it displays an orange line at 10.5
BTW the red line does not show on the plot and no errors appear in the log (debug=1)

Now I would like to display a constant value in another plot.
like this
        [[[dayvolt]]]
            yscale = 3.6, 4.2, 0.1
            [[[[consBatteryVoltage]]]]
                label = Transmitter battery
                color = 0xb48242    # blue
#                color = 0x4242b4    # red
# place limit line on graph
            [[[[voltMin]]]]
                data_type = function
                label = ' '
                function_definition = 3.7
                function_type = consBatteryVoltage
                color = red
#                width = 1
But this doesn't show a red line, and there are no complaints in the log.

However if I use the wind example I get errors in the log .........
but not for the wind example ........only about the voltage limit
The Customization Guide under ImageGenerator doesn't give any details
Thanks

Mar  8 15:46:17 weatherstn weewx[14006] INFO weewx.manager: Added record 2022-03-08 15:45:00 AEST (1646718300) to database 'weewx.sdb'
Mar  8 15:46:17 weatherstn weewx[14006] INFO weewx.manager: Added record 2022-03-08 15:45:00 AEST (1646718300) to daily summary in 'weewx.sdb'
Mar  8 15:46:17 weatherstn weewx[14006] DEBUG weewx.reportengine: Running reports for latest time in the database.
Mar  8 15:46:17 weatherstn weewx[14006] DEBUG weewx.reportengine: Running report 'SeasonsReport'
Mar  8 15:46:17 weatherstn weewx[14006] DEBUG weewx.restx: StationRegistry: wait interval (91800 < 604800) has not passed for record 2022-03-08 15:45:00 AEST (1646718300)
Mar  8 15:46:17 weatherstn weewx[14006] DEBUG weewx.reportengine: Found configuration file /etc/weewx/skins/Seasons/skin.conf for report 'SeasonsReport'
Mar  8 15:46:17 weatherstn weewx[14006] DEBUG weewx.cheetahgenerator: Using search list ['weewx.cheetahgenerator.Almanac', 'weewx.cheetahgenerator.Current', 'weewx.cheetahgenerator.DisplayOptions', 'weewx.cheetahgenerator.Extras', 'weewx.cheetahgenerator.Gettext', 'weewx.cheetahgenerator.JSONHelpers', 'weewx.cheetahgenerator.PlotInfo', 'weewx.cheetahgenerator.SkinInfo', 'weewx.cheetahgenerator.Station', 'weewx.cheetahgenerator.Stats', 'weewx.cheetahgenerator.UnitInfo']
Mar  8 15:46:17 weatherstn weewx[14006] DEBUG weewx.manager: Daily summary version is 4.0
Mar  8 15:46:17 weatherstn weewx[14006] ERROR weewx.cheetahgenerator: Evaluation of template /etc/weewx/skins/Seasons/telemetry.html.tmpl failed.
Mar  8 15:46:17 weatherstn weewx[14006] ERROR weewx.cheetahgenerator: **** Ignoring template /etc/weewx/skins/Seasons/telemetry.html.tmpl
Mar  8 15:46:17 weatherstn weewx[14006] ERROR weewx.cheetahgenerator: **** Reason: cannot find 'has_data' while searching for 'year.3.7.has_data'
Mar  8 15:46:17 weatherstn weewx[14006] ERROR weewx.cheetahgenerator: **** To debug, try inserting '#errorCatcher Echo' at top of template
Mar  8 15:46:17 weatherstn weewx[14006] INFO weewx.cheetahgenerator: Generated 7 files for report SeasonsReport in 0.29 seconds
Mar  8 15:46:17 weatherstn weewx[14006] DEBUG weewx.manager: Daily summary version is 4.0
Mar  8 15:46:17 weatherstn weewx[14006] INFO weewx.imagegenerator: Generated 19 images for report SeasonsReport in 0.23 seconds
Mar  8 15:46:17 weatherstn weewx[14006] INFO weewx.reportengine: Copied 0 files to /var/www/html/weewx
Mar  8 15:46:17 weatherstn weewx[14006] DEBUG weewx.reportengine: Report 'SmartphoneReport' not enabled. Skipping.
Mar  8 15:46:17 weatherstn weewx[14006] DEBUG weewx.reportengine: Report 'MobileReport' not enabled. Skipping.
Mar  8 15:46:17 weatherstn weewx[14006] DEBUG weewx.reportengine: Report 'StandardReport' not enabled. Skipping.
Mar  8 15:46:17 weatherstn weewx[14006] DEBUG weewx.reportengine: Report 'FTP' not enabled. Skipping.
Mar  8 15:46:17 weatherstn weewx[14006] DEBUG weewx.reportengine: Report 'RSYNC' not enabled. Skipping.

Tom Keffer

unread,
Mar 8, 2022, 7:56:57 AM3/8/22
to weewx-user
You're right: it's not mentioned in the Customizing Guide, and it really should be. 

I've modified the guide to include a section about the topic. Hopefully it will help. Including arbitrary expressions


--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAN84nRuRrvwvW5zhONY4n%2B%2BydT74zUiuE%3DP6h9Ej3tdMXpeLRg%40mail.gmail.com.

ianpre...@gmail.com

unread,
Mar 8, 2022, 6:35:01 PM3/8/22
to weewx-user
Thanks
I won't pretend that I understood ........but it may help others.
It did give me a clue as to how to move forward a bit .....I think
I tried this .......and it worked ......an orange line at 4v .......1 step forward
and telemetry display updates.
        [[[dayvolt]]]
            yscale = 3.6, 4.2, 0.1
            [[[[consBatteryVoltage]]]]
                label = Transmitter battery
                color = 0xb48242    # blue
#                color = 0x4242b4    # red

# place limit line on graph
            [[[[voltMin]]]]
                data_type = consBatteryVoltage - consBatteryVoltage + 4

                label = ' '
                color = orange
                width = 1

but I want the limit at 3.7v ........so using the above
        [[[dayvolt]]]
            yscale = 3.6, 4.2, 0.1
            [[[[consBatteryVoltage]]]]
                label = Transmitter battery
                color = 0xb48242    # blue
#                color = 0x4242b4    # red

# place limit line on graph
            [[[[voltMin]]]]
                data_type = consBatteryVoltage - consBatteryVoltage + 3.7

                label = ' '
                color = orange
                width = 1
fail ....errors in the log .......places the orange line, but telemetry page is now frozen
Mar  9 08:56:06 weatherstn weewx[14006] DEBUG weewx.reportengine: Found configuration file /etc/weewx/skins/Seasons/skin.conf for report 'SeasonsReport'
Mar  9 08:56:06 weatherstn weewx[14006] DEBUG user.MQTTSubscribe: (Driver) data-> final loop packet is tele/weather-stn-sensor/STATE 2022-03-09 08:56:04 AEST (1646780164): 'batteryStatus1': '0.0', 'consBatteryVoltage': '4.086810112', 'dateTime': '1646780164.264368', 'extraTemp1': '33.0', 'signal1': '1515', 'signal2': '-34.0', 'supplyVoltage': '12.13632011', 'txBatteryStatus': '0.0', 'usUnits': '17'
Mar  9 08:56:06 weatherstn weewx[14006] DEBUG weewx.cheetahgenerator: Using search list ['weewx.cheetahgenerator.Almanac', 'weewx.cheetahgenerator.Current', 'weewx.cheetahgenerator.DisplayOptions', 'weewx.cheetahgenerator.Extras', 'weewx.cheetahgenerator.Gettext', 'weewx.cheetahgenerator.JSONHelpers', 'weewx.cheetahgenerator.PlotInfo', 'weewx.cheetahgenerator.SkinInfo', 'weewx.cheetahgenerator.Station', 'weewx.cheetahgenerator.Stats', 'weewx.cheetahgenerator.UnitInfo']
Mar  9 08:56:06 weatherstn weewx[14006] DEBUG weewx.manager: Daily summary version is 4.0
Mar  9 08:56:06 weatherstn weewx[14006] ERROR weewx.cheetahgenerator: Evaluation of template /etc/weewx/skins/Seasons/telemetry.html.tmpl failed.
Mar  9 08:56:06 weatherstn weewx[14006] ERROR weewx.cheetahgenerator: **** Ignoring template /etc/weewx/skins/Seasons/telemetry.html.tmpl
Mar  9 08:56:06 weatherstn weewx[14006] ERROR weewx.cheetahgenerator: **** Reason: cannot find 'has_data' while searching for 'year.consBatteryVoltage - consBatteryVoltage + 3.7.has_data'
Mar  9 08:56:06 weatherstn weewx[14006] ERROR weewx.cheetahgenerator: **** To debug, try inserting '#errorCatcher Echo' at top of template
Mar  9 08:56:06 weatherstn weewx[14006] INFO weewx.cheetahgenerator: Generated 7 files for report SeasonsReport in 0.29 seconds
Mar  9 08:56:06 weatherstn weewx[14006] DEBUG weewx.manager: Daily summary version is 4.0
Mar  9 08:56:06 weatherstn weewx[14006] INFO weewx.imagegenerator: Generated 19 images for report SeasonsReport in 0.23 seconds
Mar  9 08:56:06 weatherstn weewx[14006] INFO weewx.reportengine: Copied 0 files to /var/www/html/weewx
Mar  9 08:56:06 weatherstn weewx[14006] DEBUG weewx.reportengine: Report 'SmartphoneReport' not enabled. Skipping.
Mar  9 08:56:06 weatherstn weewx[14006] DEBUG weewx.reportengine: Report 'MobileReport' not enabled. Skipping.
Mar  9 08:56:06 weatherstn weewx[14006] DEBUG weewx.reportengine: Report 'StandardReport' not enabled. Skipping.
Mar  9 08:56:06 weatherstn weewx[14006] DEBUG weewx.reportengine: Report 'FTP' not enabled. Skipping.
Mar  9 08:56:06 weatherstn weewx[14006] DEBUG weewx.reportengine: Report 'RSYNC' not enabled. Skipping.

I take it that it doesn't like 3.7 ..........I don't understand why.........
the windspeed example is so easy and simple and works using a number with a decimal point and no equation
should I place the number in quotes ? ...........is there a workaround ?  ............or this will never fly ?
thanks again

Tom Keffer

unread,
Mar 8, 2022, 7:05:57 PM3/8/22
to weewx-user
I was able to reproduce your error.

It did work with v3.7. It appears that in my zeal to allow xtypes to be used in arbitrary plots, I broke something.

I've opened issue #761 to track.

-tk

pli...@googlemail.com

unread,
Mar 9, 2022, 1:39:40 AM3/9/22
to weewx-user
I'll join this thread for a moment.

I also had the question of how to draw an additional line into a plot.

So far I haven't been able to find anything about it in the instructions. But since the topic is being discussed here...

In my case, I want an additional line at 0°C on the temperature plots.
This would make it very easy to see if the temperatures have gone below zero.

But I only want this line at minimum temperatures below 0°C.
Is there any way I can link this to a condition?

pli...@googlemail.com

unread,
Mar 9, 2022, 1:42:17 AM3/9/22
to weewx-user
I am a beginnger and use the Seasons skin, I forgot to write that

Tom Keffer

unread,
Mar 15, 2022, 5:46:36 PM3/15/22
to weewx-user
Update on this issue.

First: I was wrong. The problem is not that weewx is attempting to evaluate the constant as an xtype. The problem is in how we autoconfigure which plots to create. The templates test to see whether there is any data in a plot before deciding whether to generate it. 

There is a workaround, which involves abandoning the test. In the file telemetry.html.tmpl you'll find a stretch that looks something like this:

    #for obs in $getobs($plot_name)
      #if $getVar('year.%s.has_data' % $obs)
        #set $show_plot = 1
      #end if
    #end for

Comment out the highlighted lines by using double hash marks, so it becomes:

    #for obs in $getobs($plot_name)
      ##if $getVar('year.%s.has_data' % $obs)
        #set $show_plot = 1
      ##end if
    #end for

Now if you use an [ImageGenerator] spec such as the below, it will work:

        [[[dayvolt]]]
            yscale = 3.6, 4.2, 0.1
            [[[[consBatteryVoltage]]]]
                label = Transmitter battery
                color = 0xb48242    # blue
            [[[[voltMin]]]]
                data_type = 3.7

                label = ' '
                color = orange
                width = 1

To user "plinepa": 

You can do what you want by using the SQLite function "IIF()". Unfortunately, it is available only in SQLite 3.32 and later, which came out about 2 years ago. It's still pretty rare, but you might get lucky. In that case, assuming your database is in US Customary units, you could do something like this:
[[[dayoutTemp]]]
[[[[outTemp]]]]
[[[[freezing]]]]
data_type = "IIF(outTemp<48.0, 32.0, null)"
label = ' '
This produces a plot that looks like:

image.png

-tk

Message has been deleted

Ralph Underwood

unread,
Mar 16, 2022, 10:40:32 PM3/16/22
to weewx-user
Probably not too elegant, I have been setting soilTemp4 to 32 and setting the label to "Freezing" and adding it to any charts that I want to show freezing.

daytempdew.png
Reply all
Reply to author
Forward
0 new messages