ev_smart_charging icon indicating copy to clipboard operation
ev_smart_charging copied to clipboard

Ait

Open ksga opened this issue 10 months ago • 2 comments

Is your feature request related to a problem? Please describe. As mentioned here: https://github.com/jonasbkarlsson/ev_smart_charging/issues/350 I find it a bit wasteful to charge a few percent during cheapest hour (perhaps 2 AM), using up to 5 kWh to heat the battery during charging, having it cool down during the night, and then reheating when preconditioning the car again in the morning.

Describe the solution you'd like Setting a minimum charge percentage would not reduce the amount of energy used in the morning to prepare the car, but at least I would have a better charge efficiency during the cheapest hours.

Describe alternatives you've considered I decided to create a new action to the "car connected" automation to check the SOC sensor.battery against the desired charge level (defined in a number helper input_number.evsmart_charge_limit) and increase the EV charge limit if it is less than 10 percent below.

Additional context

if:
  - condition: state
    entity_id: sensor.charger_status_connector
    state: Preparing
then:
  - data: {}
    target:
      entity_id: switch.ev_smart_charging_ev_connected
    action: switch.turn_on
  - action: number.set_value
    data_template:
      value: >
        {% set charge_limit_difference = (states('input_number.evsmart_charge_limit') | int - states('sensor.battery') | int) %} 
        {% set charge_limit_adjusted = states('sensor.battery') | int + 10 %}  
        {% if charge_limit_difference  < 1 %}   
          {{ states('input_number.evsmart_charge_limit') | int }} 
        {% elif charge_limit_difference  < 11 %}   
          {{ ( [50, charge_limit_adjusted, 100] | sort ) [1] }} 
        {% else %}  
          {{ states('input_number.evsmart_charge_limit') | int }} 
        {% endif %}
    target:
      entity_id: number.charge_limit
else:
  - if:
      - condition: state
        entity_id: sensor.charger_status_connector
        state: Available
    then:
      - data: {}
        target:
          entity_id: switch.ev_smart_charging_ev_connected
        action: switch.turn_off

ksga avatar Jan 10 '25 02:01 ksga

Just realized that I should add an automation to set EV charge limit to the desired level when charging stops to make sure any surplus charge is used to prepare the car for departure before charging further... IE, I might plug it in at 76% SOC, wish for it to charge to 80%, hence charging it to 86% during cheapest hours. If the EV charge limit is then reset to 80% upon completion, I would have 6% of cheap power to prepare the car at 7AM, when electricity is at a premium, before the charger would be activated again.

The above of course assumes that you would leave the "keep charger on" option off

Trigger:

trigger: state
entity_id:
  - sensor.ev_smart_charging_status
from: charging

Action:

action: number.set_value
data_template:
  value: "{{ states('input_number.evsmart_charge_limit') | int }}"
target:
  entity_id: number.charge_limit

ksga avatar Jan 10 '25 02:01 ksga

Not sure I see any request from you here.

In my own case, I have the two cases when using preconditioning of the car before departure.

Short trips:

  • Target SOC: 80%
  • Keep charger on: OFF

Long trips:

  • Target SOC: 100%
  • Keep charger on: ON

For short trips, the SOC at departure will be a little lower than 80%, but since it's a short trip I'm ok with that.

For long trips, to have 100% SOC at departure is more important, and the use of more expensive electricity during preconditioning is unavoidable.

jonasbkarlsson avatar Jan 10 '25 08:01 jonasbkarlsson

Apologies—this is not a request but rather a discussion or suggestion for others facing a similar issue or concern. As mentioned, charging in cold conditions consumes significant energy to condition the battery, typically around 3-5 kWh per charging session. If the state of charge (SOC) is only slightly below the intended target, this results in poor efficiency (e.g., using 10 kWh to add 5 kWh to the battery is quite inefficient).

Since my daily commute only requires 20-30% of the charge, it does not make much difference whether I start with a 70% or 80% SOC. I eventually realized that instead of increasing the charge target when plugging in— when only a small percentage charge is needed—it is better to lower the target and skip charging that particular night or day. Then, during the next session, I can charge an additional day’s worth. This approach has improved my overall monthly charging efficiency from approximately 85% to 90%. While it may not seem like a substantial improvement, with a total monthly usage of 400-500 kWh, it accumulates to around 150 kWh over a winter season.

I charge to 100% once a week and maintain an 80% SOC for the rest of the time. For longer trips, I manually override the EV’s charging target to 100% after plugging it in. If planned charging is below 10%, the automation reduces target to 10% below SOC to avoid charging when preheating the car.

For those interested, my automation setup is as follows (as mentioned in first post, it requires a number helper defined as input_number.evsmart_charge_limit):

alias: EV
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.charger_status_connector
    id: "1"
  - trigger: state
    entity_id:
      - sensor.ev_smart_charging_status
    from: charging
    id: "2"
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - "1"
        sequence:
          - if:
              - condition: state
                entity_id: sensor.charger_status_connector
                state: Preparing
            then:
              - data: {}
                target:
                  entity_id: switch.ev_smart_charging_ev_connected
                action: switch.turn_on
              - action: number.set_value
                data_template:
                  value: >
                    {% set charge_limit_difference =
                    (states('input_number.evsmart_charge_limit') | int -
                    states('sensor.battery') | int) %} {%set
                    charge_limit_adjusted = states('sensor.battery')|int - 10
                    %}  {% if charge_limit_difference  < 1 %}   {{
                    states('input_number.evsmart_charge_limit')|int }} {% elif
                    charge_limit_difference  < 11 %}   {{ ([50,
                    charge_limit_adjusted, 100]|sort)[1] }} {%else%}  
                    {{states('input_number.evsmart_charge_limit')|int}}
                    {%endif%}
                target:
                  entity_id: number.charge_limit
            else:
              - if:
                  - condition: state
                    entity_id: sensor.charger_status_connector
                    state: Available
                then:
                  - data: {}
                    target:
                      entity_id: switch.ev_smart_charging_ev_connected
                    action: switch.turn_off
        alias: EV Connected to charger
      - conditions:
          - condition: trigger
            id:
              - "2"
        sequence:
          - action: number.set_value
            metadata: {}
            data_template:
              value: "{{states('input_number.evsmart_charge_limit')|int}}"
            target:
              entity_id: number.charge_limit
        alias: Reset charge limit when done
mode: queued
max: 10

ksga avatar Apr 23 '25 08:04 ksga