Files
home-assistant/blueprints/automation/homeassistant/test_macro.yaml

82 lines
2.4 KiB
YAML

blueprint:
name: Test-Macro
description: Prova Jinja2 Macro
domain: automation
author: Tiziano Trabattoni
# input:
# window_sensor:
# name: Window Status
# description: Identifies the Window Sensor Device for Opened Status
# selector:
# entity:
# filter:
# - device_class: door
# domain: binary_sensor
variables:
recipient_list_notification:
- 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
evcharge_entity1_power_var: >-
{% from 'template_library.jinja' import getpower_id %}
{{ getpower_id('switch.evcharge_back') }}
triggers:
- trigger: mqtt
topic: zigbee2mqtt/Pulsante-01
payload: single
value_template: "{{ value_json['action'] }}"
id: Pulsante1-single
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id:
- Pulsante1-single
sequence:
- alias: send notifications
repeat: # send message to all recipient-list members
for_each: "{{ recipient_list_notification }}"
sequence:
- action: "{{ repeat.item }}"
metadata: {}
data:
message: >-
"TEST -> >>{{ evcharge_entity1_power_var }}<<"
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