EVcharge_PRO: WIP2 stop OK, need test of setting charged value

This commit is contained in:
2025-09-19 23:51:03 +02:00
parent 074737e6b4
commit d7b8888fff

View File

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