Using Openweather api to get weather info into the Loxone mini Miniserver

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • toscal
    Moderator
    • Oct 2005
    • 2061

    Using Openweather api to get weather info into the Loxone mini Miniserver

    As we are in lockdown I have been doing some playing with my miniserver.
    My apartment has a Miniserver Go.
    I have been experimenting with getting weather information into the system. I know Loxone have their own weather service and there is a Loxberry plugin. But I wanted a solution that didn't require extra bits of kit or a paid subscription.
    So I decided to use openweathermap.org and sign up for a free account.
    Once you have signed up you are given an API key which you need when creating API's you can have more than one key if you want.

    So you enter this into your web browser
    http://api.openweathermap.org/data/2...ndon,uk&APPID=YOUR_API_KEY&units=metric

    This gives you something like this
    {"coord":{"lon":-0.13,"lat":51.51},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"base":"stations","main":{"temp":18.68,"feels_lik e":16.05,"temp_min":17.22,"temp_max":20,"pressure" :1006,"humidity":45},"visibility":10000,"wind":{"s peed":2.6,"deg":210},"clouds":{"all":80},"dt":1588 001847,"sys":{"type":1,"id":1414,"country":"GB","s unrise":1587962349,"sunset":1588015007},"timezone" :3600,"id":2643743,"name":"London","cod":200}

    The annoying thing is that the time is in Linux UTC format, if you add &mode=xml to the end of the API you get normal time and date for sunrise etc.

    To get for example today's temperature
    1. You set up a virtual HTTP input in Loxone config. In the URL field put http://api.openweathermap.org/data/2...ndon,uk&APPID=YOUR_API_KEY&units=metric
    2. Then for each bit of weather info you then need to define a virtual HTTP input command
    3. In the command recognition field just enter "temp":\v
    4. Then for the units field you enter <v.1>ºC

    For wind direction its a little more complex
    1. Under the same virtual HTTP input then follow step 2 above
    2. In the command recognition field enter "wind"\s21\v . This finds the characters "wind" then jumps 21 characters forward to get wind direction. I tried using the command "deg"\v but it didn't work.
    4. In the units enter <v>º

    And now the tricky bit
    To get Wind direction as Southerly etc you need to use a Status block and have the Wind direction as an input.
    Then set up a few rules to get the compass directions.
    AI1 >= 0 AI1 < 35 then in Status Text just enter Northerly
    And so on
    Here is what I have so far
    loxone weather.jpg

    The Temperature Warning uses another Status block and will show a graphical warning if it gets too cold or too hot.
    Last edited by toscal; 2 November 2023, 10:13 PM.
    IF YOU CAN'T FIX IT WITH A HAMMER, YOU'VE GOT AN ELECTRICAL PROBLEM.
    Renovation Spain Blog
  • toscal
    Moderator
    • Oct 2005
    • 2061

    #2
    Just a quick update. I have now added UV Index, max, min temps and a forecast page. Basically I have a room called weather for current weather and another room called Forecast for tomorrow's weather.Weather V2.1.jpgforecast V1.2.jpg
    IF YOU CAN'T FIX IT WITH A HAMMER, YOU'VE GOT AN ELECTRICAL PROBLEM.
    Renovation Spain Blog

    Comment

    • Edwin
      Automated Home Lurker
      • Dec 2020
      • 2

      #3
      Hello Toscal,

      Did you get it to work to change the Linux UTC time format mormal time and dat ?

      Comment

      • toscal
        Moderator
        • Oct 2005
        • 2061

        #4
        No I ended up using the xml data as this uses normal time formats.
        IF YOU CAN'T FIX IT WITH A HAMMER, YOU'VE GOT AN ELECTRICAL PROBLEM.
        Renovation Spain Blog

        Comment

        • Edwin
          Automated Home Lurker
          • Dec 2020
          • 2

          #5
          Originally posted by toscal View Post
          No I ended up using the xml data as this uses normal time formats.
          Can you show an example ?

          Comment

          • toscal
            Moderator
            • Oct 2005
            • 2061

            #6
            Give me a couple of days and I will write up a proper tutorial
            IF YOU CAN'T FIX IT WITH A HAMMER, YOU'VE GOT AN ELECTRICAL PROBLEM.
            Renovation Spain Blog

            Comment

            • toscal
              Moderator
              • Oct 2005
              • 2061

              #7
              The tutorial is almost complete. Just got to re-read it and it should be done. So will post it here later today.
              IF YOU CAN'T FIX IT WITH A HAMMER, YOU'VE GOT AN ELECTRICAL PROBLEM.
              Renovation Spain Blog

              Comment

              • toscal
                Moderator
                • Oct 2005
                • 2061

                #8
                Here is the tutorial to get open weather map to work with Loxone

                Tutorial
                IF YOU CAN'T FIX IT WITH A HAMMER, YOU'VE GOT AN ELECTRICAL PROBLEM.
                Renovation Spain Blog

                Comment

                Working...
                X