Problems creating a template using the Meteohub tags

Discussion of the Meteohub software package

Moderator: Mattk

Post Reply
MrPippoTN
Senior Boarder
Senior Boarder
Posts: 41
Joined: Sat Dec 10, 2011 1:49 pm

Problems creating a template using the Meteohub tags

Post 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?
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7878
Joined: Mon Oct 01, 2007 10:51 pm

Re: Problems creating a template using the Meteohub tags

Post 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.
MrPippoTN
Senior Boarder
Senior Boarder
Posts: 41
Joined: Sat Dec 10, 2011 1:49 pm

Re: Problems creating a template using the Meteohub tags

Post 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?
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7878
Joined: Mon Oct 01, 2007 10:51 pm

Re: Problems creating a template using the Meteohub tags

Post 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.
cgn
Expert Boarder
Expert Boarder
Posts: 91
Joined: Fri Jan 15, 2010 10:54 pm
Location: cgn

Re: Problems creating a template using the Meteohub tags

Post 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
Best regards
cgn

-----------------------------------------
Weather Station: Oregon WMR 200
Meteohub-System: SheevaPlug
Since Dec 2009
MrPippoTN
Senior Boarder
Senior Boarder
Posts: 41
Joined: Sat Dec 10, 2011 1:49 pm

Re: Problems creating a template using the Meteohub tags

Post 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]
cgn
Expert Boarder
Expert Boarder
Posts: 91
Joined: Fri Jan 15, 2010 10:54 pm
Location: cgn

Re: Problems creating a template using the Meteohub tags

Post 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)
Best regards
cgn

-----------------------------------------
Weather Station: Oregon WMR 200
Meteohub-System: SheevaPlug
Since Dec 2009
MrPippoTN
Senior Boarder
Senior Boarder
Posts: 41
Joined: Sat Dec 10, 2011 1:49 pm

Re: Problems creating a template using the Meteohub tags

Post 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
MrPippoTN
Senior Boarder
Senior Boarder
Posts: 41
Joined: Sat Dec 10, 2011 1:49 pm

Re: Problems creating a template using the Meteohub tags

Post 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
cgn
Expert Boarder
Expert Boarder
Posts: 91
Joined: Fri Jan 15, 2010 10:54 pm
Location: cgn

Re: Problems creating a template using the Meteohub tags

Post 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.
Best regards
cgn

-----------------------------------------
Weather Station: Oregon WMR 200
Meteohub-System: SheevaPlug
Since Dec 2009
MrPippoTN
Senior Boarder
Senior Boarder
Posts: 41
Joined: Sat Dec 10, 2011 1:49 pm

Re: Problems creating a template using the Meteohub tags

Post by MrPippoTN »

cgn wrote:Then try the php function. This works!
I'm not that expert...
Last edited by MrPippoTN on Wed Apr 08, 2015 1:19 am, edited 2 times in total.
cgn
Expert Boarder
Expert Boarder
Posts: 91
Joined: Fri Jan 15, 2010 10:54 pm
Location: cgn

Re: Problems creating a template using the Meteohub tags

Post 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.
Best regards
cgn

-----------------------------------------
Weather Station: Oregon WMR 200
Meteohub-System: SheevaPlug
Since Dec 2009
MrPippoTN
Senior Boarder
Senior Boarder
Posts: 41
Joined: Sat Dec 10, 2011 1:49 pm

Re: Problems creating a template using the Meteohub tags

Post 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!
MrPippoTN
Senior Boarder
Senior Boarder
Posts: 41
Joined: Sat Dec 10, 2011 1:49 pm

Re: Problems creating a template using the Meteohub tags

Post by MrPippoTN »

cgn
Expert Boarder
Expert Boarder
Posts: 91
Joined: Fri Jan 15, 2010 10:54 pm
Location: cgn

Re: Problems creating a template using the Meteohub tags

Post by cgn »

You see, it isn't too difficult...
Best regards
cgn

-----------------------------------------
Weather Station: Oregon WMR 200
Meteohub-System: SheevaPlug
Since Dec 2009
Post Reply