How to show a barometer trend (rising, falling, steady)

170 views
Skip to first unread message

Greg Ledet

unread,
Feb 8, 2020, 10:45:01 AM2/8/20
to weewx-user
Hi guys, first post in the group and a rather new user to weewx as a whole.

Many moons ago, I used Cumulus connected to my old wx station and it had a great feature that would update Twitter once per hour with the weather info from the station. When I moved on to a new station back in 2014, I lost that functionality. A couple weeks ago, I decided to get off my butt and recreate it, which brought me to weewx. I figured if I could get that data onto a linux box, then there would be nothing stopping me from creating a post on Twitter with it. 

The account in question is @PowellOHWeather. You can see that posts stopped on Oct 3, 2014 and just picked back up yesterday, but it's missing one piece of data, and that's the barometer trend. I haven't figured out how to get the barometer trend into the post, so I've come to you for assistance. Does anyone have any ideas?

The old posts looked like this: 

Wind 11.4 mph S. Barometer 29.27 in, Falling slowly. Temperature 69.4 °F. Rain today 0.15 in. Humidity 70%

I have the new posts looking like this so far: 

Wind 0.2 mph SW. Barometer 29.88 in. Temperature 27.5 ºF. Rain today 0.00 in. Humidity 94.0%.

I want to get that barometer falling rapidly, falling slowly, rising rapidly, rising slowly, or steady into the posts, but can't figure out how to do it. I'm using the weewx-twitter extension that I found in this group, and here's the config I'm using.

[StdRESTful]
    [[Twitter]]
        oauth_token_secret = xxxx
        oauth_token = xxxx
        app_key_secret = xxxx
        app_key = xxxx
        post_interval = 3600
        format = "Wind {windSpeed:%.1f} mph {windDir:ORD}. Barometer {barometer:%.2f} in. Temperature {outTemp:%.1f} ºF. Rain today {rain:%.2f} in. Humidity {outHumidity:%.1f}%."

p q

unread,
Feb 8, 2020, 10:57:18 AM2/8/20
to weewx...@googlegroups.com
Start here: http://www.weewx.com/docs/customizing.htm#_____________Tag_$trend_________ 

I don't know how you'd get it as text but this should get you started.
 

--
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/8286e5eb-296d-47c0-8906-ba175498f387%40googlegroups.com.


--
Peter Quinn
(415)794-2264

Thomas Keffer

unread,
Feb 8, 2020, 11:11:48 AM2/8/20
to weewx-user
You can add the text in the template. The key is to test for the raw value, using the .raw suffix. Something like (NOT TESTED):

#set trend_raw = $trend.barometer.raw

Wind $current.windSpeed Barometer $current.barometer #slurp
#if $trend_raw < -0.05
falling rapidly#slurp
#elif $trend_raw < -0.01
falling slowly#slurp
#elif $trend_raw < 0.005
steady#slurp
#elif $trend_raw < 0.01
rising slowly#slurp
#else
rising rapidly#slurp
Temperature $current.outTemp Rain today $day.rain.sum Humidity $current.outHumidity

Adjust values as you see fit. The #slurp directive prevents a newline from being injected.

See the Language overview in the Cheetah User's Guide for the full template syntax.

-tk


On Sat, Feb 8, 2020 at 7:45 AM Greg Ledet <gregor...@gmail.com> wrote:

Greg Ledet

unread,
Feb 8, 2020, 11:20:34 AM2/8/20
to weewx-user
THanks Tom. I'll dig into that and see what I can come up with.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx...@googlegroups.com.

mwall

unread,
Feb 8, 2020, 11:39:44 AM2/8/20
to weewx-user

On Saturday, February 8, 2020 at 11:11:48 AM UTC-5, Thomas Keffer wrote:
You can add the text in the template. The key is to test for the raw value, using the .raw suffix. Something like (NOT TESTED):

#set trend_raw = $trend.barometer.raw

that works for cheetah templates, but the weewx-twitter extension does not use cheetah.  it uses regex to match data fields.

that means you are limited to the fields in loop packets or archive records.

the 'trend' variable is available only in cheetah templates.

sorry!  when i wrote weewx-twitter:

- i was unsure of all the cheetah behavior
- i was going for simplicity, not full reporting functionality
- consistency with the rest of the weewx reporting infrastructure was not in my scope
- i explicitly did *not* want db queries to happen in the tweeter

as a result, tk has grief every time someone mentions the weewx-twitter extension :/

anyone want to do a merge request to make weewx-twitter support cheetah variables?

m

Greg Ledet

unread,
Feb 8, 2020, 12:16:46 PM2/8/20
to weewx-user


On Saturday, February 8, 2020 at 11:39:44 AM UTC-5, mwall wrote:

anyone want to do a merge request to make weewx-twitter support cheetah variables?

m

If I had any idea what I was doing, I'd give it a shot, but I'm a network security guy, not a programmer.

DaveStLou

unread,
Oct 21, 2020, 7:41:23 PM10/21/20
to weewx-user
For many months I've been using the formula below in a twitter template I've created today it started throwing this error.

Oct 21 16:00:23 pi4 weewx[8659] ERROR weewx.cheetahgenerator: Generate failed with exception '<class 'TypeError'>'
Oct 21 16:00:23 pi4 weewx[8659] ERROR weewx.cheetahgenerator: **** Ignoring template /etc/weewx/skins/Twitter/tweet.txt.tmpl
Oct 21 16:00:23 pi4 weewx[8659] ERROR weewx.cheetahgenerator: **** Reason: '<' not supported between instances of 'NoneType' and 'float'
Oct 21 16:00:23 pi4 weewx[8659] ERROR weewx.cheetahgenerator: ****  Traceback (most recent call last):
Oct 21 16:00:23 pi4 weewx[8659] ERROR weewx.cheetahgenerator: ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 322, in generate
Oct 21 16:00:23 pi4 weewx[8659] ERROR weewx.cheetahgenerator: ****      unicode_string = compiled_template.respond()
Oct 21 16:00:23 pi4 weewx[8659] ERROR weewx.cheetahgenerator: ****    File "_etc_weewx_skins_Twitter_tweet_txt_tmpl.py", line 106, in respond
Oct 21 16:00:23 pi4 weewx[8659] ERROR weewx.cheetahgenerator: ****  TypeError: '<' not supported between instances of 'NoneType' and 'float'

Not sure why it popped up all of a sudden except maybe there's a value in $current.barometer.raw that doesn't work with this expression.

I appreciate any help or direction. Thanks!

Tom Keffer

unread,
Oct 21, 2020, 8:17:46 PM10/21/20
to weewx-user
In WeeWX, the value None is used to signal missing or bad data. You must be constantly vigilant to its possible presence. 

Can't help you on why the value went to None.

--
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.

DaveStLou

unread,
Oct 21, 2020, 9:30:10 PM10/21/20
to weewx-user
I'm suspect it's related to a recent power outage that I recovered from. Some how bad data has found it's way into the database. 
Reply all
Reply to author
Forward
0 new messages