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

Use native_unit_of_measurement to prevent recursion. #209

Merged
merged 2 commits into from
May 8, 2022

Conversation

pfetzing
Copy link
Contributor

@pfetzing pfetzing commented May 6, 2022

In RctPowerSensorEntity the device_class() method used to use unit_of_measurement() to get the unit of measurement for the entity. This no longer works, as with HA 2022.5.0 this implies a recursion back to unit_of_measurement() within the HA device_class() method to figure out if the entity is temperature based.
Thus using native_unit_of_measurement() instead.

In RctPowerSensorEntity the device_class() method used to use unit_of_measurement() to get the unit of measurement for the entity. This no longer works, as with HA 2022.5.0 this implies a recursion back to unit_of_measurement() within the HA device_class() method to figure out if the entity is temperature based.
Thus using native_unit_of_measurement() instead.
@weltenwort
Copy link
Owner

Hey @pfetzing, thanks for submitting this. I'll review it today!

@weltenwort weltenwort self-requested a review May 8, 2022 10:35
@weltenwort weltenwort added bug Something isn't working patch version This change warrants a patch release labels May 8, 2022
Copy link
Owner

@weltenwort weltenwort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for contributing the fix ❤️

@weltenwort weltenwort merged commit 9e1202d into weltenwort:main May 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working patch version This change warrants a patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants