Cover button, change default button action

Hi there, I just installed some window open/close sensors, so now i want to change the default action when you want to close the cover to use a script wich will check that point.

I tried editing in yaml mode the button, but then all th icons disspaeared.

I’d suggest using a cover template to call your script

# Example state-based configuration.yaml entry
template:
  - cover:
      - name: Garage Door
        state: "{{ states('sensor.garage_door')|float > 0 }}"
        device_class: garage
        open_cover:
          action: script.open_garage_door
        close_cover:
          action: script.close_garage_door
        stop_cover:
          action: script.stop_garage_door
# Example trigger-based configuration.yaml entry
template:
  - triggers:
      - trigger: state
        entity_id: sensor.garage_door
    cover:
      - name: Garage Door
        state: "{{ trigger.to_state.state|float(0) > 0 }}"
        device_class: garage
        open_cover:
          action: script.open_garage_door
        close_cover:
          action: script.close_garage_door
        stop_cover:
          action: script.stop_garage_door
1 Like