Read station data

92 views
Skip to first unread message

Ian Boag

unread,
Jan 16, 2020, 4:23:45 PM1/16/20
to weewx-user
I would like to read a copy of what went into index.html. wee_config-device --current gives me the current stuff, but the --history one just seem to go away for ever. I suppose I could create a very skeletal index.html.tmpl, swap it with the real one, run wee_reports then swap them back again ...... Seems a bit clunky. Ideally one would like a wee_config_device parameter that does it I guess 

Is there something I have missed? The reason I want to do this is I am running an airfield weather station and I want to do a preferred runway/crosswind calculation then insert it into the index.html file. See nzdv.avmet.nz. I do it at present py parsing the index.html file but that's ugly too.

gjr80

unread,
Jan 16, 2020, 4:58:38 PM1/16/20
to weewx-user
Hi,

Not sure I fully understand what you want. Are you just wanting to do some manipulation of some of the data that currently appears in the default index.html? If so the WeeWX tag system should do exactly what you want. For example, if you wanted to add the current temperature in C and the current humidity and display this value you could add the following to your template (.tmpl) file:

#set $nonsense = $current.outTemp.degree_C.raw + $current.outHumidity.raw
Temperature plus humidity = $nonsense

Would display:

Temperature plus humidity = 103.34567

With a bit more code you can format the number, add units etc.

Likewise you can access day max/min/avg, week, month or year aggregates for any of the recorded obs. Have a read of the WeeWX Customization Guide, particularly the Tags section (http://weewx.com/docs/customizing.htm#Tags) (but any of the Reports and Cheetah Generator sections would be relevant as well).

You certainly don’t want to be using the likes of wee_device, as you said way to clunky. The WeeWX report system is very powerful and should be able to do what you want. Of course, I could have completely misunderstood your intent....

Gary

vince

unread,
Jan 16, 2020, 5:22:56 PM1/16/20
to weewx-user
On Thursday, January 16, 2020 at 1:23:45 PM UTC-8, Ian Boag wrote:
Is there something I have missed? The reason I want to do this is I am running an airfield weather station and I want to do a preferred runway/crosswind calculation then insert it into the index.html file. See nzdv.avmet.nz. I do it at present py parsing the index.html file but that's ugly too.

It sounds like perhaps you want to do a calculation based on some parameters and display a couple resulting items in the index.html (and maybe save your calculated parameters in the database).  Is that close ?

If so, it would mean writing a small extension to do so.  Assuming you just want to pull data off your station's observations, this shouldn't be a big deal to cook up.
Message has been deleted

Glenn McKechnie

unread,
Jan 16, 2020, 5:41:08 PM1/16/20
to weewx...@googlegroups.com
Ian,

While not an answer to your actual question, are you aware of jordi's
Runway Plot Generator? It seems like it could be useful.

https://groups.google.com/d/msg/weewx-development/tk9_SIlVWqs/TmvKwTdWh3IJ

https://github.com/JWarmenhoven/weewx
> --
> 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/1456c508-a13e-4e49-a043-a66187eaa481%40googlegroups.com.
>


--


Cheers
Glenn

rorpi - read only raspberry pi & various weewx addons
https://github.com/glennmckechnie

Ian Boag

unread,
Jan 16, 2020, 5:47:45 PM1/16/20
to weewx-user


On Friday, January 17, 2020 at 10:23:45 AM UTC+13, Ian Boag wrote:
I would like to read a copy of what went into index.html. wee_config-device --current gives me the current stuff, but the --history one just seem to go away for ever. I suppose I could create a very skeletal index.html.tmpl, swap it with the real one, run wee_reports then swap them back again ...... Seems a bit clunky. Ideally one would like a wee_config_device parameter that does it I guess 

Is there something I have missed? The reason I want to do this is I am running an airfield weather station and I want to do a preferred runway/crosswind calculation then insert it into the index.html file. See nzdv.avmet.nz. I do it at present py parsing the index.html file but that's ugly too.

Having a bit of trouble working the reply function

I know how to make a file something like

Windspeed=$tag for wind speed
Wind Dir = $tag for wind dir
Wind Gust = $tag for wind gust

If I read the weewx docs properly - 
f I put this in skins/Standard and call it textstuff.tmpl then wee_reports should make a file textstuff and put it ..../weewx/index.html?

I want to read the data to make some changes to index.html before I upload it.  That bit I can manage - just parsing this stuff out of index,html is a pain 

gjr80

unread,
Jan 16, 2020, 6:04:35 PM1/16/20
to weewx-user
Some comments below.

Gary

On Friday, 17 January 2020 08:47:45 UTC+10, Ian Boag wrote:
I know how to make a file something like

Windspeed=$tag for wind speed
Wind Dir = $tag for wind dir
Wind Gust = $tag for wind gust


Sounds fine, you might do something like:

Windspeed = $current.windSpeed
Wind Dir = $current.windDir
Wind Gust = $current.windGust

which would give something like:

Windspeed = 4.8km/hr
Wind Dir = 335°
Wind Gust = 9.6km/hr

If I read the weewx docs properly - 
f I put this in skins/Standard and call it textstuff.tmpl then wee_reports should make a file textstuff and put it ..../weewx/index.html?

Not quite. You need to put textstuff.tmpl it in skins/Standard but also add it to the [CheetahGenerator] stanza in skins/Standard/skin.conf (refer the Cheetah generator section of the Customization Guide). This will see your file generated and saved in the same location as index.html not as part of it, index.html will not be changed in any way.
 

I want to read the data to make some changes to index.html before I upload it.  That bit I can manage - just parsing this stuff out of index,html is a pain 

If you want to make chnages to index.hrml with data from tags in another file why not just make the changes directly in index.html.tmpl ? Sounds like I am misundestanding what you are trying to do. Or is ther another index.html involved other than that generated by WeeWX?
 

Ian Boag

unread,
Jan 16, 2020, 10:14:44 PM1/16/20
to weewx-user
I don't need to store anything in the database. It's just a "now" site for an airfield using data from a FO station. So the index.html is pretty simple. 

After wee_reports, I pick the wind/gust speed/direction out of the generated html.  Then I combine that with runway (direction) info to figure which runway to use and what the crosswind is. I make up an html line for that and insert it into the previously generated one.

Picking values out of the html file i a bit of a pain ..... so .....
I made up a template Wind Speed!$wind speed tag,Wind Gust!$wind gust tag etc so the output is a CSV of <Tag!value> pairs. Easy to read

I put this template (called 'sparse') into /home/weewx/skins/Standard  (which is where my index.html.tmpl lives)

Copy sparse to index.html.tmpl and run wee_reports. Change name of generated (CSV) index.html to 'sparse'
Copy index.master (master copy of real template) to index.html.tmpl and run wee_reports

OK OK - it's a kludge .....
There's a bit of shifting files beween folders of course

Ian Boag

unread,
Jan 16, 2020, 10:24:28 PM1/16/20
to weewx-user
Thanks/ I didn't know about the CheetahGenerator stuff.

The thing I am doing here is combining WS data (Wind stuff) with external data (runway direction) to get derived values (preferred runway and crosswind)

Ian Boag

unread,
Jan 17, 2020, 2:58:10 PM1/17/20
to weewx-user
Thanks to all. I made a template index.txt.tmpl in ...../skins/Standard. Added a new group [[[index_txt]]] with that tmpl in skin.conf. Bingo .... all goes like it should. 
Reply all
Reply to author
Forward
0 new messages