• 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.

[DEBUG] Default Weather Module with OpenWeatherMap One Call API

Scheduled Pinned Locked Moved Development
openweathermaponecallapidefaultweathermodulehourlycurrentdaily
7 Posts 5 Posters 2.5k Views 5 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.
  • L Offline
    lost
    last edited by Jun 30, 2020, 6:33 PM

    minor correction, the maxNumberOfEntries config parameter is wrong, it should be maxEntries instead:

    module: "weather",
    position: "bottom_center",
    header: "Hourly Forecast",
    config: {
    	weatherProvider: "openweathermap",
    	type: "wDataHourly", // wDataCurrent and wDataDaily theoretically work but currently don't have .njk files
    	apiKey: "OPENWEATHERMAPAPIKEY", // your OpenWeatherMap API key
    	lat: 40.7128, // your latitude
    	lon: -74.0060, // your longitude
    	weatherEndpoint: "/onecall",
    	maxEntries: 12
    }
    
    1 Reply Last reply Reply Quote 0
    • L Offline
      lost
      last edited by Jul 1, 2020, 9:13 AM

      Got it working! I think I’ll just avoid dot notation from now on…

      Repo is linked below. If anyone’s looking to use this, OpenWeatherMap’s One Call API asks for latitude and longitude instead of a location or location ID. But in return, you can get not only current and daily (max 7 days) forecasts, but also hourly forecasts (max 48 hours).

      All original functionality of the module should remain intact.

      Sample Module Configurations:

      {
      	module: "weather",
      	position: "bottom_left",
      	header: "Current Forecast",
      	config: {
      		weatherProvider: "openweathermap",
      		weatherEndpoint: "/onecall",
      		type: "wDataCurrent",
      		apiKey: "OPENWEATHERMAPAPIKEY", // your OpenWeatherMap API key
      		initialLoadDelay: 0,
      		lat: 40.7128, // your latitude
      		lon: -74.0060, // your longitude
      	}
      },
      {
      	module: "weather",
      	position: "bottom_center",
      	header: "Hourly Forecast",
      	config: {
      		weatherProvider: "openweathermap",
      		weatherEndpoint: "/onecall",
      		type: "wDataHourly",
      		apiKey: "OPENWEATHERMAPAPIKEY", // your OpenWeatherMap API key
      		initialLoadDelay: 2500,
      		lat: 40.7128, // your latitude
      		lon: -74.0060, // your longitude
      		maxEntries: 32, // max 48, set by OWM One Call API
      		showPrecipitationAmount: true
      	}
      },
      {
      	module: "weather",
      	position: "bottom_right",
      	header: "Daily Forecast",
      	config: {
      		weatherProvider: "openweathermap",
      		weatherEndpoint: "/onecall",
      		type: "wDataDaily",
      		apiKey: "OPENWEATHERMAPAPIKEY", // your OpenWeatherMap API key
      		initialLoadDelay: 5000,
      		lat: 40.7128, // your latitude
      		lon: -74.0060, // your longitude
      		maxEntries: 7, // max 7, set by OWM One Call API
      		colored: true,
      		showPrecipitationAmount: true
      	}
      }
      

      Sample MagicMirror Output:
      Current, Hourly, and Daily Forecasts using the OpenWeatherMap One Call API

      Link to Branch

      Not making a pull request yet since I don’t know how the default Weather module is meant to be designed.

      1 Reply Last reply Reply Quote 1
      • F Offline
        Feedy88
        last edited by Jul 21, 2020, 11:06 AM

        Hey @lost,

        thanks for creating this. I am currently building my first mirror and have issues with the weather module from the master (only showing “Loading”) and hence wanted to try yours, as I am looking for hourly data anyways.

        However, I am a total noob to git and stuff, so I don’t know how to install your branch. Could you help me out here? Much appreciated in advance.

        1 Reply Last reply Reply Quote 0
        • J Offline
          julien-vancouver
          last edited by Jan 14, 2021, 10:39 PM

          Hi,

          Thanks for your work, ive tried using your config above and have run into two issues.

          {
          module: “weather”,
          position: “bottom_left”,
          header: “Current Forecast”,
          config: {
          weatherProvider: “openweathermap”,
          weatherEndpoint: “/onecall”,
          type: “wDataCurrent”,
          apiKey: “xxxxxxx”, // your OpenWeatherMap API key
          initialLoadDelay: 0,
          lat: 40.7128, // your latitude
          lon: -74.0060, // your longitude
          }
          },

          1. using the type: “wDataCurrent” results in “UNDEFINED”
            however if I change variable to Current, I then run into issue 2.

          2. loading. Similar to your original post, my screen remains forever loading and doesn’t load the retrieved values.

          any other thoughts or tips & tricks on how to resolve?

          1 Reply Last reply Reply Quote 0
          • I Offline
            icemanmw
            last edited by Jan 22, 2021, 6:19 PM

            i had the same problem and changed type: “wDataCurrent”, to type: “current”, because in the folder /home/pi/MagicMirror/modules/default/weather i found the files

            current.njk
            hourly.njk
            forecast.njk

            now is runs

            D 1 Reply Last reply Apr 13, 2021, 12:08 PM Reply Quote 0
            • D Offline
              dangarlen @icemanmw
              last edited by Apr 13, 2021, 12:08 PM

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • 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