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

🔧 replace deprecated constants #1461

Merged
merged 2 commits into from
Dec 31, 2023
Merged

🔧 replace deprecated constants #1461

merged 2 commits into from
Dec 31, 2023

Conversation

caibinqing
Copy link
Contributor

Fix error in HA 2024.1

see https://developers.home-assistant.io/blog/2023/12/19/constant-deprecation

This increase the minimum HA version requirement to 2022.11

Copy link
Contributor

@codyc1515 codyc1515 left a comment

Choose a reason for hiding this comment

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

Haven’t tried it yet but looks good to me.

@@ -92,7 +92,7 @@ def update_bind_sensor(self):
if num is not None:
cls = sta.attributes.get(ATTR_DEVICE_CLASS)
unit = sta.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
if cls == SensorDeviceClass.TEMPERATURE.value or unit in [TEMP_CELSIUS, TEMP_KELVIN, TEMP_FAHRENHEIT]:
if cls == SensorDeviceClass.TEMPERATURE.value or unit in [UnitOfTemperature.CELSIUS, UnitOfTemperature.KELVIN, UnitOfTemperature.FAHRENHEIT]:
Copy link
Owner

Choose a reason for hiding this comment

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

Required v2022.11.0

'electric_current': ELECTRIC_CURRENT_AMPERE,
'voltage': ELECTRIC_POTENTIAL_VOLT,
'power_consumption': UnitOfEnergy.WATT_HOUR,
'electric_current': UnitOfElectricCurrent.AMPERE,
Copy link
Owner

Choose a reason for hiding this comment

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

Required v2023.1.0

@@ -108,7 +108,7 @@ def should_poll(self):
@property
def source_type(self):
"""Return the source type, eg gps or router, of the device."""
return SOURCE_TYPE_GPS
return SourceType.GPS
Copy link
Owner

Choose a reason for hiding this comment

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

Required v2022.9.0

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.

Breaking changes in HA 2024.1 beta
3 participants