Poor man’s weather station

/, Me/Poor man’s weather station

Poor man’s weather station

With all the money invested in our Loxone home automation project there currently is no room for a weather station. I need one to steer the heating system. The KNX OT Box of Theben I bought has a program which can take outdoor temperatures into account.

Currently Loxone has a weather service but it is limited to certain countries and the Netherlands is not included (yet). So I started thinking, can I not use weather services on the internet to tell me my local temperature, mold that into a PicoC program and have the service tell my heating the outdoor temperature?

The answer is “Yes you can!”. I’ve cooked up a little PicoC program which will do exactly that. Here’s how to do that:

A WARNING IS IN PLACE HERE! PicoC is not very strict in its syntax checking. A missing curly bracket will still run but gives unpredictable behavior. At one time I had to remove the SD card from the server, format it and reinsert it because my server did not respond to anything anymore. Be careful with what you program and check double check your code before committing it to the server!

You will need an account at a weather service. I used ‘aerisapi.com’. Go to their website and create an account. After you have created your account, register your application and you will get a UserID and UserSecret which will you will need in the code below.

Add a ‘Program’ module to a page in your Loxone Config program.

Loxone Config

Loxone Config


I use a lot of Memory flags which help me organize the programming. Here are the settings for the outdoor temperature memory flag. Uncheck the ‘Use as digital flag’. Now you can also change the ‘Unit’ value to reflect the value.


Doubleclick the module and paste the program below into the edit window and change the values of <your id> and <your secret> to the values obtained from the website mentioned above.


// This programm calls the aerisapi.com weather web service.
// The return value is a JSON string. Since PicoC does not support
// JSON I use scraping of the string to find the values.

enum OutputPorts
    Temperature,        // AQ1
    Humidity,            // AQ2
    windKPH             // AQ3

int GetIntValue(char *name, int def)
    int value = def;

    int pos = strfind(result, name, 0);

    if(pos > 0)
        char *stemp = calloc(1, 10);
        int lenName = strlen(name);

        strncpy(stemp, result + pos + lenName, 5);

        value = atoi(stemp);

        setoutput(Temperature, temp);

        stemp = 0;

    printf ("%s = %d", name, value);

    return value;

/// <Summary>
/// Main loop.
/// </Summary>
    char *host = "api.aerisapi.com";
    char *page = "/observations/apeldoorn,nl?client_id=<your id>&client_secret=<your secret>";

    char *result = httpget(host, page);

    if(result != 0)
        int temp = GetIntValue("\"tempC\":", -100);

        if(temp != -100)
            setoutput(Temperature, temp);

        int humidity = GetIntValue("\"humidity\":", -100);

        if(temp != -100)
            setoutput(Humidity, humidity);

        int wind = GetIntValue("\"windKPH\":", -100);

        if(temp != -100)
            setoutput(windKPH, wind);


    // Slow the loop down 10 minutes
    int sleepTime = 10 * 60 * 1000;

When you run the code in the server you will see the following in the Log. And the memory flags will show Temperature Celsius, Humidity and Wind velocity.


By |2015-02-10T11:04:11+00:00August 26th, 2012|Loxone, Me|16 Comments

About the Author:


  1. Martin August 31, 2012 at 13:47 - Reply

    Hi Paul,

    Works well. I’ve been trying to adapt your script to call the setweatherdata() function but without success. Have you had any success with this?


    • Paul September 6, 2012 at 05:02 - Reply

      Hi Martin,

      No I have not used that. As a matter of fact I did not know of it’s excistance. I’m a bit causious with PicoC programming at the moment since my debacle with the looping miniserver. Because my miniserver is build into a cabinet and I can not reach the SD card easily any mistake on my part will give the risk of crashing the whole system.


  2. Ben Saich September 14, 2012 at 16:49 - Reply

    Hello Paul,

    I work for Loxone, we really liked your blog entry on creating a weather station and have included a copy of it on our company website.


    Thanks for producing this great how to and we hope that your project continues to go well.

    Best regards

    Ben Saich

    Loxone UK Ltd

  3. james braselton January 7, 2013 at 02:38 - Reply

    hi there just buy a acurite at home depot my has a 3 in 1 sensore wind temputure humidity only cost $89 very cheap dose not reqier big area

    • dam February 10, 2013 at 18:40 - Reply

      what interface you use to connect acurite with loxone? what model acurite do you have?

      • Paul May 4, 2013 at 13:51 - Reply

        We haven’t used Acurite. What I read from the AcuLink is that it work with WiFi. I have not found a WiFi connection to Loxone other then programming it myself in PicoC. I guess it would be possible but have no experience with it.

  4. PicoC httpget no longer works March 23, 2014 at 11:48 - Reply

    […] In August 2012 I posted this on my personal blog: Poor man’s weather station | Paul's Place. It's an explanation on how to create your own poorman's weather station. The script has been […]

  5. Patrick Van Rie December 23, 2015 at 15:34 - Reply

    Followed your guide: works like a charm!
    Thanks a lot, this is a nice start using PicoC programs on the Loxone. Now trying to write one that sends via RS232 a string to Velleman K8056 relayboards

    • Patrick Van Rie January 1, 2016 at 21:01 - Reply

      Strange, I always get the weather observations for the city of vlissingen,nl instead of ledeberg,be. The gps coordinates are correct though: {“success”:true,”error”:null,”response”:{“id”:”EHFS”,”loc”:{“long”:3.6,”lat”:51.45},”place”:{“name”:”vlissingen”,”state”:””,”country”:”nl”},”profile”:{“tz”:”Europe\/Amsterdam”,”elevM”:32,”elevFT”:105},”obTimestamp”:1451692500,”obDateTime”:”2016-01-02T00:55:00+01:00″,”ob”:{“timestamp”:1451692500,”dateTimeISO”:”2016-01-02T00:55:00+01:00″,”tempC”:8,”tempF”:46,”dewpointC”:6,”dewpointF”:43,”humidity”:87,”pressureMB”:1020,”pressureIN”:30.12,”spressureMB”:1016,”spressureIN”:30,”altimeterMB”:null,”altimeterIN”:null,”windKTS”:16,”windKPH”:30,”windMPH”:18,”windSpeedKTS”:16,”windSpeedKPH”:30,”windSpeedMPH”:18,”windDirDEG”:210,”windDir”:”SSW”,”windGustKTS”:null,”windGustKPH”:null,”windGustMPH”:null,”flightRule”:”LIFR”,”visibilityKM”:7,”visibilityMI”:4.35,”weather”:”Mostly Clear”,”weatherShort”:”Mostly Clear”,”weatherCoded”:”::FW”,”weatherPrimary”:”Mostly Clear”,”weatherPrimaryCoded”:”::FW”,”cloudsCoded”:”FW”,”icon”:”pcloudyn.png”,”heatindexC”:8,”heatindexF”:46,”windchillC”:8,”windchillF”:46,”feelslikeC”:8,”feelslikeF”:46,”isDay”:false,”sunrise”:1451721040,”sunriseISO”:”2016-01-02T08:50:40+01:00″,”sunset”:1451749711,”sunsetISO”:”2016-01-02T16:48:31+01:00″,”snowDepthCM”:null,”snowDepthIN”:null,”precipMM”:null,”precipIN”:null,”solradWM2″:null,”sky”:19,”light”:0},”raw”:”EHFS 312355Z AUTO 21016KT 7000 FEW035\/\/\/ 08\/06 Q1020″,”relativeTo”:{“lat”:51.03859,”long”:3.74458,”bearing”:348,”bearingENG”:”NNW”,”distanceKM”:46.841,”distanceMI”:29.106}}}

      I found out this morning, because the Aerisweather windspeed indicated 30 km/h, whilst there was no wind at all around my house.

      The request I used was “/observations/Ledeberg,be?client_id=J4s4P7gg…….&client_secret=kAJuJJJmBiE…F0”;

      With “/Apeldoorn,nl” I also arrive in vlissingen.

      Any thoughts ?

      • Patrick Van Rie January 3, 2016 at 11:44 - Reply

        &filter=allstations !!!!
        I got a reply from Tony of the Aeris helpdesk, and now get data from a station at 17,7 km from my place.

        the request string looks like this now:

        By the way a simple way of finding the gps coordinates of your place: look up your address in google maps, R-click on the orange balloon and click “What’s here”: this shows at the bottom-middle of the window your gps-coordinates;

  6. Patrick Van Rie January 2, 2016 at 08:54 - Reply

    Tested for “Gent,Belgium” on Aeris website http://wx.aerisweather.com/?pands=gent
    This works ok for the webpage, but not as a JSON string: there I get “vlissingen,nl” again.
    I made a support ticket with Aeris, and while waiting if they solve it, the location “Brussels,Belgium” works.

    If Aeris does not come up with a solution, I can adapt the program for the WUnderground weather service, they also offer JSON output from their api, also with a free developer license.

    • Tom Jacquemyn October 15, 2016 at 21:38 - Reply

      Beste Patrick,

      Werkt het ondertussen naar behoren voor je?
      Ben er net ook mee aan het spelen.

  7. Inder December 21, 2017 at 03:05 - Reply

    Hi thank you very much for sharing. I implemented the code and worked beautifully, I was just wondering you were able to get the reading to show the decimal point? Ie. 20.50, versus just 20?

    • Paul December 21, 2017 at 07:17 - Reply

      Hi Inder,

      I was never bothered by that but you could write a more sophisticated conversion routine for the string to numeric value.

      I personally am not using this code anymore. We now use the Loxone Weather service. Is expensive but works very well.

  8. Tim April 11, 2018 at 16:18 - Reply

    Thanks for the great article. Works perfect!
    Anyone knows how to get the predicted temperature for day +1(tomorrow)?
    I would like to control my heating system with this.

  9. Hans September 10, 2018 at 14:01 - Reply

    Beste Paul,

    Ik zou graag de buitenradar (simpele tekst pagina) uitlezen om in loxone te gebruiken ( voornamelijk voor zonnewering bescherming)


    In deze link wil ik de eerste 3 cijfers uitlezen, eventueel 4 of 5 waarden na elk kwartier.

    Van pico ken ik te weinig om dit zelf uit te programmeren zonder risico om men loxone om zeep te helpen.
    Via virtual HTTP input krijg ik geen waarden binnen gehaald.

    Hans Truyts

Leave A Comment