Hi,

Creating (and putting to use) a new template file (.tmpl) is a pretty 
straight forward process in itself, though depending on how sophisticated 
your content it can be quite involved. The easiest approach is to create a 
new .tmpl file and add it to an existing skin. You can create a new .tmpl 
file and have it run as part of the Standard skin as follows:

- Create a new file, newfile.txt.tmpl, on your weeWX machine in the 
/home/weewx/skins/Standard directory (this is for a setup.py install, if 
you installed using a different method you probably want the 
/etc/weewx/skins/Standard directory). This will ultimately result in a file 
newfile.txt being generated. How you create/edit the file will depend on 
your setup and what you are comfortable using, you might use vi or nano if 
workign from the linux command line, you might use a graphical editor on 
the linux or windows desktop. Whatever you do use a text editor and not a 
word processor, using a word processor will only lead to grief.

- Enter whatever text and tags you want in the file. Tags start with a 
dollar sign eg $current.outTemp. You can find more details on the available 
tags in the Tags section <http://weewx.com/docs/customizing.htm#Tags> of 
the Customization Guide <http://weewx.com/docs/customizing.htm>. Any text 
in the file not preceded with a $ will be displayed as is in the resulting 
file. So to have our file display 'The temperature is ####' where #### is 
the current temperature with default units we might use the following line 
in newfile.txt.tmpl:

The temperature is $current.outTemp

- Once you are happy with your template save the file. Note it might be 
easier to start out small and build to your final template content - much 
easier to troubleshoot.

- To have your template generate a file you need to include it in the 
[CheetahGenerator] stanza of a skin.conf, in this case we have used the 
Standard skin so we need to 'add' our template to the the [CheetahGenerator] 
stanza of skin.conf in the /home/weewx/skins/Standard (or 
/etc/weewx/skins/Standard) directory. Edit skin.conf and locate the 
[CheetahGenerator] stanza. You should find a [[ToDate]] stanza under this. 
We need to add a new [[[]]] stanza, something like the following should do:

        [[[new]]]
            template = newfile.txt.tmpl
    
- The name in the [[[]]] can be anything you like, just don't use something 
that is already in use.

- Save skin.conf. If weeWX is running then during the next report cycle you 
should see a file newfile.txt appear in the same directory as you other 
Standard skin files.

- If it is not there have a look in your weeWX log for errors, if there are 
errors let us know what they are or fix them yourself. If no errors and no 
file then in weewx.conf set debug=1, stop/start weeWX and then have a look 
in the log.

That is a fairly basic run through of creating a simple template and have 
it generate some output, where you take it from here is up to you; you can 
create a new skin, add extra tags, format the tag output, create custom 
tags, change the destination of the created file. Reading through the 
Customization Guide, especially the Customizing Reports 
<http://weewx.com/docs/customizing.htm#customizing_reports> and The 
Standard skin.conf <http://weewx.com/docs/customizing.htm#standard_skin> 
sections are your best friends.

Gary


On Saturday, 7 October 2017 07:20:51 UTC+10, Damjan Hajsek wrote:
>
> Sorry don't know how to make tpl file or what to put in that file. I am 
> not a programmer so have no clue what to do.
>
> Dne petek, 06. oktober 2017 23.05.43 UTC+2 je oseba vince napisala:
>>
>> On Friday, October 6, 2017 at 12:25:56 PM UTC-7, Damjan Hajsek wrote:
>>>
>>> I am trying to do ordinarry text file with data so he can pull out 
>>> whatever he want, temperature, preassure, etc? So he can put that on his wb 
>>> site.
>>> Have you any advice how to do this easiest way?
>>> Is there some instructions how to create txt.tmpl file?
>>>
>>>
>>>
>> same way you create an anything_else.tmpl file
>>  
>>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to