EVcharge_PRO: WIP2 stop OK, need test of setting charged value
This commit is contained in:
@@ -140,6 +140,10 @@ actions:
|
||||
value_template: "{{ is_state(use_entity1_var, 'on') }}"
|
||||
then: # EVcharge entity_1 (eg front) charge is requested
|
||||
sequence:
|
||||
# set stop button to off
|
||||
- action: input_boolean.turn_off
|
||||
target:
|
||||
entity_id: input_boolean.evcharge_pro_stop
|
||||
- repeat: # send message to all recipient-list members
|
||||
for_each: "{{ recipient_list_notification }}"
|
||||
sequence:
|
||||
@@ -162,32 +166,34 @@ actions:
|
||||
|
||||
# Start plug1 and wait until power measured is below input_number.evcharge_no_charge_threshold for 10 minutes = 600 seconds
|
||||
- action: switch.turn_on
|
||||
# automation.apri_cancellettoentity_id: !input evcharge_entity1
|
||||
entity_id: switch.presa_smart_1 # TEST ONLY
|
||||
entity_id: !input evcharge_entity1
|
||||
# entity_id: switch.presa_smart_1 # TEST ONLY
|
||||
|
||||
# need to wait car to start charging
|
||||
# - delay: 120
|
||||
- delay: 10 # TEST ONLY
|
||||
- delay: 120
|
||||
# - delay: 10 # TEST ONLY
|
||||
|
||||
# Wait for charging to complete
|
||||
- repeat:
|
||||
until:
|
||||
- condition: and
|
||||
- condition: or
|
||||
conditions:
|
||||
- "{{ ( states('input_number.test_evcharge_front') | int) < (states('input_number.evcharge_no_charge_threshold') | int) }}" # TEST ONLY
|
||||
# - "{{ ( states(evcharge_entity1_power_var) | int ) < ( states('input_number.evcharge_no_charge_threshold') | int ) }}"
|
||||
- "{{ isstate('input_boolean.let_run')}}"
|
||||
# - "{{ ( states('input_number.test_evcharge_front') | int) < (states('input_number.evcharge_no_charge_threshold') | int) }}" # TEST ONLY
|
||||
- "{{ ( states(evcharge_entity1_power_var) | int ) < ( states('input_number.evcharge_no_charge_threshold') | int ) }}"
|
||||
- "{{ is_state('input_boolean.evcharge_pro_stop', 'on') }}"
|
||||
|
||||
sequence:
|
||||
- variables:
|
||||
energy1_while_var: >-
|
||||
{% from 'template_library.jinja' import getenergy_id %}
|
||||
{{ getenergy_id(evcharge_entity1_var) }}
|
||||
energy1_while: "{{ states(energy1_while_var ) }}"
|
||||
energy1_while: "{{ states(evcharge_entity1_energy_var) }}"
|
||||
evcharge_entity1_energy_charged: "{{ ((energy1_while | float| round(2)) - energy1_before )| float | round(2) }}"
|
||||
|
||||
# - delay: 120
|
||||
- delay: 10 # TEST ONLY
|
||||
- action: homeassistant.update_entity
|
||||
data:
|
||||
entity_id: "input_number.evcharge_front_charged"
|
||||
state: "{{ evcharge_entity1_energy_charged }}"
|
||||
|
||||
- delay: 120
|
||||
# - delay: 10 # TEST ONLY
|
||||
|
||||
# take energy counter after charging
|
||||
- variables:
|
||||
@@ -195,12 +201,12 @@ actions:
|
||||
|
||||
# turn off evcharge_entity1
|
||||
- action: switch.turn_off
|
||||
# entity_id: !input evcharge_entity1
|
||||
entity_id: switch.presa_smart_1 # TEST ONLY
|
||||
entity_id: !input evcharge_entity1
|
||||
# entity_id: switch.presa_smart_1 # TEST ONLY
|
||||
- delay: 10
|
||||
- action: switch.turn_off
|
||||
# entity_id: !input evcharge_entity1
|
||||
entity_id: switch.presa_smart_1 # TEST ONLY
|
||||
entity_id: !input evcharge_entity1
|
||||
# entity_id: switch.presa_smart_1 # TEST ONLY
|
||||
|
||||
- repeat: # send message to all recipient-list members
|
||||
for_each: "{{ recipient_list_notification }}"
|
||||
@@ -222,76 +228,89 @@ actions:
|
||||
# wait couple of minutes before starting charge on plug2
|
||||
# - delay: 120
|
||||
- delay: 10 # TEST ONLY
|
||||
# - if:
|
||||
# - condition: template
|
||||
# value_template: "{{ is_state(use_entity2_var, 'on') }}"
|
||||
# then:
|
||||
# sequence:
|
||||
# # then start plug2 and wait until power measured is below input_number.evcharge_no_charge_threshold for 10 minutes = 600 seconds
|
||||
# - repeat: # send message to all recipient-list members
|
||||
# for_each: "{{ recipient_list_notification }}"
|
||||
# sequence:
|
||||
# - action: "{{ repeat.item }}"
|
||||
# metadata: {}
|
||||
# data:
|
||||
# message: >-
|
||||
# "EVcharge process on {{ evcharge_entity2_var }} has started"
|
||||
# title: EV Charge process
|
||||
# - action: notify.tiziano_trabattoni_gmail_com
|
||||
# data:
|
||||
# title: "EVcharge process on {{ evcharge_entity2_var }} has started"
|
||||
# target: "{{ recipient_list_gmail['target'] }}"
|
||||
# message: >-
|
||||
# "EVcharge process on {{ evcharge_entity2_var }} has started"
|
||||
#
|
||||
# # take energy counter before charging
|
||||
# - variables:
|
||||
# energy2_before: "{{ states(evcharge_entity2_energy_var) | float | round(2) }}"
|
||||
#
|
||||
# # turn_on evcharge_entity2
|
||||
# - action: switch.turn_on
|
||||
# entity_id: !input evcharge_entity2
|
||||
# # entity_id: switch.presa_smart_2 # TEST ONLY
|
||||
#
|
||||
# # need to wait car to start charging
|
||||
# - delay: 120
|
||||
# # - delay: 10 # TEST ONLY
|
||||
#
|
||||
# # Wait for charging to complete
|
||||
# - repeat:
|
||||
# until: "{{ ( states(evcharge_entity2_power_var) | int ) < ( states('input_number.evcharge_no_charge_threshold') | int) }}"
|
||||
# # until: "{{ ( states('input_number.test_evcharge_back') | int) < ( states('input_number.evcharge_no_charge_threshold') | int) }}" # TEST ONLY
|
||||
# sequence:
|
||||
# - delay: 120
|
||||
# # - delay: 10 # TEST ONLY
|
||||
#
|
||||
# # take energy counter after charging
|
||||
# - variables:
|
||||
# energy2_after: "{{ states(evcharge_entity2_energy_var) | float | round(2) }}"
|
||||
#
|
||||
# # turn off evcharge_entity2
|
||||
# - action: switch.turn_off
|
||||
# entity_id: !input evcharge_entity2
|
||||
# # entity_id: switch.presa_smart_2 # TEST ONLY
|
||||
# - delay: 10
|
||||
# - action: switch.turn_off
|
||||
# entity_id: !input evcharge_entity2
|
||||
#
|
||||
# - repeat: # send message to all recipient-list members
|
||||
# for_each: "{{ recipient_list_notification }}"
|
||||
# sequence:
|
||||
# - action: "{{ repeat.item }}"
|
||||
# metadata: {}
|
||||
# data:
|
||||
# message: >-
|
||||
# "EVcharge process on {{ evcharge_entity2_var }} has ended: {{ ( energy2_after - energy2_before ) | round(2) }} kW/h charged"
|
||||
# title: EV Charge process
|
||||
# - action: notify.tiziano_trabattoni_gmail_com
|
||||
# data:
|
||||
# title: "EVcharge process on {{ evcharge_entity2_var }} has ended: {{ ( energy2_after - energy2_before ) | round(2) }} kW/h charged"
|
||||
# target: "{{ recipient_list_gmail['target'] }}"
|
||||
# message: >-
|
||||
# "EVcharge process on {{ evcharge_entity2_var }} has ended: {{ ( energy2_after - energy2_before ) | round(2) }} kW/h charged"
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: "{{ is_state(use_entity2_var, 'on') }}"
|
||||
then:
|
||||
sequence:
|
||||
# then start plug2 and wait until power measured is below input_number.evcharge_no_charge_threshold for 10 minutes = 600 seconds
|
||||
- repeat: # send message to all recipient-list members
|
||||
for_each: "{{ recipient_list_notification }}"
|
||||
sequence:
|
||||
- action: "{{ repeat.item }}"
|
||||
metadata: {}
|
||||
data:
|
||||
message: >-
|
||||
"EVcharge process on {{ evcharge_entity2_var }} has started"
|
||||
title: EV Charge process
|
||||
- action: notify.tiziano_trabattoni_gmail_com
|
||||
data:
|
||||
title: "EVcharge process on {{ evcharge_entity2_var }} has started"
|
||||
target: "{{ recipient_list_gmail['target'] }}"
|
||||
message: >-
|
||||
"EVcharge process on {{ evcharge_entity2_var }} has started"
|
||||
|
||||
# take energy counter before charging
|
||||
- variables:
|
||||
energy2_before: "{{ states(evcharge_entity2_energy_var) | float | round(2) }}"
|
||||
|
||||
# turn_on evcharge_entity2
|
||||
- action: switch.turn_on
|
||||
entity_id: !input evcharge_entity2
|
||||
# entity_id: switch.presa_smart_2 # TEST ONLY
|
||||
|
||||
# need to wait car to start charging
|
||||
- delay: 120
|
||||
# - delay: 10 # TEST ONLY
|
||||
|
||||
- repeat:
|
||||
until:
|
||||
- condition: or
|
||||
conditions:
|
||||
# - "{{ ( states('input_number.test_evcharge_back') | int) < (states('input_number.evcharge_no_charge_threshold') | int) }}" # TEST ONLY
|
||||
- "{{ ( states(evcharge_entity2_power_var) | int ) < ( states('input_number.evcharge_no_charge_threshold') | int ) }}"
|
||||
- "{{ is_state('input_boolean.evcharge_pro_stop', 'on') }}"
|
||||
|
||||
sequence:
|
||||
- variables:
|
||||
energy2_while: "{{ states(evcharge_entity2_energy_var) }}"
|
||||
evcharge_entity1_energy_charged: "{{ ((energy2_while | float| round(2)) - energy2_before )| float | round(2) }}"
|
||||
|
||||
- action: homeassistant.update_entity
|
||||
data:
|
||||
entity_id: "input_number.evcharge_back_charged"
|
||||
state: "{{ evcharge_entity2_energy_charged }}"
|
||||
|
||||
- delay: 120
|
||||
# - delay: 10 # TEST ONLY
|
||||
|
||||
# take energy counter after charging
|
||||
- variables:
|
||||
energy2_after: "{{ states(evcharge_entity2_energy_var) | float | round(2) }}"
|
||||
|
||||
# turn off evcharge_entity2
|
||||
- action: switch.turn_off
|
||||
entity_id: !input evcharge_entity2
|
||||
# entity_id: switch.presa_smart_2 # TEST ONLY
|
||||
- delay: 10
|
||||
- action: switch.turn_off
|
||||
entity_id: !input evcharge_entity2
|
||||
|
||||
- repeat: # send message to all recipient-list members
|
||||
for_each: "{{ recipient_list_notification }}"
|
||||
sequence:
|
||||
- action: "{{ repeat.item }}"
|
||||
metadata: {}
|
||||
data:
|
||||
message: >-
|
||||
"EVcharge process on {{ evcharge_entity2_var }} has ended: {{ ( energy2_after - energy2_before ) | round(2) }} kW/h charged"
|
||||
title: EV Charge process
|
||||
- action: notify.tiziano_trabattoni_gmail_com
|
||||
data:
|
||||
title: "EVcharge process on {{ evcharge_entity2_var }} has ended: {{ ( energy2_after - energy2_before ) | round(2) }} kW/h charged"
|
||||
target: "{{ recipient_list_gmail['target'] }}"
|
||||
message: >-
|
||||
"EVcharge process on {{ evcharge_entity2_var }} has ended: {{ ( energy2_after - energy2_before ) | round(2) }} kW/h charged"
|
||||
- if:
|
||||
- and:
|
||||
- condition: template
|
||||
|
||||
Reference in New Issue
Block a user