• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

currentweather - temperature (minimum and maximum)

Scheduled Pinned Locked Moved Troubleshooting
5 Posts 2 Posters 2.9k Views 2 Watching
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.
  • K Offline
    Keromida
    last edited by Keromida Aug 17, 2016, 2:23 PM Aug 17, 2016, 2:21 PM

    Hi everyone =)

    I mostly finished my own Mirror and I’m having some trouble with the currentweather. I would like to display the minimum and maximum temperature of the day in the currentweather API and I seriously have no idea how to fix that problem. I was trying to fix it on my own but all I was able to display on the mirror was “undefined” for minimum and maximum tempereture. Could anyone explain to me what I actually have to do to get the data to the currentweather API?

    Kind regards from Germany,
    Keromida

    1 Reply Last reply Reply Quote 0
    • K Offline
      Keromida
      last edited by Keromida Aug 17, 2016, 5:32 PM Aug 17, 2016, 5:07 PM

      Okay, I was able to write the code correctly and it is able t display the temperature on the right position but I still have the problem to get the data for the temperature information from openweathermap.org and connect it to the written code. All I can see on the screen is null°. I guess the data is missing and also the connection to the data from openweathermap.org.

      This is how it looks like at the moment
      Bild Text

      Edit: I can’t locate the part of the code where the data of openweathermap.org is connected to the currentweather.js code. Can anyone help me where to find it?

      R 1 Reply Last reply Aug 18, 2016, 5:05 AM Reply Quote 0
      • R Offline
        RedNax Module Developer @Keromida
        last edited by Aug 18, 2016, 5:05 AM

        @Keromida The request url is assembled here:

        		var url = this.config.apiBase + this.config.apiVersion + "/" + this.config.weatherEndpoint + '/' + this.getParams();
        

        The deafults are:

        		apiVersion: "2.5",
        		apiBase: "http://api.openweathermap.org/data/",
        		weatherEndpoint: "weather"
        

        Which makes:

        http://api.openweathermap.org/data/2.5/weather/
        

        Then getParams() adds id or q depending on your config, units, lang and APPID ultimately making (example):

        http://api.openweathermap.org/data/2.5/weather/?q='Dusseldorf,DE'&lang=DE&units=metric&APPID=<YOUR APPID>
        

        They returned JSON will oook like this:

        {"coord":{"lon":6.78,"lat":51.22},"weather":[{"id":803,"main":"Clouds","description":"überwiegend bewölkt","icon":"04d"}],"base":"stations","main":{"temp":12.27,"pressure":1011,"humidity":63,"temp_min":10.56,"temp_max":14.44},"wind":{"speed":2.12,"deg":94.501},"clouds":{"all":76},"dt":1471496164,"sys":{"type":3,"id":192509,"message":0.0438,"country":"DE","sunrise":1471494283,"sunset":1471546042},"id":2934246,"name":"Dusseldorf","cod":200}
        
        1 Reply Last reply Reply Quote 1
        • K Offline
          Keromida
          last edited by Aug 18, 2016, 10:58 AM

          Thank you for your help RedNax! The JSON Code really helped me out to fix it! I chose the wrong names for temp_min and temp_max. That’s why i couldn’t receive the data.

          Could you tell me where to find those JSON codes for the weather?

          R 1 Reply Last reply Aug 18, 2016, 1:25 PM Reply Quote 0
          • R Offline
            RedNax Module Developer @Keromida
            last edited by Aug 18, 2016, 1:25 PM

            @Keromida Do you mean the forecast?

            http://api.openweathermap.org/data/2.5/forecast?q='Dusseldorf,DE'&lang=DE&units=metric&APPID=<APPID>
            

            You can also have a look here: http://openweathermap.org/api

            1 Reply Last reply Reply Quote 1
            • 1 / 1
            1 / 1
            • First post
              1/5
              Last post
            Enjoying MagicMirror? Please consider a donation!
            MagicMirror created by Michael Teeuw.
            Forum managed by Sam, technical setup by Karsten.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy