Then you could do your notifying based on state changes of input_select.raamverduistering_stookhok in a separate automation. And, of course, change your icon customizations based on the one input_select instead of two input_boolean's.
I suppose you could even extend the options to include closed, opened & partially_opened, and at the end of the script, use new|float to decide if the cover was fully closed, fully opened, or somewhere in between.
as a matter of fact, I was already tinkering with that … My notification does something alike already.
for reference up to the post before the above, I can confirm all issues gone! no incidental double turned on booleans, which are now replaced by the input_select. Ive simply added the notification to the one automation as final step:
raamverduistering_stookhok:
mode: restart
sequence:
- service: input_select.select_option
entity_id: input_select.raamverduistering_stookhok
data_template:
option: >
{{'opening' if new|float > old|float else 'closing'}}
- delay: 2 # might require 3, to be seen in practice
- service: input_select.select_option
entity_id: input_select.raamverduistering_stookhok
data:
option: stationary
- condition: state
entity_id: input_boolean.notify_developing
state: 'on'
- service: notify.system
data_template:
title: Cover is no longer moving
message: >-
{{as_timestamp(now())|timestamp_custom('%X')}} - Cover is
{%- set position = state_attr('cover.raamverduistering_stookhok','current_position')|int %}
{%- set phrase = 'positioned at: ' %}
{%- if is_state('cover.raamverduistering_stookhok','closed')%} Closed
{%- elif position|int == 100 %} Open
{%- else %} {{phrase}}{{position}}
{% endif %}
When a template is rendered has more to do with where that template is used than by the template itself. E.g., if it’s used in a condition of an automation, then it is rendered when a trigger fires. But if it’s used in a template trigger, or a template sensor, that’s a different story. It’s that use case that determines when to render the template. E.g., as currently implemented, there would be no way to get that template to render based on time changing if it was used in a template trigger. But if it was used in a template sensor, then one can use the sensor’s entity_id option to force when the template is evaluated.
because the input_select can be manipulated in the frontend, and here it is only used to store the state the automation sets it to, Ive also created a safer sensor, to show in the frontend:
sensor:
- platform: template
sensors:
cover_stookhok_position:
friendly_name: Stookhok position
value_template: >
{% set position = state_attr('cover.raamverduistering_stookhok','current_position')%}
{% set state = states('input_select.raamverduistering_stookhok')%}
{% if state == 'Stationary' %} {{state}} at {{position|int}} %
{% else %} {{state}}
{% endif %}
Question, considering the above: there is no backend option to set for an input_select, to not allow manual manipulating somehow?