Retrieve Weather Data from Netatmo for WorldWeather Plugin xml

Discussion in 'MediaPortal 1 Plugins' started by pur_berger, December 28, 2014.

  1. pur_berger
    • Super User

    pur_berger Super User

    Joined:
    May 14, 2007
    Messages:
    1,679
    Likes Received:
    183
    Gender:
    Male
    Location:
    Vienna
    Ratings:
    +270 / 1
    Home Country:
    Austria Austria
    Show System Specs
    THX to Rick164 who is helping me out getting the local Data from your Netatmo Device with building a App :)


    The idea is to fill the data to the local weather condition file from WorldWeatherPlugin to get your own values to MP.

    Code (Text):
    1. <?xml version="1.0" encoding="UTF-8"?>
    2. <data>
    3.  
    4. <provider>
    5. <name>WorldWeather</name>
    6. <version>1.0</version>
    7. </provider>
    8.  
    9. <location>
    10. <city>Munich</city>
    11. <country>Germany</country>
    12. <region>Bavaria</region>
    13. <postalcode>80331</postalcode>
    14. <longitude>11.58</longitude>
    15. <latitude>48.15</latitude>
    16. <altitude>500</altitude>
    17. <unit>SI</unit>
    18. </location>
    19.  
    20. <current>
    21. <date>2013-01-01</date>
    22. <temperature>16</temperature>
    23. <temperatureFeelsLike>15</temperatureFeelsLike>
    24. <weatherCode>26</weatherCode>
    25. <weatherDescription>Partly Cloudy</weatherDescription>
    26. <windSpeed>7</windSpeed>
    27. <windDirectionDegree>280</windDirectionDegree>
    28. <precipitation>0.0</precipitation>
    29. <pressure>1026</pressure>
    30. <barometricPressure>2</barometricPressure>
    31. <humidity>68</humidity>
    32. <visibility>0</visibility>
    33. <cloudCoverage>10</cloudCoverage>
    34. <uvIndex>1</uvIndex>
    35. </current>
    36.  
    37. <forecast>
    38. <forecastday>
    39. <date>2013-01-02</date>
    40. <temperatureLow>8</temperatureLow>
    41. <temperatureHigh>20</temperatureHigh>
    42. <weatherCode>25</weatherCode>
    43. <weatherDescription>Mostly Cloudy</weatherDescription>
    44. <windSpeed>7</windSpeed>
    45. <precipitation>2.0</precipitation>
    46. <pressure>1028</pressure>
    47. <humidity>68</humidity>
    48. <cloudCoverage>10</cloudCoverage>
    49. </forecastday>
    50. </forecast>
    51.  
    52. </data>
    53.  
    https://github.com/RickDB/NetAtmo.Net/tree/master/NetAtmo.NET

     

    Attached Files:

    Last edited: December 29, 2014
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. Rick164
    • Super User

    Rick164 Super User

    Joined:
    January 7, 2006
    Messages:
    1,335
    Likes Received:
    918
    Ratings:
    +1,359 / 0
    Home Country:
    Netherlands Netherlands
    Show System Specs
    This version should fill in the Access token directly into the read-only text box below and added the option to get the device ID (untested), weather info is next but would need to know what output XML it needs to generate (format / structure) and if it has to be one XML file or a new one per hour for instance (containing humidity/temp etc..) :)
     

    Attached Files:

    • NetAtmoNET.zip
      File size:
      10.5 KB
      Uploaded:
      December 28, 2014
      Views:
      99
  4. pur_berger
    • Super User

    pur_berger Super User

    Joined:
    May 14, 2007
    Messages:
    1,679
    Likes Received:
    183
    Gender:
    Male
    Location:
    Vienna
    Ratings:
    +270 / 1
    Home Country:
    Austria Austria
    Show System Specs
    Have put the xml details in the first post. With the new version I get

    upload_2014-12-28_18-59-12.png
     
  5. Rick164
    • Super User

    Rick164 Super User

    Joined:
    January 7, 2006
    Messages:
    1,335
    Likes Received:
    918
    Ratings:
    +1,359 / 0
    Home Country:
    Netherlands Netherlands
    Show System Specs
    New version attached, now includes the JSON library to get rid of that error ;)
    Will make some sample code for each function (auth->device ID->weather info) and put that on github once it works.

    Could format it similar like in the first post but not sure how that would work as you might not get enough information from the NetAtmo API.
     

    Attached Files:

    • NetAtmoNET.zip
      File size:
      241.6 KB
      Uploaded:
      December 28, 2014
      Views:
      111
    Last edited: December 28, 2014
  6. pur_berger
    • Super User

    pur_berger Super User

    Joined:
    May 14, 2007
    Messages:
    1,679
    Likes Received:
    183
    Gender:
    Male
    Location:
    Vienna
    Ratings:
    +270 / 1
    Home Country:
    Austria Austria
    Show System Specs
    OK - no error now but also no values.

    upload_2014-12-28_19-52-50.png
     
  7. pur_berger
    • Super User

    pur_berger Super User

    Joined:
    May 14, 2007
    Messages:
    1,679
    Likes Received:
    183
    Gender:
    Male
    Location:
    Vienna
    Ratings:
    +270 / 1
    Home Country:
    Austria Austria
    Show System Specs
    Here I have an Icon for You :)
     
  8. Rick164
    • Super User

    Rick164 Super User

    Joined:
    January 7, 2006
    Messages:
    1,335
    Likes Received:
    918
    Ratings:
    +1,359 / 0
    Home Country:
    Netherlands Netherlands
    Show System Specs
  9. pur_berger
    • Super User

    pur_berger Super User

    Joined:
    May 14, 2007
    Messages:
    1,679
    Likes Received:
    183
    Gender:
    Male
    Location:
    Vienna
    Ratings:
    +270 / 1
    Home Country:
    Austria Austria
    Show System Specs
    OK - smal redesign of the icon (as this is the only thing I can do :)) Icon.png
     
    Last edited: December 28, 2014
  10. Rick164
    • Super User

    Rick164 Super User

    Joined:
    January 7, 2006
    Messages:
    1,335
    Likes Received:
    918
    Ratings:
    +1,359 / 0
    Home Country:
    Netherlands Netherlands
    Show System Specs
    Fixed the bugs and it can now retrieve temperature and humidity from the last 30 minutes, it retrieves the auth and device ID on error (token expired for instance)

    Couldn't find a clear way of knowing which values belong to which as the SDK example only lists those two:

    https://dev.netatmo.com/doc/sdk/win8
    https://dev.netatmo.com/doc/methods/getmeasure

    Code is also up on github:

    https://github.com/RickDB/NetAtmo.Net/tree/master/NetAtmo.NET


    /edit:

    found out how it formats the response, pretty easy now that I get it :p
    Basically we request values (temp/hum in example) and it will list them in that order, can add more like C02 etc.. but depends on how much information we can retrieve and is actually useful in the WorldWeather plugin.

    /edit 2: added some more values (long/lat etc..) to the retrieval and it will display them in the UI, think that is all the info we can get from the device API at least:

    https://dev.netatmo.com/doc/methods/devicelist

    New version attached and added version number to the title.
     

    Attached Files:

    Last edited: December 28, 2014
  11. pur_berger
    • Super User

    pur_berger Super User

    Joined:
    May 14, 2007
    Messages:
    1,679
    Likes Received:
    183
    Gender:
    Male
    Location:
    Vienna
    Ratings:
    +270 / 1
    Home Country:
    Austria Austria
    Show System Specs
    Looking good. Only thet the data is from the Indoor Module (The ID in fact is teh mac adress of teh indoor one which acts as hub for the outdfoor one.

    So Think you need to go for the module_id instead (or in addition)

    module_id
    Optionnal
    If you don't specify any module_id you will retrieve the device's measurements. If you specify a module_id you will retrieve the module's measurements.

    CO2 would be funny but therer are no variables set for this from worlweather and no skinsupport so far (well would be easy to implement this value but no idea what happens if there are not named values in the xml). The public token could be nice to get a temperature / rain / Wind and whatever for your area like this

    http://community.wolfram.com/groups/-/m/t/344241
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!