Page 1 of 1

How use TempChangeLastDay ?

Posted: Fri 28 Nov 2014 2:05 pm
by Areecki
Hello
I added new tags on the website, but I would love to have another one.
Currently I have the following: #temp>, <# RecentOutsideTemp d = 1>, <# TempChangeLastHour>, # temptrend>, <# avgtemp>, # RecentOutsideTemp d = 7>.
I miss the mark "change in temperature for the last day. More specifically, the temperature difference between the current temperature and the temperature of which was 24h00m00s ago. That is something on the principle of operation of the <#TempChangeLastHour> only <#TempChangeLastDay>. Is there such a tag? Is it possible to write on an equation of the type: <#temp> - <# RecentOutsideTemp d = 1> = <#TempChangeLastDay>?

Re: How use TempChangeLastDay ?

Posted: Fri 28 Nov 2014 2:17 pm
by steve
You could do that with a bit of JavaScript. Something like

<script>document.write(<#temp> - <#RecentOutsideTemp d=1>)</script>

Re: How use TempChangeLastDay ?

Posted: Fri 28 Nov 2014 2:24 pm
by Areecki
Like that ?
Screen : http://scr.hu/0fqx/pxxbe

Re: How use TempChangeLastDay ?

Posted: Fri 28 Nov 2014 2:25 pm
by steve
Yes, but actually you might need some rounding:

<script>document.write((<#temp> - <#RecentOutsideTemp d=1>).toFixed(1))</script>

Re: How use TempChangeLastDay ?

Posted: Fri 28 Nov 2014 2:34 pm
by Areecki
Now I have : http://scr.hu/0fqx/j2yrm
But temp now is -2,7 C , last24 h = +0,2
Script announced on the website 2,0 C and I would like to count the exact changes or -2.9 C (0.2 - (-2.7) = -2.9 C.
Script work like that :( ---> http://scr.hu/0fqx/p85p5

Re: How use TempChangeLastDay ?

Posted: Fri 28 Nov 2014 2:45 pm
by steve
Do you use commas for decimals? If so, you'll need

<script>document.write((<#RCtemp> - <#RCRecentOutsideTemp d=1>).toFixed(1))</script>

Re: How use TempChangeLastDay ?

Posted: Fri 28 Nov 2014 2:48 pm
by Areecki
Commas appear on the site and program.
Okay I'll try.

Re: How use TempChangeLastDay ?

Posted: Fri 28 Nov 2014 2:51 pm
by steve
You might find that the result comes out with a decimal point rather than a comma. There are probably ways around that, but I don't know what they are.

Re: How use TempChangeLastDay ?

Posted: Fri 28 Nov 2014 2:53 pm
by Areecki
Code screen : http://scr.hu/0fqx/1g25e
WWW screen : http://scr.hu/0fqx/xw3ha
IT WORKS !!! :mrgreen: :mrgreen: :mrgreen:

OMG, thank you very much it works.
Created tag: Change of temperature for the last 24.
In this way you can create a change is not only 1 but any other.
Just use #temp> and #RecentOutsideTemp "x" = "y">

Thought about to add a tag: Temperature year ago? So that displayed a temperature of 16:00 28.XI.2013?

Re: How use TempChangeLastDay ?

Posted: Fri 28 Nov 2014 3:23 pm
by steve
To change the decimal point to a comma, this might work:

<script>document.write((<#RCtemp> - <#RCRecentOutsideTemp d=1>).toFixed(1).toString().replace('.',','))</script>

Re: How use TempChangeLastDay ?

Posted: Fri 28 Nov 2014 3:55 pm
by Areecki
I do not need to change the decimal point. Such data are right for me, but they can be useful to someone else.
1. Is it possible to somehow pull the temperature that was a year ago at the same time?
2. Is it possible to semehow pull the change temperetaure in the last 10 minutes or 30 minutes ?

Re: How use TempChangeLastDay ?

Posted: Fri 28 Nov 2014 4:05 pm
by steve
Areecki wrote:1. Is it possible to somehow pull the temperature that was a year ago at the same time?
No, because it would require the storing in memory of a lot of values (all of the values for the last year). Otherwise it would have to start searching through the log file for a year ago, and that would be very inefficient and slow. It really needs the data to be in a proper database rather than flat files, so the values can be extracted efficiently.
2. Is it possible to semehow pull the change temperetaure in the last 10 minutes or 30 minutes ?
Do the same as you did for a day ago, but instead of d=1 use m=10 or m=30?

Re: How use TempChangeLastDay ?

Posted: Fri 28 Nov 2014 4:08 pm
by Areecki
1. OK
2. : <script>document.write((<#RCtemp> - <#RCRecentOutsideTemp m=30>).toFixed(1))</script>
But must I have in the web display to RecentOutsideTemp m=30 ? or only script ?

Re: How use TempChangeLastDay ?

Posted: Fri 28 Nov 2014 4:10 pm
by steve
You just need it in that script.

Re: How use TempChangeLastDay ?

Posted: Fri 28 Nov 2014 4:18 pm
by Areecki
Yea !

<script>document.write((<#RCtemp> - <#RCRecentOutsideTemp m=30>).toFixed(1))</script> or m=10 or d=2 or another ; )
Screen : http://scr.hu/0fqx/yjt0s