Skip to content

Modify Charge Limit

Pierre Belanger edited this page Mar 12, 2024 · 3 revisions

There are a few settings for a car that can only be set using the API-calls.

One of them is the setting of the charge limit. To simplify this, you can easily create a script. The info here is only available as an example.

Script

tesla_set_charge_limit_soc:
  alias: Tesla Set Charge Limit SOC
  mode: restart
  sequence:
  - service: tesla_custom.api
    data:
      command: CHANGE_CHARGE_LIMIT
      parameters:
        path_vars:
          vehicle_id: "{{ state_attr('binary_sensor.my_car_online_sensor', 'id') }}"
        percent: "{{ states('input_number.my_car_charge_limit') | int(default=90) }}"
        wake_if_asleep: true

This script uses an input_number as the source for the limit, but this can of course be changed to whatever you want. Currently Tesla doesn't allow setting the charge limit below 50%.

Input Number

my_car_charge_limit:
  name: My Car Charge Limit
  min: 50
  max: 100
  step: 5
  icon: mdi:battery
  unit_of_measurement: '%'

The script is now pretty easy to trigger in an automation. Just adjust the input_number to the value you want, and call the script as a service.

Automation

(...)
  action:
  - service: input_number.set_value
    data:
      entity_id: input_number.my_car_charge_limit
      value: 100
  - service: script.tesla_set_charge_limit_soc