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:
parent
0a2ff3a676
commit
683c2f8d22
6 changed files with 229 additions and 6 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue