Skip to content

Add Weather API Provider #4036

Open
angeldeejay wants to merge 2 commits intoMagicMirrorOrg:developfrom
angeldeejay:develop
Open

Add Weather API Provider #4036
angeldeejay wants to merge 2 commits intoMagicMirrorOrg:developfrom
angeldeejay:develop

Conversation

@angeldeejay
Copy link
Contributor

@angeldeejay angeldeejay commented Feb 15, 2026

Added Weather Provider for Weather API

Implementation of a weather provider for a new REST API.

Pull Requests:

APIs used

Config examples:

let config = {
  // ...
  modules: [
    {
      module: "weather",
      position: "top_right",
      config: {
        weatherProvider: "weatherapi",
        apiKey: <api key here>,
        lat: <number here>,
        lon: <number here>,
        type: "current",
        // ...
      }
    },
    {
      module: "weather",
      position: "top_right",
      config: {
        weatherProvider: "weatherapi",
        apiKey: <api key here>,
        lat: <number here>,
        lon: <number here>,
        type: "daily",
        // ...
      }
    },
    {
      module: "weather",
      position: "top_right",
      config: {
        weatherProvider: "weatherapi",
        apiKey: <api key here>,
        lat: <number here>,
        lon: <number here>,
        type: "hourly",
        // ...
      }
    },
}

Screenshots

image

Copy link
Collaborator

@KristjanESPERANTO KristjanESPERANTO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for implementing this new provider! I found some little issues during testing. Checkout the comments.

The module works with my changes 😃

weather.minTemperature = parseFloat(fd.day.mintemp_c);
weather.maxTemperature = parseFloat(fd.day.maxtemp_c);
weather.humidity = parseFloat(h.humidity);
weather.windSpeed = fd.day.maxwind_kph * 0.2778;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
weather.windSpeed = fd.day.maxwind_kph * 0.2778;
weather.windSpeed = parseFloat(h.wind_kph) * 0.2778;

I’d suggest using the hourly wind value (wind_kph) for each hourly forecast entry instead of the daily max wind.

Using the daily max can make hourly rows look too similar and less realistic, while the hourly value should better reflect how wind changes throughout the day.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You marked this as resolved, but I don't see any change. Or do you think my suggestion is wrong?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, now I see you changed it to weather.windSpeed = parseFloat(fd.day.maxwind_kph) * 0.2778;

but would'nt weather.windSpeed = parseFloat(h.wind_kph) * 0.2778; be better?

@angeldeejay
Copy link
Contributor Author

angeldeejay commented Feb 15, 2026

All requested changes were fixed now, @KristjanESPERANTO. Please take a look.

Question: Do you want me to make another PR to the master branch, or should we wait for the next release?

@KristjanESPERANTO
Copy link
Collaborator

KristjanESPERANTO commented Feb 16, 2026

Do you want me to make another PR to the master branch, or should we wait for the next release?

The master branch is only for releases. So your change will only be included in the next release. The next release will be on April 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants