Skip to content

[Feature] Websocket support #189

@o0Zz

Description

@o0Zz

Hi,

It seems that Home Assistant is moving away from maintaining the REST API in favor of the WebSocket API, as indicated by discussions on various forums. Due to this shift, the REST API has limited support for certain features, such as retrieving forecast data. Specifically, calling a service like get_forecasts does not work properly via the REST API, as it doesn't support returning data responses (even when using return_response=True).

For example, the following code:

response = client.trigger_service("weather", "get_forecasts", 
                                  entity_id='weather.home', 
                                  type='hourly', 
                                  return_response=True)

results in a 500 error.

Related issues are tracked here:

Issue #106379
Issue #99820
Currently, the only reliable way to call this service and receive a response is through the WebSocket API, which complicates things if this library doesn't natively support WebSocket connections.

Here's a reference on how to interact with the WebSocket API in Python: https://jeroenboumans.medium.com/listening-to-the-home-assistent-websocket-api-with-python-7a074f8c81ea

Would you be open to supporting WebSocket integration in this library? It would make it much easier to interact with Home Assistant services moving forward.

Thanks for your time and consideration!

Sub-issues

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions