EVcharge added send mails
This commit is contained in:
@@ -93,11 +93,6 @@
|
|||||||
description: ''
|
description: ''
|
||||||
use_blueprint:
|
use_blueprint:
|
||||||
path: homeassistant/power-load-high.yaml
|
path: homeassistant/power-load-high.yaml
|
||||||
- id: '1740238584165'
|
|
||||||
alias: test1
|
|
||||||
description: ''
|
|
||||||
use_blueprint:
|
|
||||||
path: homeassistant/test_macro.yaml
|
|
||||||
- id: '1740247429602'
|
- id: '1740247429602'
|
||||||
alias: EVcharge-process
|
alias: EVcharge-process
|
||||||
description: Manage charge of 2 cars sequentially via 2 controlled plugs (requires
|
description: Manage charge of 2 cars sequentially via 2 controlled plugs (requires
|
||||||
@@ -110,3 +105,8 @@
|
|||||||
use_entity1: input_boolean.evcharge_front_request
|
use_entity1: input_boolean.evcharge_front_request
|
||||||
use_entity2: input_boolean.evcharge_back_request
|
use_entity2: input_boolean.evcharge_back_request
|
||||||
start_button: input_button.evcharge_start
|
start_button: input_button.evcharge_start
|
||||||
|
- id: '1740332596550'
|
||||||
|
alias: test-email
|
||||||
|
description: ''
|
||||||
|
use_blueprint:
|
||||||
|
path: homeassistant/test_macro.yaml
|
||||||
|
|||||||
@@ -78,10 +78,16 @@ variables:
|
|||||||
use_entity2_var: !input use_entity2
|
use_entity2_var: !input use_entity2
|
||||||
|
|
||||||
# here list of mobile APP to be notified
|
# here list of mobile APP to be notified
|
||||||
recipient_list:
|
recipient_list_notification:
|
||||||
- notify.mobile_app_tiziano_iphone15pro
|
- notify.mobile_app_tiziano_iphone15pro
|
||||||
- notify.mobile_app_emanuele_s24
|
- notify.mobile_app_emanuele_s24
|
||||||
|
|
||||||
|
recipient_list_gmail:
|
||||||
|
title: "EVcharge Process"
|
||||||
|
target:
|
||||||
|
- "tiziano.trabattoni@outlook.com"
|
||||||
|
- "ema.trabattoni@gmail.com"
|
||||||
|
|
||||||
actions:
|
actions:
|
||||||
- if:
|
- if:
|
||||||
- or:
|
- or:
|
||||||
@@ -93,17 +99,18 @@ actions:
|
|||||||
# value_template: "{{ false }}" # TEST ONLY
|
# value_template: "{{ false }}" # TEST ONLY
|
||||||
|
|
||||||
then:
|
then:
|
||||||
# charge already active, send message and terminate
|
# charge already active, send message email and terminate
|
||||||
repeat:
|
sequence:
|
||||||
for_each: "{{ recipient_list }}"
|
- repeat:
|
||||||
|
for_each: "{{ recipient_list_notification }}"
|
||||||
|
sequence:
|
||||||
|
- action: "{{ repeat.item }}"
|
||||||
|
metadata: {}
|
||||||
|
data:
|
||||||
|
message: >-
|
||||||
|
"EVcharge process is ALREADY RUNNING"
|
||||||
|
title: "EV Charge process ERROR"
|
||||||
|
|
||||||
sequence:
|
|
||||||
- action: "{{ repeat.item }}"
|
|
||||||
metadata: {}
|
|
||||||
data:
|
|
||||||
message: >-
|
|
||||||
"EVcharge process is ALREADY RUNNING"
|
|
||||||
title: EV Charge process ERROR
|
|
||||||
else:
|
else:
|
||||||
sequence:
|
sequence:
|
||||||
- if:
|
- if:
|
||||||
@@ -112,8 +119,7 @@ actions:
|
|||||||
then: # EVcharge entity_1 (eg front) charge is requested
|
then: # EVcharge entity_1 (eg front) charge is requested
|
||||||
sequence:
|
sequence:
|
||||||
- repeat: # send message to all recipient-list members
|
- repeat: # send message to all recipient-list members
|
||||||
for_each: "{{ recipient_list }}"
|
for_each: "{{ recipient_list_notification }}"
|
||||||
|
|
||||||
sequence:
|
sequence:
|
||||||
- action: "{{ repeat.item }}"
|
- action: "{{ repeat.item }}"
|
||||||
metadata: {}
|
metadata: {}
|
||||||
@@ -121,9 +127,16 @@ actions:
|
|||||||
message: >-
|
message: >-
|
||||||
"EVcharge process on {{ evcharge_entity1_var }} has started"
|
"EVcharge process on {{ evcharge_entity1_var }} has started"
|
||||||
title: EV Charge process
|
title: EV Charge process
|
||||||
|
- action: notify.tiziano_trabattoni_gmail_com
|
||||||
|
data:
|
||||||
|
title: "EVcharge process on {{ evcharge_entity1_var }} has started"
|
||||||
|
target: "{{ recipient_list_gmail['target'] }}"
|
||||||
|
message: >-
|
||||||
|
"EVcharge process on {{ evcharge_entity1_var }} has started"
|
||||||
|
|
||||||
# take energy counter before charging
|
# take energy counter before charging
|
||||||
- variables:
|
- variables:
|
||||||
energy1_before: "{{ states(evcharge_entity1_energy_var) | float }}"
|
energy1_before: "{{ states(evcharge_entity1_energy_var) | float | round(2) }}"
|
||||||
|
|
||||||
# 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
|
||||||
@@ -134,6 +147,7 @@ actions:
|
|||||||
- delay: 120
|
- delay: 120
|
||||||
# - delay: 10 # TEST ONLY
|
# - delay: 10 # TEST ONLY
|
||||||
|
|
||||||
|
# Wait for charging to complete
|
||||||
- repeat:
|
- repeat:
|
||||||
until: "{{ ( states(evcharge_entity1_power_var) | int ) < ( states('input_number.evcharge_no_charge_threshold') | int ) }}"
|
until: "{{ ( states(evcharge_entity1_power_var) | int ) < ( states('input_number.evcharge_no_charge_threshold') | int ) }}"
|
||||||
# until: "{{ ( states('input_number.test_evcharge_front') | int) < (states('input_number.evcharge_no_charge_threshold') | int) }}" # TEST ONLY
|
# until: "{{ ( states('input_number.test_evcharge_front') | int) < (states('input_number.evcharge_no_charge_threshold') | int) }}" # TEST ONLY
|
||||||
@@ -143,7 +157,7 @@ actions:
|
|||||||
|
|
||||||
# take energy counter after charging
|
# take energy counter after charging
|
||||||
- variables:
|
- variables:
|
||||||
energy1_after: "{{ states(evcharge_entity1_energy_var) | float }}"
|
energy1_after: "{{ states(evcharge_entity1_energy_var) | float | round(2) }}"
|
||||||
|
|
||||||
# turn off evcharge_entity1
|
# turn off evcharge_entity1
|
||||||
- action: switch.turn_off
|
- action: switch.turn_off
|
||||||
@@ -151,16 +165,22 @@ actions:
|
|||||||
# 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 }}"
|
for_each: "{{ recipient_list_notification }}"
|
||||||
|
|
||||||
sequence:
|
sequence:
|
||||||
- action: "{{ repeat.item }}"
|
- action: "{{ repeat.item }}"
|
||||||
metadata: {}
|
metadata: {}
|
||||||
data:
|
data:
|
||||||
message: >-
|
message: >-
|
||||||
"EVcharge process on {{ evcharge_entity1_var }} has ended: {{ energy1_after - energy1_before }} kW/h charged"
|
"EVcharge process on {{ evcharge_entity1_var }} has ended: {{ ( energy1_after - energy1_before ) | round(2) }} kW/h charged"
|
||||||
title: EV Charge process
|
title: EV Charge process
|
||||||
|
|
||||||
|
- action: notify.tiziano_trabattoni_gmail_com
|
||||||
|
data:
|
||||||
|
title: "EVcharge process on {{ evcharge_entity1_var }} has ended: {{ ( energy1_after - energy1_before ) | round(2) }} kW/h charged"
|
||||||
|
target: "{{ recipient_list_gmail['target'] }}"
|
||||||
|
message: >-
|
||||||
|
"EVcharge process on {{ evcharge_entity1_var }} has ended: {{ ( energy1_after - energy1_before ) | round(2) }} kW/h charged"
|
||||||
|
|
||||||
# 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
|
||||||
@@ -171,8 +191,7 @@ actions:
|
|||||||
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 }}"
|
for_each: "{{ recipient_list_notification }}"
|
||||||
|
|
||||||
sequence:
|
sequence:
|
||||||
- action: "{{ repeat.item }}"
|
- action: "{{ repeat.item }}"
|
||||||
metadata: {}
|
metadata: {}
|
||||||
@@ -180,19 +199,27 @@ actions:
|
|||||||
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
|
||||||
|
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
|
# take energy counter before charging
|
||||||
- variables:
|
- variables:
|
||||||
energy2_before: "{{ states(evcharge_entity2_energy_var) | float }}"
|
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: switch.presa_smart_2 # TEST ONLY
|
entity_id: !input evcharge_entity2
|
||||||
|
# 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: "{{ ( states(evcharge_entity2_power_var) | int ) < ( states('input_number.evcharge_no_charge_threshold') | int) }}"
|
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
|
# until: "{{ ( states('input_number.test_evcharge_back') | int) < ( states('input_number.evcharge_no_charge_threshold') | int) }}" # TEST ONLY
|
||||||
@@ -202,24 +229,28 @@ actions:
|
|||||||
|
|
||||||
# take energy counter after charging
|
# take energy counter after charging
|
||||||
- variables:
|
- variables:
|
||||||
energy2_after: "{{ states(evcharge_entity2_energy_var) | float }}"
|
energy2_after: "{{ states(evcharge_entity2_energy_var) | float | round(2) }}"
|
||||||
|
|
||||||
# turn off evcharge_entity2
|
# turn off evcharge_entity2
|
||||||
- action: switch.turn_off
|
- action: switch.turn_off
|
||||||
# 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
|
||||||
|
|
||||||
- repeat: # send message to all recipient-list members
|
- repeat: # send message to all recipient-list members
|
||||||
for_each: "{{ recipient_list }}"
|
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 ended: {{ energy2_after - energy2_before }} kW/h charged"
|
"EVcharge process on {{ evcharge_entity2_var }} has ended: {{ ( energy2_after - energy2_before ) | round(2) }} kW/h charged"
|
||||||
title: EV Charge process
|
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
|
||||||
|
|||||||
@@ -14,8 +14,14 @@ blueprint:
|
|||||||
# domain: binary_sensor
|
# domain: binary_sensor
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
recipient_list:
|
recipient_list_notification:
|
||||||
- notify.mobile_app_tiziano_iphone15pro
|
- notify.mobile_app_tiziano_iphone15pro
|
||||||
|
recipient_list_gmail:
|
||||||
|
title: "Evcharge Process"
|
||||||
|
target:
|
||||||
|
- "tiziano.trabattoni@outlook.com"
|
||||||
|
- "ema.trabattoni@gmail.com"
|
||||||
|
|
||||||
# - notify.mobile_app_emanuele_s24
|
# - notify.mobile_app_emanuele_s24
|
||||||
evcharge_entity1_power_var: >-
|
evcharge_entity1_power_var: >-
|
||||||
{% from 'template_library.jinja' import getpower_id %}
|
{% from 'template_library.jinja' import getpower_id %}
|
||||||
@@ -34,18 +40,42 @@ actions:
|
|||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: trigger
|
||||||
id:
|
id:
|
||||||
- p1-confort-light-on
|
- Pulsante1-single
|
||||||
- test_animation
|
|
||||||
sequence:
|
sequence:
|
||||||
# Hereafter the attemped usage as variable initialization
|
- alias: send notifications
|
||||||
- repeat: # send message to all recipient-list members
|
repeat: # send message to all recipient-list members
|
||||||
for_each: "{{ recipient_list }}"
|
for_each: "{{ recipient_list_notification }}"
|
||||||
sequence:
|
sequence:
|
||||||
- action: "{{ repeat.item }}"
|
- action: "{{ repeat.item }}"
|
||||||
metadata: {}
|
metadata: {}
|
||||||
data:
|
data:
|
||||||
message: >-
|
message: >-
|
||||||
"TEST -> >>{{ evcharge_entity1_power_var }}<<"
|
"TEST -> >>{{ evcharge_entity1_power_var }}<<"
|
||||||
title: TEST TEST
|
title: "EVcharge process from HA"
|
||||||
|
- action: notify.tiziano_trabattoni_gmail_com
|
||||||
|
data:
|
||||||
|
title: "{{ recipient_list_gmail['title'] }}"
|
||||||
|
target: "{{ recipient_list_gmail['target'] }}"
|
||||||
|
message: >-
|
||||||
|
"TEST -> >>{{ evcharge_entity1_power_var }}<<"
|
||||||
|
|
||||||
|
# action: notify.example_gmail_com
|
||||||
|
# data:
|
||||||
|
# message: "test"
|
||||||
|
# title: "test email"
|
||||||
|
# target:
|
||||||
|
# - "example2@gmail.com"
|
||||||
|
# data:
|
||||||
|
# cc:
|
||||||
|
# - "example3@gmail.com"
|
||||||
|
# bcc:
|
||||||
|
# - "example4@gmail.com"
|
||||||
|
# from: "example@gmail.com"
|
||||||
|
# variables:
|
||||||
|
# cmd: >-
|
||||||
|
# "{% set ll = (repeat.item | list ) -%}{{ ll[0] }}"
|
||||||
|
# titolo:
|
||||||
|
# "{% set ll = (repeat.item | list ) -%}{{ repeat.item[ll[0]].title }}"
|
||||||
|
# to:
|
||||||
|
# "{% set ll = (repeat.item | list ) -%}{{ repeat.item[ll[0]].target }}"
|
||||||
mode: single
|
mode: single
|
||||||
|
|||||||
Reference in New Issue
Block a user