jonasbkarlsson / ev_smart_charging

Electric vehicle smart charging for Home Assistant.
MIT License
139 stars 18 forks source link

`ev_smart_charging` calls `async_track_state_change` instead of `async_track_state_change_event` which is deprecated (HA 2024.5) #261

Closed hmmbob closed 3 weeks ago

hmmbob commented 1 month ago

Version of the custom_component

Version 1.10.0

Describe the bug

Subject says it all. Similar to #252 but now another one ;-)

Debug log

Detected that custom integration 'ev_smart_charging' calls `async_track_state_change` instead of `async_track_state_change_event` which is deprecated and will be removed in Home Assistant 2025.5 at custom_components/ev_smart_charging/coordinator.py, line 416
BrainDra1n commented 1 month ago

This example might help making the necessary change: https://developers.home-assistant.io/blog/2024/04/13/deprecate_async_track_state_change/

jonasbkarlsson commented 1 month ago

Thanks for pointing this out. I have made a branch where this has been fixed. But since this new way is supported from HA 2024.5.5 (and not supported by HA 2024.5.4), I simplified the code by start using this from HA 2024.6. So I would like to wait for HA 2024.6 before committing this to the main branch.

BrainDra1n commented 1 month ago

I see your predicament. I trust that you will publish the branch when possible.

I have recently discovered this integration. I have started using this with ENTSO-e, my BMW and Webasto Unite wallbox. And it works fine. So glad that you have created this. Hopefully you will be able to maintain it as well.

I have also tweaked your source code to improve planning when tomorrows prices are not yet available. When this turns out to be useful, I will post this. It is based on the best possible weather prediction in the Netherlands: same as yesterday. I have implemented this as: when tomorrows prices are not yet available, use todays prices for tomorrow as well. Let's see if this works in practice and then I will share this.

hmmbob commented 1 month ago

Thanks for pointing this out. I have made a branch where this has been fixed. But since this new way is supported from HA 2024.5.5 (and not supported by HA 2024.5.4), I simplified the code by start using this from HA 2024.6. So I would like to wait for HA 2024.6 before committing this to the main branch.

Gotcha. just a note that 2024.6 beta also throws the same warning (as expected I'd say), just as for #252 as well

hmmbob commented 3 weeks ago

Thanks for pointing this out. I have made a branch where this has been fixed. But since this new way is supported from HA 2024.5.5 (and not supported by HA 2024.5.4), I simplified the code by start using this from HA 2024.6. So I would like to wait for HA 2024.6 before committing this to the main branch.

Confirming that that branch fixes the issue on 2024.6.0. Thanks much!

jonasbkarlsson commented 3 weeks ago

Fixed by #268 and included in release v1.10.1.