-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Describe the feature
In the near term, I’m planning on adding a little MCP server translation layer to make it easier for people requesting a forecast for AI tools. To make this happen, the API needs to have some new capabilities to filter the responses.
Add query params to the existing forecast endpoint so callers can:
1. choose which forecast blocks to include (blocks=...)
2. request only specific indices from array blocks:
• daily_indices=...
• hourly_indices=...
• day_night_indices=...
This must be backward compatible with existing clients using exclude.
⸻
- API design (implement exactly)
1.1 New query params
Add these optional query parameters to:
GET /forecast/{api_key}/{lat_and_long_or_time}
A) blocks (string, CSV)
• Comma-separated allowlist of blocks to include.
• Allowed values:
• currently, minutely, hourly, daily, day_night, alerts, flags
• If blocks is provided: include only those blocks (subject to exclude removal).
• If not provided: preserve existing default behavior.
B) {daily,hourly,day_night}_indices (string, CSV of ints)
• daily_indices selects items from daily.data
• hourly_indices selects items from hourly.data
• day_night_indices selects items from day_night.data (see section 3)
Rules for each *_indices param:
• Format: CSV list of non-negative integers, e.g. 0,1,2,6
• The input list must be in order and contain valid index values, otherwise return an error.
IMPORTANT NOTES:
- Implement the indexing as a final step in the response process script to avoid causing backwards compatibility and dependency issues.
- implement the block selection via the existing exclude approach by converting a block parameter into a collection of excludes.
Acknowledgements
- This issue is related to the self-hosting code and not an API or Home Assistant feature request.
- I have written an informative title.