fixes to get rid of startup messages
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
- alias: Tesla failsafe charge
|
||||
trigger:
|
||||
- platform: time_pattern
|
||||
minutes: "/5"
|
||||
|
||||
condition:
|
||||
- condition: template
|
||||
- platform: template
|
||||
value_template: >
|
||||
{% set deadline_ts = as_timestamp(states('input_datetime.tesla_charge_deadline')) %}
|
||||
{% set now_ts = as_timestamp(now()) %}
|
||||
{{ (deadline_ts - now_ts) <= 3600 }}
|
||||
|
||||
{% if deadline_ts %}
|
||||
{% set now_ts = as_timestamp(now()) %}
|
||||
{{ (deadline_ts - now_ts) <= 3600 }}
|
||||
{% else %}
|
||||
false
|
||||
{% endif %}
|
||||
condition:
|
||||
- condition: numeric_state
|
||||
entity_id: sensor.tesla_kwh_needed
|
||||
above: 0
|
||||
|
||||
value_template: "{{ states('sensor.tesla_kwh_needed')|float(0) }}"
|
||||
action:
|
||||
- service: switch.turn_on
|
||||
target:
|
||||
|
||||
@@ -1,44 +1,61 @@
|
||||
- alias: Tesla smart charging v3
|
||||
mode: single
|
||||
id: tesla_smart_charging_v3
|
||||
mode: restart
|
||||
|
||||
trigger:
|
||||
- platform: time_pattern
|
||||
minutes: "/5"
|
||||
|
||||
condition:
|
||||
- condition: time
|
||||
before: input_datetime.tesla_charge_deadline
|
||||
# Ensure deadline is valid and in the future
|
||||
- condition: template
|
||||
value_template: >
|
||||
{% set deadline = states('input_datetime.tesla_charge_deadline') %}
|
||||
{{ deadline not in ['unknown','unavailable',''] and as_timestamp(deadline) > as_timestamp(now()) }}
|
||||
|
||||
# Only run when car is connected
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ states('binary_sensor.tesla_connected') == 'on' }}
|
||||
|
||||
action:
|
||||
- choose:
|
||||
|
||||
# -------------------------
|
||||
# Charge if cheap
|
||||
# -------------------------
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: binary_sensor.tesla_charge_now
|
||||
state: "on"
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ states('binary_sensor.tesla_charge_now') == 'on' }}
|
||||
|
||||
sequence:
|
||||
# Reset hvis session står i connected_finished
|
||||
# Reset charger if stuck in finished state
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ states('sensor.home_charger_mode') == 'connected_finished' }}"
|
||||
value_template: >
|
||||
{{ states('sensor.home_charger_mode') == 'connected_finished' }}
|
||||
sequence:
|
||||
- service: switch.turn_off
|
||||
target:
|
||||
entity_id: switch.home_charging
|
||||
- delay: "00:00:05"
|
||||
|
||||
# Turn charger on
|
||||
- service: switch.turn_on
|
||||
target:
|
||||
entity_id: switch.home_charging
|
||||
|
||||
# -------------------------
|
||||
# Stop charging if not cheap
|
||||
# -------------------------
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: binary_sensor.tesla_charge_now
|
||||
state: "off"
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ states('binary_sensor.tesla_charge_now') != 'on' }}
|
||||
|
||||
sequence:
|
||||
- service: switch.turn_off
|
||||
target:
|
||||
entity_id: switch.home_charging
|
||||
entity_id: switch.home_charging
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# template for "Tesla stop when charged"
|
||||
- alias: Tesla stop when charged
|
||||
trigger:
|
||||
- platform: template
|
||||
value_template: >
|
||||
{{ (states('sensor.snowywhite_battery') | default(0)) | float >=
|
||||
(states('number.snowywhite_charge_limit') | default(100)) | float }}
|
||||
|
||||
{{ (states('sensor.snowywhite_battery')|float(0)) >=
|
||||
(states('number.snowywhite_charge_limit')|float(100)) }}
|
||||
action:
|
||||
- service: switch.turn_off
|
||||
target:
|
||||
entity_id: switch.home_charging
|
||||
entity_id: switch.home_charging
|
||||
|
||||
Reference in New Issue
Block a user