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
Resolve traceback error when using variables in template triggers #77287
Conversation
Hey there @PhracturedBlue, @tetienne, @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( |
Just doing a quick check on status. I have not seen these errors occur at all within my installation after implementing this fix and everything has been working fine related to it. |
The problem is caused by a regression introduced by #68275 Instead of this, we should fix the core/homeassistant/util/logging.py Lines 133 to 174 in 1a7784e
|
3887319
to
746e28a
Compare
I've reverted the change I initially did within the template and updated Let me know if these changes look good or further updates required. :-) |
Thanks @ehendrix23 ! Unfortunately, the more complicated solution I linked to is needed to avoid returning a coroutine function when wrapping a regular function. I updated the PR accordingly + added a test. It would be helpful if you can verify this also solves your problem. |
# Check for partials to properly determine if coroutine function | ||
check_func = action | ||
while isinstance(check_func, functools.partial): | ||
check_func = check_func.func |
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.
Not needed if you use inspect.iscoroutinefunction
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.
While it's not needed for inspect.iscoroutinefunction
, it's needed for is_callback
.
If we teach is_callback
about unwinding partials we can indeed drop it, that's for another PR though.
f47b7f8
to
d7a6d09
Compare
Thanks. I didn't think the more complex one was required but I guess I was wrong. :-) Tested on my local instance and issue is not occurring. So looks like this is working. Saw the comment from balloob. And you acknowledging but not sure if anything further is required as it looks like there was a force push but I don't see any difference in that section. :-) |
@ehendrix23 right, I first implemented @balloob's suggestion, then I realized we need the unwinding also for |
…7287) Co-authored-by: Erik <erik@montnemery.com>
Proposed change
Fix traceback error
NoneType can't be used in await expression
when using variables in template triggers.Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: