evcc icon indicating copy to clipboard operation
evcc copied to clipboard

Tesla with Home Assistant Vehicle Integration

Open WiesiDeluxe opened this issue 1 year ago • 17 comments

Describe the bug

I have Tesla Fleet succesfully integrated to Home Assistant (self hosted key with nginx) - from Home Assistant i can controll loading Amp, Start Loading, Stop Loading everything working...

in evcc is not working, get error "set charge current limit 16A: vehicle not capable of current control" (same with less A)

what can be wrong?

Steps to reproduce

1.plug in vehicle to twc3 2.if pv mode and evcc set the A error occured

Configuration details

site:
  title: S6
  meters:
    grid: Sigenstor-Grid
    pv: Sigenstor-PV
    battery: Sigenstor

sponsortoken: XXX
plant: XXX

loadpoints:
  - title: CarPort
    charger: TWC
    vehicle: MYPha

chargers:
  - name: TWC
    type: template
    template: twc3
    host: XXX

tariffs:
  currency: EUR
  grid:
    type: fixed
    price: 0.10  # EUR/kWh
  feedin:
    type: fixed
    price: 0.02  # EUR/kWh

vehicles:
  - name: MYPha
    type: template
    template: homeassistant
    title: Tesla Model Y Performance
    capacity: 82 # Battery capacity (kWh), optional
    uri: http://XXX:8123 # Home Assistant URI, HTTP(S) address
    token: XXX
    soc: sensor.tesla_batteriestand
    range: sensor.tesla_batteriereichweite
    status: binary_sensor.tesla_status
    limitSoc: number.tesla_ladelimit
    odometer: sensor.tesla_kilometerzahler
    climater: climate.tesla_klima
    finishTime: sensor.tesla_zeit_zum_vollstandigen_aufladen
    start_charging: script.tesla_start_charge # Service to start charging, optional
    stop_charging: script.tesla_stop_charge # Service to stop charging, optional
    wakeup: button.tesla_wecken
    icon: car # Icon, Will be displayed in the user interface [car, bike, bus, moped, motorcycle, rocket, scooter, taxi, tractor, rickshaw, shuttle, van, airpurifier, battery, bulb, climate, coffeemaker, compute, cooking, cooler, desktop, device, dishwasher, dryer, floorlamp, generic, heater, heatexchange, heatpump, kettle, laundry, laundry2, machine, meter, microwave, pump, smartconsumer, tool, waterheater] (optional)
    phases: 3 # Maximum number of phases, The maximum number of phases which can be used (optional)
    mode: PV # Default charging mode, Used when a vehicle is connected. Possible values are Off, Now, MinPV and PV, or empty if none should be set (optional)
    minCurrent: 6 # Minimum amperage (A), The minimum amperage per connected phase that can be used (optional)
    maxCurrent: 16 # Maximum amperage (A), The maximum amperage per connected phase that can be used (optional)
    priority: # Priority, Priority of the loadpoint or vehicle in relation to other loadpoints or vehicles for allocating pv energy (optional)

Log details

[site  ] DEBUG 2025/08/19 13:54:46 ----
[lp-1  ] DEBUG 2025/08/19 13:54:46 charge power: 11162W
[lp-1  ] DEBUG 2025/08/19 13:54:46 charge currents: [15.9 16 16]A
[site  ] DEBUG 2025/08/19 13:54:46 grid power: -1683W
[site  ] DEBUG 2025/08/19 13:54:46 battery 1 power: 2W
[site  ] DEBUG 2025/08/19 13:54:46 battery 1 soc: 100%
[site  ] DEBUG 2025/08/19 13:54:46 pv 1 power: 15890W
[site  ] DEBUG 2025/08/19 13:54:46 !! solar production: accumulate add Sigenstor-PV 0.000W power (was: Accumulated: 1.123kWh updated: 2025-08-19 13:54:36 +0200 CEST)
[site  ] DEBUG 2025/08/19 13:54:46 !! solar production: accumulate moved Sigenstor-PV from 1.123 to 1.167
[site  ] DEBUG 2025/08/19 13:54:46 site power: -1681W
[lp-1  ] DEBUG 2025/08/19 13:54:46 charge voltages: [234 233 232]V
[lp-1  ] DEBUG 2025/08/19 13:54:46 detected connected phases: 3p
[lp-1  ] DEBUG 2025/08/19 13:54:46 detected active phases: 3p
[lp-1  ] DEBUG 2025/08/19 13:54:46 charger status: C
[lp-1  ] DEBUG 2025/08/19 13:54:46 soc estimated: 79.45% (vehicle: 79.00%)
[lp-1  ] DEBUG 2025/08/19 13:54:46 vehicle soc: 79%
[lp-1  ] DEBUG 2025/08/19 13:54:46 vehicle soc limit: 80%
[lp-1  ] DEBUG 2025/08/19 13:54:46 vehicle range: 347km
[lp-1  ] ERROR 2025/08/19 13:54:46 set charge current limit 16A: vehicle not capable of current control

What type of operating system or environment does evcc run on?

HomeAssistant Add-on

External automation

  • [x] I have made sure that no external automation like HomeAssistant or Node-RED is active or accessing any of the mentioned devices when this issue occurs.

Nightly build

  • [x] I have verified that the issue is reproducible with the latest nightly build

Version

0.207.3

WiesiDeluxe avatar Aug 19 '25 12:08 WiesiDeluxe

in evcc is not working, get error "set charge current limit 16A: vehicle not capable of current control" (same with less A)

SetMaxCurrent is missing from config and/or template. I think we did eventually not implement this, but could be added.

/cc @thecem

andig avatar Aug 19 '25 13:08 andig

do you mean my config miss something or your implemention? if its my config, what should i add? thx

WiesiDeluxe avatar Aug 19 '25 14:08 WiesiDeluxe

I will have a look this weekend and will implement SetMaxCurrent.

thecem avatar Aug 19 '25 15:08 thecem

any news on this?

thx

WiesiDeluxe avatar Aug 30 '25 09:08 WiesiDeluxe

Instead of using TeslaFleet try this. https://github.com/PedroKTFC/esphome-tesla-ble

I use it for both my Tesla's, it works like a charm. Local (BT) control so no rate-limiting etc. Can send commands every 4s (time the car takes to process).

Knuppel1983 avatar Sep 07 '25 15:09 Knuppel1983

Instead of using TeslaFleet try this. https://github.com/PedroKTFC/esphome-tesla-ble

Thanks, but this is about the evcc home assistant car communcation which is not fully working and not about other ways to communicate with the Tesla, maybe after 3 weeks thecem can look on that this weekend ;)

WiesiDeluxe avatar Sep 07 '25 15:09 WiesiDeluxe

Same issue here with identical error

I'm experiencing exactly the same problem with the same error message: "vehicle not capable of current control".

My setup:

  • Tesla integration with Home Assistant works perfectly
  • I can control charging (start/stop, amperage) directly from Home Assistant without any issues
  • evcc can read all vehicle data (SoC, range, status) through the Home Assistant integration
  • However, evcc fails to control the charging current with the same error

What I'm trying to achieve:

I would like to be able to control Tesla charging through evcc while using Home Assistant as the integration layer, since the HA integration is working flawlessly.

This seems to be a specific issue with evcc's ability to send current control commands through the Home Assistant template, even though HA itself has full control capabilities over the Tesla vehicle.

Has anyone found a workaround or solution for this? It would be great to get evcc's PV charging logic working with Tesla through the existing HA integration.

cmer81 avatar Sep 10 '25 18:09 cmer81

@cmer81 did you fix the problem? I don´t get it managed to set maxcurrent back to ha. even not with the custom vehicle.

@andig:

could you have a look and tell us when will be the (maxcurrent) called?

#maxcurrent: # set max charge current
#    source: js
#    script: console.log(maxcurrent);

AI ist stating in vehicle it will be never called only in charger, is this right?

thecem avatar Sep 11 '25 07:09 thecem

You still need a charger- either TWC or https://github.com/evcc-io/evcc/pull/23273.

andig avatar Sep 11 '25 08:09 andig

So why is in "Benutzerdefiniertes Gerät" getmaxcurrent und maxcurrent in?

title: green Honda
icon: car
capacity: 50 # kWh

## required attributes

soc: # state of charge
  source: const
  value: 42 # %

## optional attributes (read-only)

#limitsoc: # in-vehicle charge limit
#  source: const
#  value: 80 # %
#status: # status [A..F]
#  source: const
#  value: "A"
#range: # range
#  source: const
#  value: 123 # km
#climater: # climate active
#  source: const
#  value: true
#getmaxcurrent: # max charge current
#  source: const
#  value: 16.0 # A
#finishtime: # finish time (RFC3339)
#  source: const
#  value: "2030-01-01T00:00:00Z"

## optional attributes (writeable)

#wakeup: # wake up vehicle
#    source: js
#    script: console.log(wakeup);
#chargeenable: # start/stop charging
#    source: js
#    script: console.log(chargeenable);
#maxcurrent: # set max charge current
#    source: js
#    script: console.log(maxcurrent);

thecem avatar Sep 11 '25 09:09 thecem

In order for the charger to be able to call this on the vehicle. Not sure I understand the question here.

andig avatar Sep 11 '25 10:09 andig

I´d expected that the maxcurrent (from evcc to vehicle) and getmaxcurrent (from vehicle to evcc) is seted and shown via UI max charge current. I configured a custom vehicle and used this on a normal LP (go-e).

When I test with ./evcc vehicle test_vehicle -i 7 the value will be setted in the vehicle. ./evcc vehicle test_vehicle shows the value setted in vehicle.

So the question is when will it be setted to vehicle and when it will be used in evcc in normal evcc operation?

thecem avatar Sep 11 '25 12:09 thecem

In all cases: Loadpoint -> Charger. If you have a specific charger (again: TWC or the new Vehicle API charger) this becomes Loadpoint -> Charger -> Vehicle. Get: same way, plus answer.

andig avatar Sep 11 '25 13:09 andig

thx, working.

@cmer81 Mine is working but github tests fail so may you pr your one then i would delete mine.

Custom vehicle configuration for Home Assistant
vehicles:
  - name: custom_ha_vehicle
    title: Custom HA vehicle via API
    type: custom
    icon: car
    capacity: 77 # kWh
    
    ## required attributes
    
    soc: # state of charge
      source: http
      uri: http://your_ha_ip:8123/api/states/sensor.vehicle_green_state_of_charge
      method: GET
      headers:
        - content-type: application/json
        - authorization: Bearer eyJ0eXAiOiJKV....
      insecure: false
      jq: .state | tonumber
      scale: 1 
      timeout: 3s
    
    ## optional attributes (read-only)
    
    limitsoc: # in-vehicle charge limit
      source: http
      uri: http://your_ha_ip:8123/api/states/number.vehicle_green_target_state_of_charge
      method: GET
      headers:
        - content-type: application/json
        - authorization: Bearer eyJ0eXAiOiJKV....
      insecure: false
      jq: .state
      scale: 1 
      timeout: 3s

    odometer: # odometer
      source: http
      uri: http://your_ha_ip:8123/api/states/sensor.vehicle_green_odometer
      method: GET
      headers:
        - content-type: application/json
        - authorization: Bearer eyJ0eXAiOiJKV....
      insecure: false
      jq: .state | tonumber
      scale: 1 
      timeout: 3s

    status: # status [A..F]
      source: http
      uri: http://your_ha_ip:8123/api/states/sensor.vehicle_green_charging_state
      method: GET
      headers:
        - content-type: application/json
        - authorization: Bearer eyJ0eXAiOiJKV....
      insecure: false
      jq: |
        .state | ascii_downcase | 
        if . == "c" or . == "charging" or . == "on" or . == "true" or . == "active" then "C"
        elif . == "b" or . == "connected" or . == "ready" or . == "plugged" or . == "charging_completed" or . == "initialising" then "B"
        elif . == "a" or . == "disconnected" or . == "off" or . == "none" or . == "unavailable" or . == "unknown" or . == "notreadyforcharging" or . == "not_plugged" then "A"
        else "A"
        end
      scale: 1 
      timeout: 3s

    range: # range
      source: http
      uri: http://your_ha_ip:8123/api/states/sensor.vehicle_green_range
      method: GET
      headers:
        - content-type: application/json
        - authorization: Bearer eyJ0eXAiOiJKV....
      insecure: false
      jq: .state
      scale: 1 
      timeout: 3s

    climater: # climate active
      source: http
      uri: http://your_ha_ip:8123/api/states/sensor.vehicle_green_climatisation_state
      method: GET
      headers:
        - content-type: application/json
        - authorization: Bearer eyJ0eXAiOiJKV....
      insecure: false
      jq: |
        .state | ascii_downcase | 
        if . == "on" or . == "true" or . == "active" or . == "heating" or . == "cooling" then true
        else false
        end
      scale: 1 
      timeout: 3s

    getmaxcurrent: # max charge current
      source: http
      uri: http://your_ha_ip:8123/api/states/input_number.vehicle_green_max_current
      method: GET
      headers:
        - content-type: application/json
        - authorization: Bearer eyJ0eXAiOiJKV....
      insecure: false
      jq: .state | tonumber
      scale: 1 
      timeout: 3s
         
    finishtime: # finish time (RFC3339)
      source: http
      uri: http://192.168.76.100:8123/api/states/sensor.vehicle_green_charging_end_time
      method: GET
      headers:
        - content-type: application/json
        - authorization: Bearer eyJ0eXAiOiJKV....
      insecure: false
      jq: |
        if .state == "unknown" or .state == "unavailable" or .state == null or .state == "" then
          "2030-01-01T00:00:00Z"
        else
          # Try to parse the date and ensure RFC3339 format
          .state | if test("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}") then
            if test("Z$|[+-]\\d{2}:\\d{2}$") then . else . + "Z" end
          else
            "2030-01-01T00:00:00Z"
          end
        end
      scale: 1 
      timeout: 3s

    
    ## optional attributes (writeable)
    
    wakeup: # wake up vehicle
      source: http
      uri: http://your_ha_ip:8123/api/services/script/turn_on
      method: POST
      headers:
        - content-type: application/json
        - authorization: Bearer eyJ0eXAiOiJKV....
      insecure: false
      body: '{"entity_id": "script.vehicle_green_wakeup"}'
      jq: '.'
      timeout: 3s

    chargeenable: # start/stop charging
      source: http
      uri: http://your_ha_ip:8123/api/services/script/turn_on
      method: POST
      headers:
        - content-type: application/json
        - authorization: Bearer eyJ0eXAiOiJKV....
      insecure: false
      body: '{"entity_id": "{{if .enable}}script.vehicle_green_laden_starten{{else}}script.vehicle_green_laden_stoppen{{end}}"}'
      jq: '.'
      timeout: 3s
    
    maxcurrent: # set max charge current for input_number entity
      #source: js
      #script: console.log("TTT", maxcurrent);

      source: http
      uri: http://your_ha_ip:8123/api/services/input_number/set_value
      method: POST
      headers:
        - content-type: application/json
        - authorization: Bearer eyJ0eXAiOiJKV....
      insecure: false
      body: '{"entity_id": "input_number.test", "value": "{{.maxcurrent}}"}'
      jq: '.'
      timeout: 3s

thecem avatar Sep 11 '25 15:09 thecem

Seems this has been resolved.

andig avatar Sep 19 '25 16:09 andig

sorry for maybe stupid question, for me is not resolved, because still not working, wait for update or adapt config, what should i do that this works ? Greets thomas

WiesiDeluxe avatar Sep 19 '25 21:09 WiesiDeluxe

You could use this https://github.com/evcc-io/evcc/issues/23109#issuecomment-3281434800, or you have to wait up to a new one https://github.com/evcc-io/evcc/pull/23681

thecem avatar Sep 20 '25 04:09 thecem