Solved: Trigger cover only if the state is not yet set

I want to trigger a cover only if it necessary, that means only if the target position is not the current position.
So the relevant part of the action of my blueprint looks as follows

action:
    service: >
      {% set curTime = now().time() %}
...
      {% if is_state('binary_sensor.daylight', 'off')
                or curTime >= closeTime.time() 
                or curTime < openTime.time() %}
          {% if is_state( coverEntityVar, 'closed') %}
            script.do_nothing
          {% else %}
            cover.close_cover
          {% endif %}
      {% else %}
          {% if is_state( coverEntityVar, 'open') %}
            script.do_nothing
          {% else %}
            cover.open_cover
          {% endif %}
      {% endif %}

In general this is working.
But it is not working for a group if not all cover in a group have the same state.

I think a loop over the entity_id of a group could be the solution, but haven’t found a way how to include this in my blueprint.

Another way, I think, could be to use a Template Cover for each cover which adjusts itself only if the target position is not yet the current position.

But I was hoping, that there is a more elegant way.

Thanks for your help.

Peter

Replying to myself in case somebody has a similar problem.
I solved it by calling a script, which checks the status of the cover or cover group.
This removes also the need for the ugly script.do_nothing in the automation above.

set_cover_position:
  alias: Set Cover Position
  description: "Set cover position if it has not yet this position"
  fields:
    cover_entity:
        description: "The cover to set"
    position:
        description: "The position as integer between 0 and 100"
  variables:
    full_list: >-
        {%- if state_attr( cover_entity, 'entity_id' ) is none -%}
            {{ [cover_entity] }}
        {%- else -%}
            {{ state_attr( cover_entity, 'entity_id' ) }}
        {%- endif -%}
    activate_list: >
        {%- set pos = position | int %}
        {%- set data = namespace(covers=[]) -%}
        {%- for cover in full_list -%}
            {%- if state_attr( cover, 'current_position' ) != pos -%}
                {%- set data.covers = data.covers + [cover] -%}
            {%- endif -%}
        {%- endfor -%}
        {{ data.covers }}

  sequence:
  - service: cover.set_cover_position
    data:
      entity_id: >
        {{activate_list}}
      position: >
        {{position}}
  mode: single

Edit: fixed a bug in the handling of non-group covers