• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Weather Data Source

    How-To
    4
    5
    1.8k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      Pikey4
      last edited by

      At the risk of going over some old ground here.....

      I would like to Have a data source that I can log Current Temperature, Humidity, and wind speed for say

      https://www.timeanddate.com/weather/australia/sydney

      Looks like I need a http retriever?

      I have read a few topics in the forum already such as https://forum.infiniteautomation.com/topic/3837/sunrise-sunset

      but I must say that the whole Regex thing blows my mind.

      Just wondering if anyone can assist in this with what is required to grab these parameters?

      My Purpose is to check Cooling tower Water consumption in different weather conditions, and it would be good not to have a weather station at each location.

      Any advise is appreciated.

      Cheers!

      Mango Core version: 3.5.6
      Mango API module version: 3.5.2
      MangoUi module version: 3.5.5
      Platform: 10.14 MacOS Mojave
      Chrome: Version 70.0.3538.110 (64-bit)

      1 Reply Last reply Reply Quote 0
      • R
        Ralf
        last edited by Jared Wiltshire

        Hi Pikey4,

        my solution with openweathermap.org.
        First step create a data source "HTTP Retriever":

        0_1539338051706_1d5aca58-7c5e-44c9-bdd6-f723c373d211-image.png

        In the URL field you have to put the following:

        http://api.openweathermap.org/data/2.5/weather?lat=-33.8549&lon=151.2165&units=metric&appid=HereYourOpenweatherLoginID&mode=xml&lang=en

        Second step create some datapoints:

        The api paramters:

        0_1539339183212_6c9eb510-4a7c-40fe-a377-3442fde6c0fd-image.png openweather

        Create a datapoint Temp (temperature):

        0_1539339368073_c0bfdeb3-b13c-4474-a247-91f990b5b2ea-image.png

        Or city:

        0_1539339509063_a4f0f74e-8d1e-4013-acc9-e4452b0a9d55-image.png

        Or humidity:

        0_1539339645243_f4138096-9f00-4a09-b1fb-af64de9d2e84-image.png

        1 Reply Last reply Reply Quote 0
        • phildunlapP
          phildunlap
          last edited by phildunlap

          Hi Pikey4,

          One place to experiment with Regex is your browser's development tools. In the JavaScript Console, you can try the regex in between / / on the page, like,

          /.*Humidity: .*?(\d+%).*/.exec(document.body.innerHTML)
          Which will return an array if we got a match,
          /.*Humidity: .*?(\d+%).*/.exec(document.body.innerHTML)[1]

          It would probably take more work to grab the whole forecast and the HttpRetriever may not be the best solution if one were to go after forecast data.

          So, .*Humidity: .*?(\d+%).* will be our regex and 1 is the capture group, for Humidity.

          Temperature seems a little more difficult, but we can see in a wget that it's easy to find that value relative to the word 'Now' in the same fashion, like,

          .*Now.*?(\d+) °F.*

          1 Reply Last reply Reply Quote 0
          • MattFoxM
            MattFox
            last edited by MattFox

            If you are unsure about regular expressions: regexr.com is a darned good resource and has helped me on many occasions. It also has a glossary of terms you can use in order to best 'capture' the groups of data you desire.

            I use Weather Underground's API for my data (wunderground.com) as it provides a flexible API as well as forecasting.
            and would suggest that but it appears some do-gooders have decided to shut the api down in two months for a more favourable pay 20x more for everything...
            If I find something soon that works I'll keep you informed. Personally, I'd use an http query (namely curl) from a bash script to generate a file which could be in CSV format from an API that mango could parse into a datafile datasource. But that's just my approach. Keeps the API calls low too.

            Do not follow where the path may lead; go instead where there is no path.
            And leave a trail - Muriel Strode

            1 Reply Last reply Reply Quote 0
            • P
              Pikey4
              last edited by

              Thanks all, This has been very helpful.

              Mango Core version: 3.5.6
              Mango API module version: 3.5.2
              MangoUi module version: 3.5.5
              Platform: 10.14 MacOS Mojave
              Chrome: Version 70.0.3538.110 (64-bit)

              1 Reply Last reply Reply Quote 0
              • First post
                Last post