Hello, community,
New day, new question. I’m hoping someone can help me.
In a script I try to set the position, depending on the input field “position”, either by this value or if the field is empty, by a value from an “input_number” field.
As I said, I am interested in the template in the “position:” section - everything else works fine.
Does it not work at all, or am I making an error?
#scripts.yaml
script_rollo_test:
alias: Setzt definierte Rollos Test
icon: "mdi:script-text-outline"
description: 'Setzt definierte Rollos Test'
fields:
title:
description: 'The title of the notification'
example: 'State change'
message:
description: 'The message content'
example: 'The light is on!'
position:
description: 'New position of cover'
example: 30
orientation:
description: 'geographic direction'
example: 'all'
# Öffne die Rollos, welche für die Automatisierung ausgewählt wurden
sequence:
- service_template: >
{% if is_state('input_boolean.automatisierung_gaestezimmer', 'on') and
(states.cover.rollo_gaestezimmer.attributes.current_position|int != position) and
(position == 0) and
(orientation == 'all' or orientation == 'east' or orientation == 'gast') %}
cover.close_cover
{% elif is_state('input_boolean.automatisierung_gaestezimmer', 'on') and
(states.cover.rollo_gaestezimmer.attributes.current_position|int != position) and
(position == 100) and
(orientation == 'all' or orientation == 'east' or orientation == 'gast') %}
cover.open_cover
{% elif is_state('input_boolean.automatisierung_gaestezimmer', 'on') and
(states.cover.rollo_gaestezimmer.attributes.current_position|int != position) and
(position == '') and
(orientation == 'all' or orientation == 'east' or orientation == 'gast') %}
cover.set_cover_position
{% else %}
script.script_continue
{% endif %}
data_template:
entity_id: >
{% if is_state('input_boolean.automatisierung_gaestezimmer', 'on') and
(states.cover.rollo_gaestezimmer.attributes.current_position|int != position) and
(orientation == 'all' or orientation == 'east' or orientation == 'gast') %}
cover.rollo_gaestezimmer
{% else %}
script.script_continue
{% endif %}
position: >
{% if position == '' %}
states.input_number.schliessposition_gaestezimmer.state | int
{% else %}
position | int
{% endif %}
Best regards Markus