Using SQLite views for calculatet Data

90 views
Skip to first unread message

Max Malycha

unread,
Dec 26, 2022, 4:13:39 AM12/26/22
to weewx-user
Hi together!
I wish you all a Merry Christmas! Hope so Father Christmas brought you everything you need!

But now: 
I'm using a new hardware for the station behause my old WS1 form ADS broke down. So now I have a GW1000 (from german distributor Froggit). The driver works works fine (thanks to gjr80 for his work!), I have adapted my old template (mix of SteelSeries and Belchertown 0.9 –> here) to show the data in a way my family likes. Now I  want to add an additional data in the highcharts graphs with the wind (Beaufort). So first I've created a calculated column in archive but my WeeWX (3.9.1) throws the error that the word "AS" is not know ... OK, sqlite knows the generated columns beginning in 3.31 - so I think the used class in python 7.2 (CentOS 7)  is too old for this functionality. The column is removed and the station runs again.

Now  I've added a view with two columns: dateTime and beaufort. The view works correct but how to get the data in the json-file?
In WeeWX docs I found a description for additional binding:
    wx_manager = db_lookup() # Get default binding 
    other_manager = db_lookup(data_binding='some_other_binding') # Get an explicit binding
Is it enough btw required to ad a binding in weewx.conf? Does it work with just to columns?  Or is there a way to calculate the wind from m/s to bft in the json-file?

I've tried to upgrade the WeeWX to the actual version, but the rpm does not show the appTemp in my template. So I had to make a downgrade - every version above mine does not work :(

Now I'm in hope for swarm knowledge :)

Best regards from Good old Germany
Max

Tom Keffer

unread,
Dec 26, 2022, 7:41:28 AM12/26/22
to weewx...@googlegroups.com
I am not familiar with the skins you are using, but why store beaufort in the database? Starting with V4.2, WeeWX treats it as just another unit, albeit a funny one. You need only override the units.

For example, you can say:

<p>The wind speed is $current.windSpeed.knot, or $current.windSpeed.beaufort on the beaufort scale.</p>

That will give you something like:

The wind speed is 8.3 kn, or 3 on the beaufort scale.

-tk

--
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/d4600d0c-970c-409b-bd39-9b7e8f32c9den%40googlegroups.com.

salinois

unread,
Dec 26, 2022, 9:27:16 AM12/26/22
to weewx...@googlegroups.com

hello together,

I wish you also a merry christmas and a happy new year.

patrick

murksmax

unread,
Dec 26, 2022, 10:04:36 AM12/26/22
to weewx-user
tke...@gmail.com schrieb am Montag, 26. Dezember 2022 um 13:41:28 UTC+1:
I am not familiar with the skins you are using, but why store beaufort in the database? Starting with V4.2, WeeWX treats it as just another unit, albeit a funny one. You need only override the units.

For example, you can say:

<p>The wind speed is $current.windSpeed.knot, or $current.windSpeed.beaufort on the beaufort scale.</p>

That will give you something like:

The wind speed is 8.3 kn, or 3 on the beaufort scale.

Hi Tom,
thanks for your reply, but as I wrote im my origin post I cannot use a version above 3.9.1 because I don't get appTemp in the never version. I've tried all available rpm's for CentOS/RH but no one works for me, there is no appTemp stored in my db :(

The next point is:
Looking in the specifications book my wife gave me I have to use an analog display permanently actualised (SteelSeries) for wind in Beaufort and show the historical data in m/s in graphs. 
This is very nice because you can see actual wind changes in bft. on a clock instrument with movies fingers and the real max/min values on a graph. (That is useful because the bft.-scale  ends with 12 but the wind may be faster than 34.x m/s).

So I thought to work with a calculated column or a wiew - there is no permanent saving of the bft value, it is just a value given on request.

Does weewx work with MySQL 5.7 with a calculated colum in table archive? Using MySQL would be a possibility but for the use with weewx ist's a little bit oversized - usually sqlite would be enough...

So: next idea, please ;)

Best regards 
Max

gjr80

unread,
Dec 26, 2022, 2:40:57 PM12/26/22
to weewx-user
On Tuesday, 27 December 2022 at 01:04:36 UTC+10 max.m...@googlemail.com wrote:
I cannot use a version above 3.9.1 because I don't get appTemp in the never version. I've tried all available rpm's for CentOS/RH but no one works for me, there is no appTemp stored in my db :(

This is the problem I would be trying to solve first. There is nothing special about appTemp, it's just another derived observation, and if it's in your db schema and in your archive records WeeWX will save it to database. Basically, if WeeWX V4.x runs on your machine it will be able to calculate and store appTemp, if it doesn't it will be fixable but we will need something more than "it doesn't work" to help.

I think you will be making one or more rods for your back if you go down the path of a calculated column or view.

Gary

Reply all
Reply to author
Forward
0 new messages