Page 1 of 1
Problems creating a template using the Meteohub tags
Posted: Tue Apr 07, 2015 7:38 pm
by MrPippoTN
Hello everyone, I just created a personal template for my weather station's website, using the Meteohub tags. The page that I made is here:
http://www.meteotrentinoaltoadige.it/st ... /meteo.htm
There are a few things I do not understand. When I use the tag [actual_localdate], I get a value like this: 20150407192022
Well, I think that this value is bad to see... I would like something more elegant, like: "07/04/2014, 19:21".
I have the same problems with min and max values, like [day1_th0_tempmin_time] ... 20150407072032 is really rough.
Another problem: humidity. When I use [actual_th0_hum_rel] I've no problem: I get, for example, 56% with no decimal numbers, that's perfect.
But if I use [day1_th0_hummin_rel] I get 63.0% WHY .0? I don't need it this decimal number.
Similar problem with the rain. Example: [day1_rain0_total_mm], result: 1.20 mm
Well... I don't want two decimal numbers in daily, monthly and total rain. One decimal number is enough.
Can you help me, please?
Re: Problems creating a template using the Meteohub tags
Posted: Tue Apr 07, 2015 10:32 pm
by admin
The manual explains how to decompose strings:
http://www.meteohub.de/files/meteohub-v4.7en.pdf
For the number of decimals I don't have a solution for you.
There is one for Meteobridge and Meteoplug, but I don't think Meteohub can do that.
Re: Problems creating a template using the Meteohub tags
Posted: Tue Apr 07, 2015 11:46 pm
by MrPippoTN
admin wrote:The manual explains how to decompose strings:
http://www.meteohub.de/files/meteohub-v4.7en.pdf
For the number of decimals I don't have a solution for you.
There is one for Meteobridge and Meteoplug, but I don't think Meteohub can do that.
Thank you for the answer but I can't find where the manual explains how to decompose strings in order to customize date.
Could you give me an example, please?
Let's take [day1_th0_tempmin_time]. I just want to stamp HH:mm
How can I do that?
Re: Problems creating a template using the Meteohub tags
Posted: Tue Apr 07, 2015 11:53 pm
by admin
Have a look at section 3.4
"#" allows to specify a sub string. Assume that variable "actual_thb0_fc_text" contains "Mostly_clear_and_cooler.". With "[actual_thb0_fc_text#CE]" a substring starting at position 3 (C is the third character in the alphabet) and ending at position 5 (E is the fifth character in the alphabet) is returned: "stl". A blank as position marker would point to the beginning resp. ending of the string. "#" can be combined with other control characters. Example: "[actual_thb0_fc_text@4#AD:none]" returns the first 4 letters of the fourth word in the sentence: "cool" (or "none" if there is the selected string is empty for any reason).
[day1_th0_tempmin_time#IJ]:[day1_th0_tempmin_time#KL] should serve your needs.
Re: Problems creating a template using the Meteohub tags
Posted: Wed Apr 08, 2015 12:36 am
by cgn
Use a php-function to set decimals.
Example:
Replace [day1_th0_hummin_rel]% with
<? echo number_format([day1_th0_hummin_rel],$decimals=0); ?>%
Then in the meteohub "Graph uploads" section set the filename to *.php instead of *.html
Re: Problems creating a template using the Meteohub tags
Posted: Wed Apr 08, 2015 12:49 am
by MrPippoTN
Thank you very much. Solved everything, even the two decimal issue.
Example: Max Humidity [day1_th0_hummax_rel#AB]
Example: Rain Today [day1_rain0_total_mm#AC]
Re: Problems creating a template using the Meteohub tags
Posted: Wed Apr 08, 2015 12:56 am
by cgn
Example: Max Humidity [day1_th0_hummax_rel#AB]
If your weather station shows 100% this results to 10 (first 2 signs).
Example: Rain Today [day1_rain0_total_mm#AC]
This only works with < 10 mm.
If you have e.g. 11.2 mm this results to 11. mm (first 3 signs)
Re: Problems creating a template using the Meteohub tags
Posted: Wed Apr 08, 2015 1:02 am
by MrPippoTN
MrPippoTN wrote:Thank you very much. Solved everything, even the two decimal issue.
Example: Max Humidity [day1_th0_hummax_rel#AB]
Example: Rain Today [day1_rain0_total_mm#AC]
Actually this trick does not work with rain values, because the quantity of mm increases and so if I decide to stamp only 3 digits I have this problem.
Example: Rain Today [day1_rain0_total_mm#AC] mm
With 3.5 mm I get 3,5 mm
With 33.5 mm I get 33. mm
Re: Problems creating a template using the Meteohub tags
Posted: Wed Apr 08, 2015 1:04 am
by MrPippoTN
cgn wrote:Example: Max Humidity [day1_th0_hummax_rel#AB]
If your weather station shows 100% this results to 10 (first 2 signs).
Example: Rain Today [day1_rain0_total_mm#AC]
This only works with < 10 mm.
If you have e.g. 11.2 mm this results to 11. mm (first 3 signs)
Exactly, I was writing it.
So this is the best I could make:
http://www.meteotrentinoaltoadige.it/st ... meteo.html
RESULT:
http://www.meteotrentinoaltoadige.it/st ... /meteo.htm
Re: Problems creating a template using the Meteohub tags
Posted: Wed Apr 08, 2015 1:06 am
by cgn
When you use the php function:
Save the file as meteo.htm
In the meteohub graph uploads set the filename to meteo.php.
In the browser call meteo.php.
Re: Problems creating a template using the Meteohub tags
Posted: Wed Apr 08, 2015 1:14 am
by MrPippoTN
cgn wrote:Then try the php function. This works!
I'm not that expert...
Re: Problems creating a template using the Meteohub tags
Posted: Wed Apr 08, 2015 1:16 am
by cgn
MrPippoTN wrote:cgn wrote:Then try the php function. This works!
I'm not that expert...
You don't need to be an expert.
Try to replace it as shown.
Re: Problems creating a template using the Meteohub tags
Posted: Wed Apr 08, 2015 1:19 am
by MrPippoTN
cgn wrote:MrPippoTN wrote:cgn wrote:Then try the php function. This works!
I'm not that expert...
You don't need to be an expert.
Try to replace it as shown.
Ok, thank you, I'll try!
Re: Problems creating a template using the Meteohub tags
Posted: Wed Apr 08, 2015 1:29 am
by MrPippoTN
Re: Problems creating a template using the Meteohub tags
Posted: Wed Apr 08, 2015 1:31 am
by cgn
You see, it isn't too difficult...