Skip to content
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

Adapt to changes in HA Core PR 113798 #1337

Merged
merged 3 commits into from
Mar 20, 2024

Conversation

emontnemery
Copy link
Contributor

Fix import typo
Fix old_entity_Id in event_data
@andrew-codechimp
Copy link
Owner

Thanks for the notification on this. Do you know when this change will be released in Core? As a custom component I have to support backward compatibility to some degree and this breaks under my current target of 2023.11

@emontnemery
Copy link
Contributor Author

emontnemery commented Mar 20, 2024

This will be included in Home Assistant Core 2024.4.0, you need to set that as the minimum HA version when you've merged this.
You could also check the type of the parameter, something like this, for backwards compatibility:

if type(event_data) is Event:  # Intentionally avoid `isinstance` because it's slow and we trust `Event` is not subclassed
    event_data = event_data.data

@andrew-codechimp
Copy link
Owner

Thanks for the pointer, I'm a fairly new custom component dev so this is the first breaking change I've had to deal with.
I'll type check until I can wean users off the old HA versions.
I see you reference this PR in issues on other repo's so good to have this option of handling it as a pattern.

@andrew-codechimp andrew-codechimp merged commit 6eb8efb into andrew-codechimp:main Mar 20, 2024
5 checks passed
andrew-codechimp added a commit that referenced this pull request Apr 18, 2024
* Adapt to changes in HA Core PR 113798

* Update sensor.py

Fix import typo
Fix old_entity_Id in event_data

* Add check for event_data type

---------

Co-authored-by: Andrew Jackson <[email protected]>
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.

2 participants