jonasbkarlsson / ev_smart_charging

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

Reconfigure when you set start time later than now #170

Closed woopstar closed 1 year ago

woopstar commented 1 year ago

If you set the start time before now, the sensor is updated and charge schedules are re-calculated.

If you then, while it's charging, set the start time to later, the sensor is not updated and the schedules are not re-calculated.

I just tested by setting the start time to 14.00. Charging began. Then changed the start time to 15.00 as only thing, but the charging did not stop and the charge schedule was not re-calculated to the new start time.

Running version v1.8.0

jonasbkarlsson commented 1 year ago

Yes, that's how it's implemented. "When the automatic charging has started, changes of settings will not have any effect." If you need to stop an on-going charging in this case, you can deactive/active the integration by toggling the switch.ev_smart_charging_smart_charging_activated.

woopstar commented 1 year ago

So if you change the start time - let's say from automation - and it's already running, then you need to deactivate/activate it again.

woopstar commented 1 year ago

Something like this:

  - if:
      - condition: template
        value_template: >-
          {{ now() < state_attr('sensor.ev_smart_charging_charging','Charging start time') }}
      - condition: state
        entity_id: sensor.ev_smart_charging_charging
        state: "on"
    then:
      - service: switch.turn_off
        data: {}
        target:
          entity_id: switch.ev_smart_charging_smart_charging_activated
      - service: switch.turn_on
        data: {}
        target:
          entity_id: switch.ev_smart_charging_smart_charging_activated
jonasbkarlsson commented 1 year ago

I'm not sure about what the "if"-part does, but the "then"-part should make sure that any on-going charging will be stopped if the settings have been changed in such a way that a newly calculated schedule would not do charging now.