Page 1 of 2
WEBTAGS temperature compared to yesterday
Posted: Wed 25 Nov 2020 5:43 pm
by ChaserPeek
Hi, can I show a tag with value of temperature compared to yesterday ? Example: today at h:xx:xx we have 15 °C, yesterday we had at same time h:xx:xx 13 °C, so I would have webtags (or function) that print "-2" compared to yesterday
Thanks, regards.
Re: WEBTAGS temperature compared to yesterday
Posted: Wed 25 Nov 2020 6:03 pm
by PaulMy
Hi,
I am sure there is a way with a little code knowledge...
I've been using this for many years which was shared here on the forum by acer2
http://komokaweather.com/weather/obe.htm
This not exactly what you are asking but should give you an idea with the following code:
Code: Select all
<table class="hoverTable" style="table border=0;bordercolor=#678090;width:100%;border-collapse: collapse; border-spacing: 0;" >
<tr>
<TD style="background-color: #a2b1bd">Date - Time<br />EST</td>
<TD style="background-color: #a2b1bd">Temperature<br />°C</td>
<TD style="background-color: #a2b1bd">Dew Point<br />°C</td>
<TD style="background-color: #a2b1bd">Humidity<br />%</td>
<TD style="background-color: #a2b1bd">Wind Speed<br />km/h</td>
<TD style="background-color: #a2b1bd">Wind Gust<br />km/h</td>
<TD style="background-color: #a2b1bd">Wind<br />Direction</td>
<TD style="background-color: #a2b1bd">Barometer<br />mb</td>
<TD style="background-color: #a2b1bd">Rain Today<br />mm</td>
</tr>
<tr>
<td><#RecentTS m=1 format="%d - hh:mm tt"></td>
<td><#RecentOutsideTemp m=1></td>
<td><#RecentDewPoint m=1></td>
<td><#RecentHumidity m=1></td>
<td><#RecentWindSpeed m=1></td>
<td><#RecentWindGust m=1></td>
<td><script type="text/javascript">var WB="<#RecentWindAvgDir m=1>"; document.write(wDL(WB));</script></td>
<td><#RecentPressure m=1></td>
<td><#RecentRainToday m=1></td>
</tr>
Enjoy,
Paul
Re: WEBTAGS temperature compared to yesterday
Posted: Wed 25 Nov 2020 10:37 pm
by ChaserPeek
Thanks Paul.
well, webtags template is good for me and I use it yet.
My question is: I would print the difference of temperature between today and yesterday. I think webtag <#RecentOutsideTemp d=1> is good: it print recent temperature 24h ago.
But, <#RecentOutsideTemp d=1> print the value of 24h ago. I would print the value of difference, example +3 ... or -4
I hope I explain good for you.
Regards.
Re: WEBTAGS temperature compared to yesterday
Posted: Wed 25 Nov 2020 10:58 pm
by PaulMy
Sorry, I can't help with actual coding. It was a html script provided by acer2 and I can follow the basics but that is all. I presume to show the difference, i.e. today minus yesterday, would need some other coding such as PHP but that is beyond my knowledge.
Enjoy,
Paul
Re: WEBTAGS temperature compared to yesterday
Posted: Wed 25 Nov 2020 11:05 pm
by ChaserPeek
Yes Paul, I think so. Maybe some script are needed, and I would know how can I process this difference.
new php file ?
function in realtime.txt file ?
Maybe admin of forum can help me
thanks

Re: WEBTAGS temperature compared to yesterday
Posted: Thu 26 Nov 2020 9:46 am
by mcrossley
If you have the variables in PHP, then you could do something like...
Code: Select all
<?php echo "diff = " . ($var2 - $var1); ?>
Re: WEBTAGS temperature compared to yesterday
Posted: Thu 26 Nov 2020 10:01 am
by dazza1223
or somthing like this Today Yesterday the One Year Ago is SQL base
https://www.davisworthing.co.uk/today_yes_year.php
Re: WEBTAGS temperature compared to yesterday
Posted: Thu 26 Nov 2020 5:00 pm
by ChaserPeek
mcrossley wrote: ↑Thu 26 Nov 2020 9:46 am
If you have the variables in PHP, then you could do something like...
Code: Select all
<?php echo "diff = " . ($var2 - $var1); ?>
Excuse me Mcrossley, can I add this function in my custom template.txtT ?
Re: WEBTAGS temperature compared to yesterday
Posted: Fri 27 Nov 2020 12:10 am
by beteljuice
It's very hard to give you any definitive replies because we don't know how page is going to be constructed !
You also give the throwaway words PHP and realtime.txt and we don't know your knowledge base.
If the page is being constructed by Cumulus as a
Template page
AND being renamed on regular upload to ?????.php
Then something like ...
Temp: <#temp><#tempunit> (ΔT24 <?php echo (<#temp> - <#RecentOutsideTemp d=1>); ?>)
... but, if you have a 'static' php webpage that is being updated by realtime.txt then you've got to find another way
You are going to have to get the value of <#RecentOutsideTemp d=1> upto the web, then by php include and / or javascript ajax do the calculation / display.
Re: WEBTAGS temperature compared to yesterday
Posted: Fri 27 Nov 2020 8:59 am
by sfws
ChaserPeek wrote: ↑Wed 25 Nov 2020 5:43 pm
Hi, can I show a tag with value of temperature compared to yesterday ?
Example: today at h:xx:xx we have 15 °C, yesterday we had at same time h:xx:xx 13 °C, so I would have web tags (or function) that print "-2" compared to yesterday
Thanks, regards.
ChaserPeek wrote: ↑Wed 25 Nov 2020 10:37 pm
I think webtag <#RecentOutsideTemp d=1> is good: it print recent temperature 24h ago.
But, I would print the value of difference, example +3 ... or -4
I hope I explain good for you.
Regards.
The following is not elegant coding, it is not to coding standards, but it is very simple and would work in your
custom template.txtT, so try it:
Code: Select all
<script>document.write((<#RCtemp> - <#RCRecentOutsideTemp d=1>));</script>)
(No use of PHP above, it uses JavaScript).
EDIT: RC prefix added to ensure that numbers understood by JavaScript in any environment using decimal commas
Re: WEBTAGS temperature compared to yesterday
Posted: Fri 27 Nov 2020 11:28 am
by ChaserPeek
Good morning and thanks for your reply.
For beteljuice :
yes, I have some basics of PHP and I try your function. I explain better what I would want.
I would have a client.txt with some vaules. I created a template with some webtags, like this:
<#tempTH rc=y>|<#tempTL rc=y>|<#temp rc=y>|<#TtempTH rc=y>|<#TtempTL rc=y>|<#tempYH rc=y>|<#tempYL rc=y>|<#TtempYH rc=y>|<#TtempYL rc=y>|<#avgtemp rc=y>|<#avgtempY rc=y>|<#apptemp rc=y>|<#heatindex rc=y>|s|
<?php echo (<#temp rc=y> - <#RecentOutsideTemp d=1>); ?>|
Please check the function in bold. Then I created new extra-web file and Cumuls generates new txt file like this:
23.6|19.4|20.7|09:30|07:25|20.8|18.7|23:49|20:45|20.6|19.7|20.9|20.7|s|
<?php echo 20.7 - 20.7;?>
Well, I think Cumulus not "parse" the php function and rewrite the "text" because it is not a webtag.
So, because of I would have a final TXT file, and not a "pure" php to call with http, Cumulus can parse the function ?
For sfws:
I will try your function. I hope Cumulus will parse it !

Re: WEBTAGS temperature compared to yesterday
Posted: Fri 27 Nov 2020 12:57 pm
by beteljuice
If by parse you mean execute - then No - Cumulus is unaware of php or javascript.
What you have created there is a | delimited list of data.
You already have <#temp rc=y> in field #2 so you just need to add <#RecentOutsideTemp d=1> to the end (field #14)
but what is reading this data - php or js ???
your math is simply array[2] - array[14]
However: I note in your test, the values appear to be the same ?
Re: WEBTAGS temperature compared to yesterday
Posted: Fri 27 Nov 2020 9:06 pm
by ChaserPeek
Well, values are the same (similar) because the Davis station is in testing mode in my house, and I'm searching alternative solution of other software.
If cumulus not execute PHP, I think I must search another solution to have the value required in my data sequence.
My big problem is that I need a TXT file because the web software read the sequence and print the values by specific format
Maybe I must do 2 step
1) create the value in PHP. I must execute PHP via hosting to create the value required.
2) I must insert this value in TXT file. Maybe I must execute a second PHP that elaborates the txt.
For you it's a good idea ?
Re: WEBTAGS temperature compared to yesterday
Posted: Sat 28 Nov 2020 12:01 am
by beteljuice
but what is ..
the web software read the sequence and ...
Why can't that prog handle the extra var and calculation ????
Re: WEBTAGS temperature compared to yesterday
Posted: Sat 28 Nov 2020 12:43 pm
by Mapantz
ChaserPeek wrote: ↑Fri 27 Nov 2020 9:06 pm
If cumulus not execute PHP, I think I must search another solution to have the value required in my data sequence.
PHP is a server-side language.