Skip to content

await in deprecated get_attr #88

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

Merged
merged 1 commit into from
Nov 10, 2020

Conversation

dlashua
Copy link
Contributor

@dlashua dlashua commented Nov 10, 2020

This PR will prevent the error:

TypeError: argument of type 'coroutine' is not iterable

In the following code:

@time_trigger('startup')
def test():
    a = state.get_attr('sun.sun')

    for attrib in a:
        log.info(attrib)

@craigbarratt craigbarratt merged commit 43aa488 into custom-components:master Nov 10, 2020
@craigbarratt
Copy link
Member

Oh no! I committed the sin of making a "simple" change without adding a test, and right before a release. Sigh.

@craigbarratt
Copy link
Member

At least it will get people to use the new function...

@dlashua
Copy link
Contributor Author

dlashua commented Nov 10, 2020

Haha. I wouldn't sweat it. It was time for me to start using getattr anyway. :) I had some "old" (relatively speaking, anyway) code that I hadn't worked on in a while. So I was surprised to see it start throwing errors. :)

@dadler
Copy link

dadler commented Nov 26, 2020

FYI, this temporary breaking change just bit me too (in the 1.0.0 release). If the fix isn't released soon, I wonder if it'd be worth temporarily mentioning the bug in the reference documentation and release notes in HACS, which currently indicate get_attr is deprecated but works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants