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 3.3k 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.
    • KeromidaK Offline
      Keromida
      last edited by Keromida

      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
      • KeromidaK Offline
        Keromida
        last edited by Keromida

        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?

        RedNaxR 1 Reply Last reply Reply Quote 0
        • RedNaxR Offline
          RedNax Module Developer @Keromida
          last edited by

          @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
          • KeromidaK Offline
            Keromida
            last edited by

            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?

            RedNaxR 1 Reply Last reply Reply Quote 0
            • RedNaxR Offline
              RedNax Module Developer @Keromida
              last edited by

              @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

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • 1 / 1
              • First post
                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