I have two tesla cars I want to be able to charge.
I have some flows to start/stop charging and modify the amps and switch to 1phase or 3 phase charging.
But then I need to make duplicates of all these automations with the only difference the name of the car.
How can I simplify this?
I was thinking of a function that runs on the selected car name?
Here is an example of the code where ************ is the name of the car.
Is there a way to run the automation with *************** = value of a variable
Variable is set before running the automation.
So when I get home, I plug in the car and select the car that needs to be charged and I select in what condition it has to charge. (pur solar, solar with some degree of grid, charge with no restrictions except captar (max power of the house))
Thx
Kevin
alias: YQS Start charging
description: ""
trigger:
- platform: numeric_state
entity_id: sensor.p1_meter_5c2faf055da6_active_power
below: input_number.start_charging_at
for:
hours: 0
minutes: 3
seconds: 0
condition:
- condition: state
entity_id: device_tracker.*******************_location_tracker
state: home
- condition: state
entity_id: switch.*******************_charger
state: "off"
action:
- service: switch.turn_on
data: {}
target:
entity_id:
- switch.*******************_polling
- switch.*******************_charger
- service: number.set_value
data:
value: "5"
target:
entity_id: number.*******************_charging_amps
- service: notify.mobile_app_keviniphone12
data:
message: YQS start charging
- service: automation.turn_on
data: {}
target:
entity_id:
- automation.yqs_charging_stop
- automation.yqs_charging_flow
- service: tesla_custom.polling_interval
data:
scan_interval: 29
- wait_for_trigger: []
timeout:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- service: automation.turn_off
data:
stop_actions: true
target:
entity_id: automation.yqs_start_charging
mode: single