Doh!!  Helps to edit the correct file!!!!  Now I've got the right indoor 
temperature!!  I'd moved my FineOffset console to a new position higher up 
the wall for better reception from the outdoor sensors, but the indoor temp 
was then 3 degrees too high as it's near the ceiling, so have had to resort 
to getting the temperature from a plant sensor instead!  Right, now I can 
change the text version of the webpages I just need to work out the best 
way of getting the plant temperature into the database as a new reading.  
What's the recommend3d way of adding data from a different source (my file) 
into a REC??

On Friday, 11 August 2017 05:13:36 UTC+3, Andrew Milner wrote:
>
> Gary
> Thanks for stepping in and letting Tom enjoy his break!!  The missing $ 
> was a posting typo.  Blowed if I can work out why it refuses to work!!
> Andrew
>  
>
> On Friday, 11 August 2017 05:08:34 UTC+3, gjr80 wrote:
>
>> Andrew,
>>
>> I know Tom has been enjoying the good weather... You are correct that 
>> each python line needs to start with #, "r" is the default so it will work 
>> with or without it. You will also need to put a $ in front of intemp, so 
>> something like:
>>
>> #set $fd = open("path to file", "r")
>> #set $intemp = $fd.readline()
>> #$fd.close()
>>
>> then just use $intemp in your template as you would with any other tag. 
>> If you want to be real slick could create a ValueHelper object from intemp 
>> and then you would have all the standard weeWX dot codes available for 
>> formatting/unit conversion, though that is starting to get complex with 
>> imports etc, probably best for an SLE.
>>
>> Gary
>>
>>
>> On Friday, 11 August 2017 03:18:00 UTC+10, Andrew Milner wrote:
>>>
>>> Tom
>>> I've got 
>>> #set $fd = open("path to file", "r")
>>> #set intemp = $fd.readline()
>>> #$fd.close()
>>>
>>> should it work??  Not sure from your answer where # is needed and 
>>> whether one just uses open or need to use open and specify the mode
>>>
>>>
>>>
>>> On Thursday, 10 August 2017 19:37:03 UTC+3, Tom Keffer wrote:
>>>
>>>> Super easy.
>>>>
>>>> #set $fd = open('myfile.txt)
>>>> $fd.read()
>>>> $fd.close()
>>>>
>>>> -tk
>>>>
>>>> On Thu, Aug 10, 2017 at 9:00 AM, Andrew Milner <andrew.s...@gmail.com> 
>>>> wrote:
>>>>
>>>>> I'm sure I can be done - but how??  I want to add some python code to 
>>>>> a template to read a data file when the html page is being created to 
>>>>> override a field currently obtained from the archive.  How do I change 
>>>>> the 
>>>>> template to do this simple piece of python code???
>>>>>
>>>>> -- 
>>>>> 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.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>

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