Numerical Expressions **solved**

This section covers the Meteobridge PRO, PRO2, NANO SD, Raspberry Pi and VM platforms exclusively

Moderator: Mattk

Post Reply
hymrog
Expert Boarder
Expert Boarder
Posts: 83
Joined: Sat Feb 01, 2014 1:25 am
Contact:

Numerical Expressions **solved**

Post by hymrog »

Hi

I have been testing out different computations using info provided in the Numerical Expressions of the wiki. All seem to work as expected with the exception of the addition/plus function.

I am just using the ip adderess of my RPI with following for testing:

Code: Select all

 http://myip address/cgi-bin/template.cgi?template={*[th0temp-act=F]+[th0temp-act=F]*}
Not sure if the issue is something new as this is the first time I have tried to use the numerical expressions.

Platform: Raspberry Pi Model B+
SW Version: Meteobridge 5.1 (Jan 18 2021, build 1915), FW 1.3

Thanks
g
User avatar
AlaskaWX
Junior Boarder
Junior Boarder
Posts: 36
Joined: Thu Apr 05, 2012 7:46 pm

Re: Numerical Expressions

Post by AlaskaWX »

I can't get addition with the "+" operator either. Must be a bug...
Davis VP2 with IIS and Leaf/Soil + numerous user defined plugin weather stations
User avatar
galfert
Platinum Boarder
Platinum Boarder
Posts: 326
Joined: Sun Jun 24, 2018 10:31 pm
Location: Orlando, FL

Re: Numerical Expressions

Post by galfert »

There is no bug. Your math is correct and it works exactly like that if you decided to use it in a script or event.

But since you are attempting to format it in a URL then you need to properly escape special characters. URL formatting has its own set of requirements. In this case the + sign is a special character. You can escape it with %2B as follows:

http://<your-IP>/cgi-bin/template.cgi?template={*[th0temp-act=F]%2B[th0temp-act=F]*}

If you need escape codes (also called percent-encoding) for other characters, you can reference this table or others like it:
https://www.w3schools.com/tags/ref_urlencode.ASP
Meteobridge RPI | GW1000
hymrog
Expert Boarder
Expert Boarder
Posts: 83
Joined: Sat Feb 01, 2014 1:25 am
Contact:

Re: Numerical Expressions

Post by hymrog »

Hello -

Confirmed that your solution works. Did not even think of this since all other expressions appeared to work within the URL without using the escape characters.

Much appreciated
g
Post Reply