44 lines
2.7 KiB
JSON
44 lines
2.7 KiB
JSON
[
|
|
{
|
|
"id": "Tesla Charge Current",
|
|
"automation": "- alias: Tesla Charge Current\n description: Regulates the charging current to finish charging at approximately\n 6:30.\n triggers:\n - minutes: /15\n trigger: time_pattern\n conditions:\n - condition: and\n conditions:\n - condition: state\n entity_id: device_tracker.location\n state: home\n - condition: state\n entity_id: sensor.charging\n state: charging\n for:\n hours: 0\n minutes: 10\n seconds: 0\n actions:\n - variables:\n full_ts: '{{ as_timestamp(states(''sensor.time_to_full_charge''))|int }}'\n now_ts: '{{ as_timestamp(now())|int }}'\n desired_ts: \"{{ as_timestamp(\\n now().replace(hour=6, minute=35, second=0)\\n\\\n \\ )|int }}\"\n difference: '{{ full_ts - now_ts }}'\n delta: '{{ (full_ts - now_ts) - (desired_ts - now_ts) }}'\n current_amp: '{{ states(''number.charge_current'')|int(default=24) }}'\n min_amp: 16\n max_amp: 32\n step: '{% if delta > 7200 %} 3 {% elif delta > 3600 %} 2 {% else %} 1 {% endif\n %}'\n - choose:\n - conditions:\n - condition: template\n value_template: '{{ delta > 600 }}'\n - condition: template\n value_template: '{{ current_amp < max_amp }}'\n sequence:\n - data:\n entity_id: number.charge_current\n value: '{{ min(max_amp, current_amp + step) }}'\n action: number.set_value\n - conditions:\n - condition: template\n value_template: '{{ delta < -600 }}'\n - condition: template\n value_template: '{{ current_amp > min_amp }}'\n sequence:\n - data:\n entity_id: number.charge_current\n value: '{{ max(min_amp, current_amp - step) }}'\n action: number.set_value\n default: []\n mode: single",
|
|
"config": [
|
|
{
|
|
"name": "location device tracker",
|
|
"room": null,
|
|
"type": "device_tracker",
|
|
"id": {
|
|
"entity_id": "device_tracker.location",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "charging sensor",
|
|
"room": null,
|
|
"type": "sensor",
|
|
"id": {
|
|
"entity_id": "sensor.charging",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "time to full charge sensor",
|
|
"room": null,
|
|
"type": "sensor",
|
|
"id": {
|
|
"entity_id": "sensor.time_to_full_charge",
|
|
"device_id": null
|
|
}
|
|
},
|
|
{
|
|
"name": "charge current number",
|
|
"room": null,
|
|
"type": "number",
|
|
"id": {
|
|
"entity_id": "number.charge_current",
|
|
"device_id": null
|
|
}
|
|
}
|
|
]
|
|
}
|
|
] |