Entity Button card confirmation

I may be writing in wrong section, in that case feel free to move my post.

Can someone please tell me how to implement a confirmation dialog on the lovelace Entity Button card?

1 Like

This is a loaded question. What are you expecting the confirmation dialog to do? are you expect it to suppress your action unless you click “OK”?

I have a input boolean that i toggle with that button but sometimes I press it by mistake.

This would require a custom card then because you need to suppress the on/off action. I suggest looking through custom cards provided in HACS. There are cards that allow you to loc buttons or entity rows. This means you have to press and hold to unlock it, then press again to click it.

I think this is what you’re looking for. I use these for my dependent Docker container switches. https://github.com/thomasloven/lovelace-toggle-lock-entity-row

But there is a confirmation option on the the entity button card. See here https://www.home-assistant.io/lovelace/entity-button/ but there is no example on how to use it.


Using the example at the bottom of the docs, this is what the yaml would look like… I suggest you read up on yaml if you can’t figure out the docs. I was unaware of this new option.

type: entity-button
name: Turn Off Lights
  action: call-service
  service: script.turn_on
    entity_id: script.turn_off_lights
    text: Are you sure you want to press this button?
    - user: petro
entity: script.turn_off_lights

It’s not spelled out well in the docs. Just read through them more…

Last EDIT: This option does not exist for the entities card. Good feature request.


Excellent questions and points

I had the same problem as Denis and that link lead me to Restriction Card which was the solution I was looking for. It even has entity: cover.garage_door in one of the examples which is why I needed the solution. Thanks for the link!

I came across the same doubt and found this topic.

I’m sharing my implementation using only “official” components and a slightly modified version of petro in case someone finds it useful.

This is to control the motor of my garage, so I really needed to be extra careful to no activate it involuntarily. Basically I have double (triple?) protection: I ignore single and double tap and even when long pressing, I still ask for confirmation.
I’ve also updated to type: button since I believe entity-button has been deprecated (or I just can’t find it):

type: button
name: Activate garage motor
entity: switch.garage_motor
  action: none
  action: none
  action: call-service
  service: switch.turn_on
    entity_id: switch.garage_motor
    text: Are you sure you want to do it?

This generates an error when adding directly to Lovelace, but just save it… It works anyway.


Is there an option only to display the tekst when switching ‘on’ perhaps?

    text: Are you sure you want to do it?

I use this opther to explain what te button does to the users, no need for that when switching off


Yes that should be possible: first find a way to use templates in stock cards, if needed. Consider “Config Template Card” for example. Then write a template based on your entity state:

  • if state is off: confirmation with your text
  • otherwise: confirmation set to false

By this the confirmation dialog should only appear when state is “off” and someone wants to turn it on.