Most correct way to add return_response parameter to a service #191
-
|
I need to make a call to I get the following error: And I can confirm from intercepting the HTTP requests that they don't have the requtn_response parameter. But I can't work out how to add a parameter. If I add a params parameter then the trigger_service method in the rawclient.py file puts the service data under the keyword "json". There's no option to provide any keywords that will survive to the requests level. To achieve this result, I need to take the method and set the service_id to have the parameter on the end. This seems like a really bad idea, in case it causes more problems downstream, changing something that is named an ID. Should there be a way to do this more correctly, such as taking kwargs like "params" and putting them into the request? Perhaps just allowing parameters to be supplied with methods optionally and passing them all the way to the actual request? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
You can set Although, you're right that's not a good solution. I'll open an issue about it and we can continue the conversation on how to address it there. |
Beta Was this translation helpful? Give feedback.
-
|
Historically the REST API would only return the json data for states that changed while a service was triggered. But as of PR home-assistant/core#115046 services can return data instead of those state changes Upon further consideration I think in addition to being able to pass request-level parameters to service calls, it might also be worthwhile to have |
Beta Was this translation helpful? Give feedback.
Historically the REST API would only return the json data for states that changed while a service was triggered. But as of PR home-assistant/core#115046 services can return data instead of those state changes
Upon further consideration I think in addition to being able to pass request-level parameters to service calls, it might also be worthwhile to have
return_responsesbe its own built-in parameter so we can adjust the parsing logic of the service call responses.