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

Add forecast service call for extra attributes for nws #32729

Merged

Conversation

MatthewFlamm
Copy link
Contributor

@MatthewFlamm MatthewFlamm commented May 13, 2024

Proposed change

Documentation for new service to return extra data for forecasts that are not yet supported by weather platform. For home-assistant/core#117254.

Type of change

  • Spelling, grammar or other readability improvements (current branch).
  • Adjusted missing or incorrect information in the current documentation (current branch).
  • Added documentation for a new integration I'm adding to Home Assistant (next branch).
  • Added documentation for a new feature I'm adding to Home Assistant (next branch).
  • Removed stale or deprecated documentation.

Additional information

Checklist

  • This PR uses the correct branch, based on one of the following:
    • I made a change to the existing documentation and used the current branch.
    • I made a change that is related to an upcoming version of Home Assistant and used the next branch.
  • The documentation follows the Home Assistant documentation standards.

Summary by CodeRabbit

  • New Features

    • Introduced nws.get_forecasts_extra for more detailed weather forecasts, including attributes like type, datetime, is_daytime, detailed_description, and short_description.
  • Documentation

    • Updated documentation to explain the new nws.get_forecasts_extra action and the expanded response data structure, including usage examples.

@home-assistant home-assistant bot added has-parent This PR has a parent PR in a other repo next This PR goes into the next branch labels May 13, 2024
Copy link

netlify bot commented May 13, 2024

Deploy Preview for home-assistant-docs ready!

Name Link
🔨 Latest commit b6a3369
🔍 Latest deploy log https://app.netlify.com/sites/home-assistant-docs/deploys/669a14c5d184df0008859998
😎 Deploy Preview https://deploy-preview-32729--home-assistant-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Sudo-Rob
Copy link

I've always thought the requirements for a platform using heterogeneous APIs should be a common baseline and not a limit. This is in the direction of goodness.

| `datetime` | The time of the forecasted conditions. | 2023-02-17T14:00:00+00:00
| `is_daytime` | Only set for `twice_daily` forecasts. | True
| `detailed_description` | Only set for `twice_daily` forecasts. | 50% Chance of rain, otherwise partly cloudy with a high of 75F.
| `dewpoint` | Dewpoint in F | 52
Copy link
Member

Choose a reason for hiding this comment

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

Please align with the resulting core PR 👍

@home-assistant home-assistant bot marked this pull request as draft July 18, 2024 14:28
@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@gjohansson-ST gjohansson-ST added the parent-merged The parent PR has been merged already label Jul 18, 2024
@MatthewFlamm MatthewFlamm marked this pull request as ready for review July 18, 2024 18:47
@home-assistant home-assistant bot requested a review from gjohansson-ST July 18, 2024 18:48
Copy link
Contributor

coderabbitai bot commented Jul 18, 2024

Walkthrough

Walkthrough

The changes introduce a new action nws.get_forecasts_extra in the nws.markdown file, enhancing weather forecast capabilities. This functionality includes additional attributes such as type, datetime, is_daytime, detailed_description, and short_description, providing a more comprehensive view of forecast data. The response structure has been updated accordingly, and the documentation has been revised to incorporate details about this new action and its usage.

Changes

Files Change Summary
source/_integrations/nws.markdown Introduced the nws.get_forecasts_extra action for enhanced weather forecasts, including attributes like type, datetime, and descriptions. Documentation updated to reflect these changes.

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8980b7f and b6a3369.

Files selected for processing (1)
  • source/_integrations/nws.markdown (1 hunks)
Additional context used
LanguageTool
source/_integrations/nws.markdown

[style] ~50-~50: This phrase is redundant. Consider writing “point” or “time”.
Context: ...ist of forecasted conditions at a given point in time that are not returned from `weather.get...

(MOMENT_IN_TIME)


[uncategorized] ~57-~57: Possible missing preposition found.
Context: ...ition | Partly Sunny then Slight Chance Showers And Thunderstorms | ## Details Detail...

(AI_EN_LECTOR_MISSING_PREPOSITION)

Markdownlint
source/_integrations/nws.markdown

31-31: Expected: 0 or 2; Actual: 1
Trailing spaces

(MD009, no-trailing-spaces)

Additional comments not posted (1)
source/_integrations/nws.markdown (1)

59-61: LGTM!

The section providing additional details about the API looks good.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@MatthewFlamm
Copy link
Contributor Author

I updated based on the changes in the core PR, also I needed to make some changes due to a recent change in language from service->action. Hopefully I captured that change correctly here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Outside diff range, codebase verification and nitpick comments (1)
source/_integrations/nws.markdown (1)

29-34: Consider adding a link to the NWS API documentation for nws.get_forecasts_extra.

Providing a direct link to the API documentation can help users understand the new action better.

+ For more details, see the [NWS API documentation](https://www.weather.gov/documentation/services-web-api).

source/_integrations/nws.markdown Outdated Show resolved Hide resolved
source/_integrations/nws.markdown Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Outside diff range, codebase verification and nitpick comments (1)
source/_integrations/nws.markdown (1)

31-33: Clarify the relationship between nws.get_forecasts_extra and weather.get_forecasts.

The documentation mentions that nws.get_forecasts_extra provides extra data similar to weather.get_forecasts. It would be helpful to clarify if nws.get_forecasts_extra is an extension or a replacement of weather.get_forecasts.

- `nws.get_forecasts_extra` provides extra data in a form similar to `weather.get_forecasts`.
+ `nws.get_forecasts_extra` provides additional forecast data that complements the data from `weather.get_forecasts`.

Comment on lines +49 to +50
The response data field is a mapping of called target entities, each containing the `forecast` field.
`forecast` is a list of forecasted conditions at a given point in time that are not returned from `weather.get_forecasts`. The `datetime` and `is_daytime` attributes are still provided for context.
Copy link
Contributor

@coderabbitai coderabbitai bot Jul 18, 2024

Choose a reason for hiding this comment

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

Fix redundancy in the description.

The phrase "at a given point in time" is redundant.

- `forecast` is a list of forecasted conditions at a given point in time that are not returned from `weather.get_forecasts`.
+ `forecast` is a list of forecasted conditions at a point in time that are not returned from `weather.get_forecasts`.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
The response data field is a mapping of called target entities, each containing the `forecast` field.
`forecast` is a list of forecasted conditions at a given point in time that are not returned from `weather.get_forecasts`. The `datetime` and `is_daytime` attributes are still provided for context.
The response data field is a mapping of called target entities, each containing the `forecast` field.
`forecast` is a list of forecasted conditions at a point in time that are not returned from `weather.get_forecasts`. The `datetime` and `is_daytime` attributes are still provided for context.
Tools
LanguageTool

[style] ~50-~50: This phrase is redundant. Consider writing “point” or “time”.
Context: ...ist of forecasted conditions at a given point in time that are not returned from `weather.get...

(MOMENT_IN_TIME)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The phrasing "forecast is a list of forecasted conditions at a given point in time" is mirrored from the parent weather.get_forecasts action. This language should be kept consistent.

Copy link
Contributor

Choose a reason for hiding this comment

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

@MatthewFlamm Thank you for pointing out the importance of maintaining consistency with the weather.get_forecasts documentation. I agree that we should keep the phrasing "at a given point in time" to ensure uniformity across the documentation.

Analysis chain
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for the `weather.get_forecasts` action documentation to verify the phrasing.
rg "weather.get_forecasts" -A 10

Length of output: 9388

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the weather.get_forecasts documentation language is changed, we should change here in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

@MatthewFlamm Thank you for the clarification. I agree that if the weather.get_forecasts documentation language is updated in the future, we should also update the nws.get_forecasts_extra documentation to maintain consistency.

source/_integrations/nws.markdown Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
source/_integrations/nws.markdown Outdated Show resolved Hide resolved
source/_integrations/nws.markdown Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Comment on lines +52 to +57
| Response data | Description | Example |
| ---------------------- | ----------- | -------- |
| `datetime` | The time of the forecasted conditions. | 2023-02-17T14:00:00+00:00 |
| `is_daytime` | Only set for `twice_daily` forecasts. | True |
| `detailed_description` | Only set for `twice_daily` forecasts. | 50% Chance of rain, otherwise partly cloudy with a high of 75F. |
| `short_description` | Short weather condition | Partly Sunny then Slight Chance Showers And Thunderstorms |
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix table formatting and remove redundancy in description.

The table rows are missing trailing pipes, and the description of the forecast field is redundant.

| Response data | Description | Example |
| ---------------------- | ----------- | -------- |
| `datetime` | The time of the forecasted conditions. | 2023-02-17T14:00:00+00:00 |
| `is_daytime` | Only set for `twice_daily` forecasts. | True |
| `detailed_description` | Only set for `twice_daily` forecasts. | 50% Chance of rain, otherwise partly cloudy with a high of 75F. |
| `short_description` | Short weather condition | Partly Sunny then Slight Chance Showers And Thunderstorms |

Additionally, update the description to remove redundancy:

-`forecast` is a list of forecasted conditions at a given point in time that are not returned from `weather.get_forecasts`.  The `datetime` and `is_daytime` attributes are still provided for context.
+`forecast` is a list of forecasted conditions at a point in time that are not returned from `weather.get_forecasts`. The `datetime` and `is_daytime` attributes are still provided for context.
Tools
LanguageTool

[uncategorized] ~57-~57: Possible missing preposition found.
Context: ...ition | Partly Sunny then Slight Chance Showers And Thunderstorms | ## Details Detail...

(AI_EN_LECTOR_MISSING_PREPOSITION)

Comment on lines +35 to +37
| Data attribute | Optional | Description | Example |
| ---------------------- | -------- | ----------- | --------|
| `type` | no | The type of forecast, must be either `twice_daily` or `hourly`. | `twice_daily` |
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix table formatting and improve attribute description.

The table rows are missing trailing pipes, and the description for the type attribute should specify the forecast types.

| Data attribute | Optional | Description | Example |
| ---------------------- | -------- | ----------- | --------|
| `type` | no | The type of forecast, must be either `twice_daily` or `hourly`. | `twice_daily` |

Committable suggestion was skipped due to low confidence.

Comment on lines +31 to +33
## Action `nws.get_forecasts_extra`

`nws.get_forecasts_extra` provides extra data in a form similar to `weather.get_forecasts`. See [`weather.get_forecasts` documentation](/integrations/weather/action--weatherget_forecasts).
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix trailing spaces and align terminology.

Remove trailing spaces and align the terminology with the rest of the document.

-## Action `nws.get_forecasts_extra` 
+## Action `nws.get_forecasts_extra`
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## Action `nws.get_forecasts_extra`
`nws.get_forecasts_extra` provides extra data in a form similar to `weather.get_forecasts`. See [`weather.get_forecasts` documentation](/integrations/weather/action--weatherget_forecasts).
## Action `nws.get_forecasts_extra`
`nws.get_forecasts_extra` provides extra data in a form similar to `weather.get_forecasts`. See [`weather.get_forecasts` documentation](/integrations/weather/action--weatherget_forecasts).
Tools
Markdownlint

31-31: Expected: 0 or 2; Actual: 1
Trailing spaces

(MD009, no-trailing-spaces)

Copy link
Contributor

@c0ffeeca7 c0ffeeca7 left a comment

Choose a reason for hiding this comment

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

Thank you, @MatthewFlamm 👍

@c0ffeeca7
Copy link
Contributor

@gjohansson-ST, are you good with the changes?

@gjohansson-ST
Copy link
Member

@c0ffeeca7 I'm good with it 👍

@c0ffeeca7 c0ffeeca7 merged commit 9727262 into home-assistant:next Jul 19, 2024
6 checks passed
@home-assistant home-assistant bot removed the parent-merged The parent PR has been merged already label Jul 19, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jul 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has-parent This PR has a parent PR in a other repo next This PR goes into the next branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants