-
-
Notifications
You must be signed in to change notification settings - Fork 28.6k
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
Remove service helper (5) #16917
Remove service helper (5) #16917
Conversation
|
||
|
||
CONFIG_PATH = 'scripts.yaml' | ||
|
||
|
||
@bind_hass | ||
def async_reload(hass): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be tagged with @callback
as it calls an async method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, from looking at the code, it should be an async
function. The old code worked because it would actually schedule the async_call, but that seems weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async def async_reload(hass):
await hass.services.async_call(DOMAIN, SERVICE_RELOAD)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticed it myself while looking at config/group.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@balloob that is slow:
def async_reload(hass):
"""This function return a coroutine."""
return hass.services.async_call(DOMAIN, SERVICE_RELOAD)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit slower but it gives proper stack traces. I don't want to do the old way anymore.
light.async_turn_on(light_id, | ||
transition=LIGHT_TRANSITION_TIME.seconds, | ||
profile=light_profile) | ||
hass.async_add_job( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hass.async_create_task(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean hass.async_create_task()
?
A deprecation warning beforehand would have been nice. It broke a custom_component (circadian-lighting) out of the sudden, which was not so nice. |
@vanto I'm sorry it broke your custom component. However in that case deprecation warnings weren't an option. Just going over all of them once took long enough, not to think of doing it twice. It's true, this could have been better communicated although using |
Description:
Additional work for: home-assistant/architecture#58
Checklist:
tox
. Your PR cannot be merged unless tests pass