Conditional format of card for Cover Position

Hi All,

Can’t seem to get my head around this.

I have a garage door with positions. I’m trying to have the cards coloured based on the position of the door. The icons change between open and closed which is fine, but i would like to have it so that after a button is pushed, it flashes until the door reaches requested position.

type: 'custom:button-card'
name: 25%
entity: cover.garage_door_controller_control_2
tap_action:
  action: call-service
  service: cover.set_cover_position
  service_data:
    entity_id: cover.garage_door_controller_control_2
    position: 25

Hi scoobee81,

there‘s a nice example in the docs that can be modified:


state:
  - value: 25
    operator: '!='
    styles:
      card:
        - animation: blink 2s ease infinite

Thanks - Can you posssibly link me to where it is in the docs? I can’t seem to be able to find it.

I’ve used what you suggested and i can get it to flash.

But what i need is for it to flash while the door is moving and stop when the correct position in highlighted with a tollerance of +/- 5

Sure:

—> topics „operator on state“ & „blink“

And yes - sorry! - the example above works only with state, forgot about that. I quickly tested the following code with one of my covers:


state:
  - operator: template
    value: |
      [[[
        if (entity.attributes.current_position != 25) return ' ';
      ]]]
    styles:
      card:
        - animation: blink 2s ease infinite

Ok, so i’ve got the door working properly now.

The state of the door changes to ‘closing’ or ‘opening’ depending on whats happening.

I’ve created an input number for the request value.

What i’m trying to achieve.

  1. Push button 25%
  2. Button 25% will flash green while the door is moving
  3. Once the door reached 25% it the light will turn solid green.

Could be implemented by using extra_styles . Look at Keith‘s great tutorial, section „Alerting Sensors“.