Hello
I’m here with a problem using group cover,
I have this group
- platform: group
name: estores_quartos_sala
entities:
- cover.estore_suite
- cover.estore_leonor
- cover.estore_quarto
- cover.estore_sala
This group controls those blinds, but I have some inputs to facilitate user manager
input_select:
estore_sala_actions:
name: "Estore Sala"
options:
- "Fechado"
- "Entreaberto"
- "25%"
- "50%"
- "75%"
- "Aberto"
- "Manual"
One for each input
My problem is that I have an automation to update the status of the inputs depending on the position of the cover
- alias: "Estores :: Inputs Acções Definir Valor"
trigger:
- platform: state
entity_id: cover.estores_quartos_sala
- platform: state
entity_id: cover.estore_cozinha
- platform: state
entity_id: cover.estore_leonor
- platform: state
entity_id: cover.estore_quarto
- platform: state
entity_id: cover.estore_sala
- platform: state
entity_id: cover.estore_suite
- platform: state
entity_id: cover.estores_quartos_sala
action:
- service: input_select.select_option
data_template:
entity_id: input_select.{{ trigger.entity_id.split(".")[1] }}_actions
option: >
{% if trigger.to_state.attributes.current_position | int == 100 %}
Aberto
{% elif trigger.to_state.attributes.current_position | int >= 14 and trigger.to_state.attributes.current_position | int <= 16 %}
Entreaberto
{% elif trigger.to_state.attributes.current_position | int >= 24 and trigger.to_state.attributes.current_position | int <= 26 %}
25%
{% elif trigger.to_state.attributes.current_position | int >= 49 and trigger.to_state.attributes.current_position | int <= 51 %}
50%
{% elif trigger.to_state.attributes.current_position | int >= 74 and trigger.to_state.attributes.current_position | int <= 76 %}
75%
{% elif trigger.to_state.attributes.current_position | int == 0 %}
Fechado
{% else %}
Manual
{% endif %}
This works well for all inputs except for the cover group
But if I do a new automation like this:
- alias: "Estores :: Inputs Acções Definir Valor Grupo de Estores"
trigger:
- platform: state
entity_id: cover.estores_quartos_sala
action:
- service: input_select.select_option
data_template:
entity_id: input_select.{{ trigger.entity_id.split(".")[1] }}_actions
option: >
{% if trigger.to_state.attributes.current_position | int == 100 %}
Aberto
{% elif trigger.to_state.attributes.current_position | int >= 14 and trigger.to_state.attributes.current_position | int <= 16 %}
Entreaberto
{% elif trigger.to_state.attributes.current_position | int >= 24 and trigger.to_state.attributes.current_position | int <= 26 %}
25%
{% elif trigger.to_state.attributes.current_position | int >= 49 and trigger.to_state.attributes.current_position | int <= 51 %}
50%
{% elif trigger.to_state.attributes.current_position | int >= 74 and trigger.to_state.attributes.current_position | int <= 76 %}
75%
{% elif trigger.to_state.attributes.current_position | int == 0 %}
Fechado
{% else %}
Manual
{% endif %}
Everything works correctly, but I didn’t want to be duplicating code because afterwards it is more complicated to manage
Another problem I have with the groups Is that sometimes 1 of the windows does not change the position, all but 1 change (Random)
Any hints?
Thanks