Call a service and return its response
ws_call_serviceCall a Home Assistant action over WebSocket and return its response data. Use when you need the action's response payload, not just changed states.
Instructions
Call a Home Assistant action over WebSocket and return its response data.
Sends call_service with return_response=True always set, so actions
that support a response (e.g. weather.get_forecasts,
calendar.get_events) return it; actions without one (light.turn_on,
most control actions) fail with a validation error. domain/service
must match [A-Za-z0-9_]+ (ADR-0006 D3) or the call is refused first.
Refuses hassio.addon_stop/app_stop/addon_stdin/app_stdin against
nexus's own add-on (self_protection.is_own_addon); addon_restart/
app_restart stay allowed. Outright refuses the eight services
services_call_service gates behind confirm (ADR-0006 D5) — none
support a response (F1).
Use when: the action's response payload is needed, not just the changed
states.
Not for: a plain control action, or one of the eight guarded services —
use services_call_service for both.
Returns: raw WS result: {success, result: {context, response}} on
success, or a failure dict from HA; {"success": False} if no result
message arrives.
Errors: raises RuntimeError on a handshake timeout; {"error": "invalid_service_name"} for a malformed domain/service; {"error": "self_addon_hassio_service_blocked", "message": ...} for a blocked
hassio.* case; {"error": "guarded_service_refused", "message": ..., "use": "services_call_service"} for a guarded service.
Limits: blocks for up to timeout seconds (default 10), including the
initial handshake.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | Service data: fields plus targets (entity_id/area_id/device_id). Omit for a call that needs no data. | |
| domain | Yes | Service domain to call, e.g. 'weather' or 'calendar'. | |
| service | Yes | Service name within the domain, e.g. 'get_forecasts' or 'get_events'. | |
| timeout | No | Maximum seconds to wait for the WebSocket handshake and the result message before giving up; must be between 1 and 300. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||