Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: allow specifying a location name when using the /onecall endpoint in the OpenWeatherMap module #3704

Closed
1 task done
efkann opened this issue Jan 25, 2025 · 2 comments

Comments

@efkann
Copy link

efkann commented Jan 25, 2025

What problem do you want to solve with this change?

Hi,

With the recent changes in OpenWeatherMap, version 2.5 has been deprecated, and version 3.0 is now the default.

But the /onecall endpoint returns a timezone rather than a location name. Currently, the returned timezone is used to set the location in the module.

if (this.config.weatherEndpoint === "/onecall") {
currentWeather = this.generateWeatherObjectsFromOnecall(data).current;
this.setFetchedLocation(`${data.timezone}`);

if (this.config.weatherEndpoint === "/onecall") {
forecast = this.generateWeatherObjectsFromOnecall(data).days;
location = `${data.timezone}`;

What do you think is the correct solution?

Since the user already provides the lat and lon values in the configuration, I see no harm in adding an optional field like locationName to use when the endpoint is set to /onecall.

What do you think ?

I’d be happy to submit a PR to implement these changes.

Participation

  • I am willing to submit a pull request for this change.

Additional comments

I understand that there's already a location field in the config, but this field is consumed with other endpoints. So, I believe it wouldn't be a good practice to reuse the same field for a different purpose in the /onecall endpoint.

@sdetweil
Copy link
Collaborator

sdetweil commented Jan 25, 2025

just use the module header option

{
module:"weather",
position:"....",
header:"whatever you want",
config:{
   appendLocationToHeader:false,
    other config parms
  }
)

@efkann
Copy link
Author

efkann commented Jan 25, 2025

just use the module header option { module:"weather", position:"....", header:"whatever you want", config:{ appendLocationToHeader:false, other config parms } )

Didn't know this was possible, thanks.

@efkann efkann closed this as completed Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants