Page 1 of 1

HTTP event question **solved**

Posted: Fri Feb 01, 2019 10:24 pm
by mpriest
Hello ,

I am using this http event url:
http://www.webcamwassenaar.nl/wxdata/re ... d]kn&gust=[wind0wind-max6=kn.0:--]kn&richting=[wind0dir]

With this php:
<?php
$U = $_GET['epoch'];
$wind = $_GET['wind'];
$gust = $_GET['gust'];
$richting = $_GET['richting'];
$values = array($U,$wind, $gust, $richting);
$result = json_encode($values);
file_put_contents("datawaswind.txt",$result);
?>

The response in the resulting txt file is :
[null,"[wind0wind]kn","1kn","[wind0dir]"]

What's wrong ? who knows?

Re: HTTP event question

Posted: Sat Feb 02, 2019 1:38 am
by ConligWX
the correct way of calling a sensor is:

sensor-selector=converter.decimals:replacement

"converter", "decimals" and "replacement" can be omitted, "sensor" and "type"(selector) are mandatory.

While "sensor" tells what sensor and what piece of information of the sensor to use, "selector" decides data from what time period should be taken into account and "converter" does convert data into measurement units the user likes most. "Decimals" decides about precision the result should be shown in and "replacement" gives the string to be returned when there is no data for defined sensor available.

so
[wind0dir] should be something like: [wind0dir-act]


https://www.meteobridge.com/wiki/index.php/Templates

Look at "Selectors"