dingo35 / ha-SmartEVSEv3

Integrate SmartEVSEv3 with HomeAssistant through custom component
13 stars 8 forks source link

Update deprecated constants in const.py #20

Closed hmmbob closed 8 months ago

hmmbob commented 8 months ago

HA 2024.1.0b2 throws the following warnings:

2023-12-31 12:18:14.373 WARNING (MainThread) [homeassistant.const] TEMP_CELSIUS was used from smartevse, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfTemperature.CELSIUS instead, please create a bug report at https://github.com/dingo35/ha-SmartEVSEv3/issues
2023-12-31 12:18:14.380 WARNING (MainThread) [homeassistant.const] ELECTRIC_CURRENT_AMPERE was used from smartevse, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfElectricCurrent.AMPERE instead, please create a bug report at https://github.com/dingo35/ha-SmartEVSEv3/issues
2023-12-31 12:18:14.384 WARNING (MainThread) [homeassistant.const] ENERGY_KILO_WATT_HOUR was used from smartevse, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfEnergy.KILO_WATT_HOUR instead, please create a bug report at https://github.com/dingo35/ha-SmartEVSEv3/issues
2023-12-31 12:18:14.389 WARNING (MainThread) [homeassistant.const] POWER_KILO_WATT was used from smartevse, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfPower.KILO_WATT instead, please create a bug report at https://github.com/dingo35/ha-SmartEVSEv3/issues
2023-12-31 12:18:14.393 WARNING (MainThread) [homeassistant.const] TIME_MINUTES was used from smartevse, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfTime.MINUTES instead, please create a bug report at https://github.com/dingo35/ha-SmartEVSEv3/issues
2023-12-31 12:18:14.399 WARNING (MainThread) [homeassistant.components.sensor] STATE_CLASS_MEASUREMENT was used from smartevse, this is a deprecated constant which will be removed in HA Core 2025.1. Use SensorStateClass.MEASUREMENT instead, please create a bug report at https://github.com/dingo35/ha-SmartEVSEv3/issues
2023-12-31 12:18:14.404 WARNING (MainThread) [homeassistant.components.sensor] STATE_CLASS_TOTAL_INCREASING was used from smartevse, this is a deprecated constant which will be removed in HA Core 2025.1. Use SensorStateClass.TOTAL_INCREASING instead, please create a bug report at https://github.com/dingo35/ha-SmartEVSEv3/issues
2023-12-31 12:18:14.407 WARNING (MainThread) [homeassistant.components.sensor] STATE_CLASS_MEASUREMENT was used from smartevse, this is a deprecated constant which will be removed in HA Core 2025.1. Use SensorStateClass.MEASUREMENT instead, please create a bug report at https://github.com/dingo35/ha-SmartEVSEv3/issues
2023-12-31 12:18:14.412 WARNING (MainThread) [homeassistant.components.sensor] STATE_CLASS_TOTAL_INCREASING was used from smartevse, this is a deprecated constant which will be removed in HA Core 2025.1. Use SensorStateClass.TOTAL_INCREASING instead, please create a bug report at https://github.com/dingo35/ha-SmartEVSEv3/issues
2023-12-31 12:18:14.418 WARNING (MainThread) [homeassistant.const] PRESSURE_BAR was used from smartevse, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfPressure.BAR instead, please create a bug report at https://github.com/dingo35/ha-SmartEVSEv3/issues
2023-12-31 12:18:14.422 WARNING (MainThread) [homeassistant.const] TEMP_CELSIUS was used from smartevse, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfTemperature.CELSIUS instead, please create a bug report at https://github.com/dingo35/ha-SmartEVSEv3/issues
2023-12-31 12:18:14.426 WARNING (MainThread) [homeassistant.const] VOLUME_CUBIC_METERS was used from smartevse, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfVolume.CUBIC_METERS instead, please create a bug report at https://github.com/dingo35/ha-SmartEVSEv3/issues

With this PR, all of those are fixed. Tested locally, works fine.

Fixes #19

hmmbob commented 8 months ago

By the way, PRESSURE_BAR and VOLUME_CUBIC_METERS weren't actually used so I dropped those.

dingo35 commented 8 months ago

Thanks for your work!

I really like to keep stuff compatible, I assume adopting these changes would make the integration incompatible with older HA versions?

So we now have a choice, either clobber the code with "if HA VERSION then ... else ....",

Or just wait until december 2024, and then put this PR in.

Unless all 2023 versions are compatible with the new code?

hmmbob commented 8 months ago

Lemme check that. It's documented somewhere, but out for some groceries now. I'll get back to this!

hmmbob commented 8 months ago

They've been around for a year already, and all HA 2023.x versions should be compatible:

Link to dev blog posts for 2022.11 and 2023.1