jonasbkarlsson / ev_smart_charging

Electric vehicle smart charging for Home Assistant.
MIT License
140 stars 19 forks source link

Charger is turned off at end of smart charging window even with "smart charging activated" is "off" and "keep charger on" is "on" #162

Closed goodyear77 closed 10 months ago

goodyear77 commented 1 year ago

Version of the custom_component

Version 1.7.0

Configuration

First off, love the integration! I have "smart charging activated" set to "off", "keep charger on" set to "on", and the charge box is turned on.

Describe the bug

At 3:55 pm today, the charger was turned off by service call "switch.turn_off", even with "smart charging activated" is "off" and "keep charger on" is "on". This was when I disconnected the charger from the car.

I would assume that the expected behavior when "smart charging activated" is "off" and "keep charger on" is "on" is that the integration doesn't change the state of the charger?

In fact, shouldn't calls to the charger be disabled/blocked when either of the toggles "smart charging activated" is "off" and "keep charger on" is "on"?

It's almost as if a condition to check these two settings is not executed before implementing the smart charge logic? If my understanding is correct that is :)

goodyear77 commented 1 year ago

Update: managed to catch a potential culprit, which is the automation that informs if the EV is connected:

Screen Shot 2023-03-15 at 16 29 56

When I disconnected my EV the integration switched off the charger, which I guess is fine since there isn't a car connected, but then, when I connect the car to charger again, it doesn't turn on the charger although the automation correctly turns on the entity switch.ev_smart_charging_ev_connected:

image

Feels like there is some logic missing here; if the "keep charger on" toggle is set to "on" then the charger shouldn't be turned off in the first place when the car is disconnected? And if the "Smart charging activated" toggle is "off" then it shouldn't turn off/on the charger either?

And finally, if the charger is turned off when the car is disconnected, why isn't it turned on when it's plugged back in? I'm assuming that it's waiting for the charging window, but since the "Smart charging activated" toggle is "off" AND "keep charger on" toggle is set to "on", it should turn on the charger immediately?

jonasbkarlsson commented 1 year ago

The "smart charging activated" should normally always be "on". Turning it "off" will completely disable the integration (including the "keep charger on" function). There might be cases when that could make sense, but normally it should be better to leave it "on" and let the integration control the charger.

If you use "keep charger on", then you need to have an automation that controls the switch.ev_smart_charging_ev_connected, and that you seem to have.

Assuming "keep charger on" is "on", when you connect the car, and there is a need to charge, the charger will not be turn on immedately. Instead it will wait until the scheduled charging, and turn on the charger at that time. And then after charging, the charger will be kept on.

goodyear77 commented 1 year ago

Understood, and it makes sense when I want to use the “keep charger on” option to use the charger for preheating in the morning for example.

So I tried to set “smart charging activated” to “off”, “keep charger on” option to “off”, and then disconnect the car, and the integration still turns off the charger when disconnecting the car.

I would have expected if I set “smart charging activated” to “off”, meaning I disable the integration, then it should stop controlling my charger?

image

jonasbkarlsson commented 1 year ago

I agree. Setting “smart charging activated” to “off” should stop it controlling your charger. I will fix that.

goodyear77 commented 1 year ago

Perfect, thank you so much and keep up the good work, this integrationen is excellent!

jonasbkarlsson commented 1 year ago

Fixed by #164. Will be part of next release.

goodyear77 commented 1 year ago

Hi, just wondering if you have any timeline on the next release? I don't mean to rush you, just wondering 😊

jonasbkarlsson commented 1 year ago

Hi, unfortunately, I got a few other things that I needed to focus on, so I haven't had any time for this project lately. Hopefully I will get more time in August. Sorry for the slow response.

jonasbkarlsson commented 10 months ago

This is now part of a pre-release, v1.9.0-dev2. An ordinary release v1.9.0 will come soon.

jonasbkarlsson commented 10 months ago

Fixed in release v1.9.0.