Hello,
I can’t find out why my blueprint doesn’t work.
The main goal of this automation is sun protection when it’s shining through a window.
blueprint:
name: sun protecion
description: close cover when sun is shining and open when stops
domain: automation
input:
cover_entity:
name: cover
selector:
entity:
domain: cover
sun_position_start:
name: sun position start
selector:
number:
min: 0
max: 360
unit_of_measurement: angle
sun_position_end:
name: sun position end
selector:
number:
min: 0
max: 360
unit_of_measurement: angle
variables:
cover_e: !input cover_entity
var_e: 'var.' + cover_e[6:-4]
protection_begin: !input sun_position_start
protection_end: !input sun_position_end
mode: parallel
trigger:
- platform: template
value_template: "{{ state_attr('sun.sun', 'azimuth') > protection_begin and state_attr('sun.sun', 'azimuth') < protection_end and states(var_e) != 1 }}"
id: aktywuj
for: '00:01:00'
- platform: template
value_template: "{{ (state_attr('sun.sun', 'azimuth') < protection_begin or state_attr('sun.sun', 'azimuth') > protection_end) and states(var_e) == 1 }}"
id: dezaktywuj
for: '00:01:00'
action:
- choose:
##########################################################
# close cover
##########################################################
- conditions:
- condition: template
value_template: "{{- states('binary_sensor.slonce_za_mocno_swieci') -}}"
sequence:
- data_template:
entity_id: "{{ cover_e }}"
position: 20
service: cover.set_cover_position
- data_template:
entity_id: "{{ var_e }}"
value: 1
service: var.set
- service: notify.mobile_app_mi11
data_template:
message: "{{ ON - cover_e }}"
title: SunProtectionDebug
##########################################################
# open cover
##########################################################
- conditions:
- condition: template
value_template: "{{- is_state('binary_sensor.slonce_za_mocno_swieci', 'off') -}}"
sequence:
- data_template:
entity_id: "{{ cover_e }}"
service: cover.open_cover
- data_template:
entity_id: "{{ var_e }}"
value: 0
service: var.set
- service: notify.mobile_app_mi11
data_template:
message: "{{ OFF - cover_e }}"
title: SunProtectionDebug
Automation created on this blueprint:
alias: sun protection - gym
description: ''
use_blueprint:
path: homeassistant/sun_protection.yaml
input:
sun_position_end: 270
sun_position_start: 100
cover_entity: cover.gym_cover_121
I use a global variable var_e (var custom integration) to indicate if protection is active or not.
An error I received is unknown protection_begin and protection_end but they are defined in the variables section. What I did wrong?