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

Use shortForecast when detailedForecast is empty in NWS #121920

Closed
wants to merge 1 commit into from

Conversation

karwosts
Copy link
Contributor

Proposed change

For NWS forecasts, I would like to propose to populate detailed_description from shortForecast when detailedForecast is empty.

I don't know if this is common for all NWS stations or just mine, but my NWS API response for hourly forecasts always have a shortForecast only, and an empty string for detailForecast.

This is normally fine, but when the condition is Exceptional, it is hard get information as to the actual reason. E.g. before this PR, the forecast returned will say :

- detailed_description: ""
  condition: exceptional

After this change, it will return:

- detailed_description: Haze
  condition: exceptional

I think that would be a helpful change.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant
Copy link

Hey there @MatthewFlamm, @kamiyo, mind taking a look at this pull request as it has been labeled with an integration (nws) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of nws can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign nws Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@karwosts karwosts changed the title NWS: use shortForecast when detailForecast is empty NWS: use shortForecast when detailedForecast is empty Jul 14, 2024
@MatthewFlamm
Copy link
Contributor

MatthewFlamm commented Jul 14, 2024

Since you mention the hourly forecast, which does not have a detailed forecast, this is a bit tricky.

The immediate problem is that this attribute is unsupported for the forecast in a weather entity. See #114799. There is a PR to fix this at #117254.

After that PR is merged, I propose that we add the data from the "shortForecast" key to the new service call return.

@karwosts
Copy link
Contributor Author

Thanks Matthew. I will draft this and we can revisit after your other PR is merged.

@karwosts karwosts marked this pull request as draft July 14, 2024 12:06
@MartinHjelmare MartinHjelmare changed the title NWS: use shortForecast when detailedForecast is empty Use shortForecast when detailedForecast is empty in NWS Jul 14, 2024
@karwosts
Copy link
Contributor Author

Closing as my issue is reolved by #117254

@karwosts karwosts closed this Jul 18, 2024
@MatthewFlamm
Copy link
Contributor

I did not intend to preempt your PR with my PR, but needed to include this info to ensure we returned something for both weather types. Thank you for helping contribute!

@karwosts karwosts deleted the nws-short-forecast branch July 18, 2024 18:08
@github-actions github-actions bot locked and limited conversation to collaborators Jul 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants