-
-
Notifications
You must be signed in to change notification settings - Fork 32k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Call services directly #18720
RFC: Call services directly #18720
Conversation
I will not fix the tests until I got some feedback about this idea. |
What event info are we loosing with this? There's still an event fired after executing the service, right? |
So we will still fire an event that we're executing a service and that shares the context with all following changes. The only event that is missing is "service executed", which always only contained an ID to map it back to the blocked service call. The thing we're getting is that for blocking calls we get direct feedback that the service doesn't exist or if the data is invalid, which we can now communicate back to the caller. The timeout eventually can also move out of the core and should really be controlled by the caller. |
d4ebe3b
to
990e878
Compare
Apparently this was missed with the 0.84 updates home-assistant/core#18720
Apparently this was missed with the 0.84 updates home-assistant/core#18720
Apparently this was missed with the 0.84 updates home-assistant/core#18720
Description:
We used to call services via the event bus. This was done to be more event driven. This also allowed back in the day to get multiple Home Assistants working together. This functionality was never fully implemented and has since been deprecated and removed.
This PR aims to simplify the service calling code. We still distinguish between blocking and non-blocking, but now exceptions are able to propagate up. This is especially important for tracking incidents with the unauthorized exception.
This is an RFC. I mainly wanted to see how fast it would be to get done… and it was fairly simple. It's a backwards compatible change.
Breaking change: The
service_executed
event is no longer being fired when a service is done.Checklist:
tox
. Your PR cannot be merged unless tests passIf the code does not interact with devices: