Temporarily or dynamically disable an entity

Hi everybody,
This is my first post, but I couldn’t find an answer on the forum. In the lovelace frontend, I would like to disable my covers so they can’t be closed when there’s too much wind.
For now I have an automation that opens the covers when there’s too much wind, but I’d like it to be impossible to close them.
Same for Climate: disable the entity when there’s a window open.
Is this possible? Or any other ideas?

I believe the Conditional Card will do what you want.

Here is how I use it:

  • I have a conditional card that lets you control a door lock.
  • If the door is open, it makes no sense to allow a user to control the door lock. I don’t want the deadbolt extended when the door is not closed.
  • So when the door is open, the conditional card is hidden.
  • When the door is closed, the conditional card is visible.

Thanks! I gave it a look but it looks like you can only use it for ON and OFF states. In my use case I want it hidden when there’s more than 35km/h wind. I could create a sensor for that though…

Sounds like the perfect solution! :+1:

Another way is - using card-mod:

type: entities
title: Locked cover
entities:
  - entity: input_boolean.test_boolean
    name: Lock the door
  - entity: cover.garage_door
    tap_action:
      action: none
    card_mod:
      style: |
        :host {
          {% if is_state('input_boolean.test_boolean','on') %}
            color: var(--disabled-text-color);
            --paper-item-icon-color: var(--disabled-text-color);
            pointer-events: none;
          {% endif %}
        }

image

3 Likes

I’m also currently doing research to prevent closing of covers, when the windows are open.

@Ildar_Gabdullin In your example - Is the controlling of the “Garage Door” really not possible anymore or is it only greyed-out and if I nevertheless tab on the arrow the garage door will move?

The “pointer-events: none;” property does not allow to push buttons.

Thank you for the information. In the meanwhile I found the following card do block the controls of my cover, when the windows are open:

Restriciton-Card

If in the future this won’t satisfy my need anymore, I will give the card-mod a try.

A question: what happens if the entity is added to an Android widget using the Home Assistant app for Android? A user could still act on the entity, right?

And, in that case, the only option would be disabling the entity from the Entities list?

Came across this problem recently after installing smart blinds which I want to prevent by all means from being closed if the window is open. Best method I found is to disable the entity using the homeassistant.disable_entity service that the Spook custom component registers.