Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

WEBTAGS temperature compared to yesterday

From build 3044 the development baton passed to Mark Crossley. Mark has been responsible for all the Builds since. He has made the code available on GitHub. It is Mark's hope that others will join in this development, but at the very least he welcomes your ideas for future developments (see Cumulus MX Development suggestions).

Moderator: mcrossley

ChaserPeek
Posts: 40
Joined: Sun 22 Nov 2020 6:53 pm
Weather Station: Davis Vp2
Operating System: Windows10

WEBTAGS temperature compared to yesterday

Post 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.
User avatar
PaulMy
Posts: 4355
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: WEBTAGS temperature compared to yesterday

Post 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 />&deg;C</td>
		<TD style="background-color: #a2b1bd">Dew Point<br />&deg;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
VP2+
C1 www.komokaweather.com/komokaweather-ca
MX https://komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX https://komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX https:// komokaweather.com/cumulusmx4/index.htm
Image
ChaserPeek
Posts: 40
Joined: Sun 22 Nov 2020 6:53 pm
Weather Station: Davis Vp2
Operating System: Windows10

Re: WEBTAGS temperature compared to yesterday

Post 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.
User avatar
PaulMy
Posts: 4355
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: WEBTAGS temperature compared to yesterday

Post 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
VP2+
C1 www.komokaweather.com/komokaweather-ca
MX https://komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX https://komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX https:// komokaweather.com/cumulusmx4/index.htm
Image
ChaserPeek
Posts: 40
Joined: Sun 22 Nov 2020 6:53 pm
Weather Station: Davis Vp2
Operating System: Windows10

Re: WEBTAGS temperature compared to yesterday

Post 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 :D

thanks ;)
User avatar
mcrossley
Posts: 14384
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: WEBTAGS temperature compared to yesterday

Post by mcrossley »

If you have the variables in PHP, then you could do something like...

Code: Select all

<?php echo "diff = " . ($var2 - $var1); ?>
User avatar
dazza1223
Posts: 910
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Pro 2 plus
Operating System: Raspberry pi 4 (4gb)
Location: Worthing
Contact:

Re: WEBTAGS temperature compared to yesterday

Post by dazza1223 »

or somthing like this Today Yesterday the One Year Ago is SQL base

https://www.davisworthing.co.uk/today_yes_year.php
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
ChaserPeek
Posts: 40
Joined: Sun 22 Nov 2020 6:53 pm
Weather Station: Davis Vp2
Operating System: Windows10

Re: WEBTAGS temperature compared to yesterday

Post 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 ?
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: WEBTAGS temperature compared to yesterday

Post 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> (&Delta;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.
Image
......................Imagine, what you will KNOW tomorrow !
sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: WEBTAGS temperature compared to yesterday

Post 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
Last edited by sfws on Fri 27 Nov 2020 3:03 pm, edited 2 times in total.
ChaserPeek
Posts: 40
Joined: Sun 22 Nov 2020 6:53 pm
Weather Station: Davis Vp2
Operating System: Windows10

Re: WEBTAGS temperature compared to yesterday

Post 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. :mrgreen:

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. :groan:

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 ! :bash:
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: WEBTAGS temperature compared to yesterday

Post 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 ?
Image
......................Imagine, what you will KNOW tomorrow !
ChaserPeek
Posts: 40
Joined: Sun 22 Nov 2020 6:53 pm
Weather Station: Davis Vp2
Operating System: Windows10

Re: WEBTAGS temperature compared to yesterday

Post 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 ?
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: WEBTAGS temperature compared to yesterday

Post by beteljuice »

but what is ..
the web software read the sequence and ...
Why can't that prog handle the extra var and calculation ????
Image
......................Imagine, what you will KNOW tomorrow !
Mapantz
Posts: 1992
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: WEBTAGS temperature compared to yesterday

Post 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.
Image
Post Reply