Author Topic: Obtain RAIN live data for today via HTTP request. **solved**  (Read 1218 times)

0 Members and 1 Guest are viewing this topic.

Offline ozbear

  • Member
  • *
  • Posts: 11
Obtain RAIN live data for today via HTTP request. **solved**
« on: August 11, 2022, 06:38:42 PM »
My Vantage Vue console is connected to my Meteobridge (TL-MR3020V3) via USB.
I can successfully retrieve live data via HTTP requests, for example,"cgi-bin/template.cgi?template=[DD].[MM].[YY]+[HH]:[mm][APM]%0D[th0temp-act]%BAC%0d[rain0][th0hum-act]%25&contenttype=text/plain;charset=iso-8859-1";, along with, naturally, the IP address of the Meteobridge and parse the HTTP response in my program to store in my own database.

Using the above request string, I receive the following reply data:
12.08.22 08:27AM
14.3ºC
[rain0]77.0%

As you can see, the rain data is not retrieved but just implanted verbatim from the request string.
The other request data is successfully retrieved.

I have tried many different forms of the rain sensor string but all fail with just the rain sensor data being return a the replace string.

Does anyone know what the correct rain sensor request string is?
Any advice gratefully received.

Oz
« Last Edit: September 22, 2022, 05:58:38 PM by docbee »

Offline Mattk

  • Forecaster
  • *****
  • Posts: 2135
Re: Obtain RAIN live data for today via HTTP request
« Reply #1 on: August 11, 2022, 06:55:52 PM »
Obviously [rain0] is not a valid sensor.

What text are you actually using in the HTTP request for rain0total?

Offline ozbear

  • Member
  • *
  • Posts: 11
Re: Obtain RAIN live data for today via HTTP request
« Reply #2 on: August 12, 2022, 05:01:22 PM »
Mattk,
Thank you for your interest/reply.
My exact text, as typed into a Chrome browser (in one line) (my program gives same result) is:
http://xxx.xxx.xxx.xxx/cgi-bin/template.cgi?template=[DD].[MM].[YY]+[HH]:[mm][APM]%0D[th0temp-act]%BAC%0d[rain0total]%0d[th0hum-act]%25&contenttype=text/plain;charset=iso-8859-1
    where is xxx.xxx.xxx.xxx is the Metobridge's ip address on my local LAN.

The response is:
13.08.22 06:41AM
10.9ºC
[rain0total]
95.0%

(I changed rain0 to rain0total in case that made a difference...it didn't).
Interestingly, Meteobridge's own web client for Live Data -> Min Max Data shows the correct value for daily rain, the same as the Vantage Vue console (it is raining here at the moment):

rain fall (total amount)      4.0mm   4.8mm   4.8mm   4.8mm

Clearly Meteobridge's own client is successfully accessing a sensor's correct daily rain amount, but I don't seem to be able to do the same.

Any further advice gratefully accepted;

Oz

Offline Mattk

  • Forecaster
  • *****
  • Posts: 2135
Re: Obtain RAIN live data for today via HTTP request
« Reply #3 on: August 12, 2022, 06:33:33 PM »
You require a selector and not all selectors are meaningful with cumulative sensors

[rain0total-daysum] or [rain0total-sumday] will give total rainfall for today. There are also hoursum, monthsum, yearsum, allsum and ydaysum which are self explanatory

Could also use the selector sum like [rain0total-sum60] gives rainfall for the past 60 minutes, [rain0total-sum24h] would be rainfall for the last 24 hours etc etc

Offline ozbear

  • Member
  • *
  • Posts: 11
Re: Obtain RAIN live data for today via HTTP request
« Reply #4 on: August 13, 2022, 05:55:13 PM »
Mattk,
You are a legend  [tup]!

I an now getting a value of 0, which agrees with both the Meteobridge web page as well as the Vantage Vue console.
Unfortunately it has stopped raining so I am getting a (correct) value of zero.
Thank you very much for your interest and support.

Oz

Offline docbee

  • Moderator
  • Forecaster
  • *****
  • Posts: 853
    • smartbedded
Re: Obtain RAIN live data for today via HTTP request
« Reply #5 on: September 08, 2022, 04:53:33 AM »
How to use template variables is explained in the wiki: https://meteobridge.com/wiki/index.php/Templates

It is rather detailed and even has examples of usage.
founder of smartbedded.com - home of meteohub, meteoplug, meteobridge, meteostick

 

anything