Add service for getting a weather forecast (#97078)

* Add service for getting a weather forecast

* Fix translations

* Improve service description

* Improve error handling

* Adjust typing

* Adjust typing

* Adjust service response format
This commit is contained in:
Erik Montnemery 2023-08-07 14:05:37 +02:00 committed by GitHub
parent 0a2ff3a676
commit 683c2f8d22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 229 additions and 6 deletions

View file

@ -9,6 +9,7 @@ from homeassistant.components import websocket_api
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.util.json import JsonValueType
from .const import DOMAIN, VALID_UNITS, WeatherEntityFeature
@ -80,7 +81,7 @@ async def ws_subscribe_forecast(
return
@callback
def forecast_listener(forecast: list[dict[str, Any]] | None) -> None:
def forecast_listener(forecast: list[JsonValueType] | None) -> None:
"""Push a new forecast to websocket."""
connection.send_message(
websocket_api.event_message(