Help adding confirmation to entities card

I’m trying to add a confirmation dialog to a binary switch entity. So far I haven’t been able to get it to work.

type: entities
entities:

  • entity: sensor.greenhouse_temperature_humidity_greenhouse_temperature
  • entity: sensor.greenhouse_temperature_humidity_greenhouse_humidity
  • entity: switch.greenhouse_lights
  • entity: switch.greenhouse_heater_greenhouse_heater
  • entity: binary_sensor.front_door_1_front_door_1
  • entity: binary_sensor.front_door_2_front_door_2
    state_color: false
    tap_action:
    confirmation: Are You Sure?
    action: toggle

I need it for switch.greenhouse_heater_greenhouse_heater but don’t really care if all entities on the card are included. The yaml looks right to me from reading the documentation but I don’t get a confirmation window when I tap the switch.

https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16

This didn’t work the first time but I’ll try again.

type: entities
entities:
  - entity: sensor.greenhouse_temperature_humidity_greenhouse_temperature
  - entity: sensor.greenhouse_temperature_humidity_greenhouse_humidity
  - entity: switch.greenhouse_lights
  - entity: switch.greenhouse_heater_greenhouse_heater
  - entity: binary_sensor.front_door_1_front_door_1
  - entity: binary_sensor.front_door_2_front_door_2
state_color: false
tap_action:
  confirmation: Are You Sure?
  action: toggle

Thanks much clearer.

The for the entities card, the tap action has to be per entity, not the whole card. Try this:

type: entities
entities:
  - entity: sensor.greenhouse_temperature_humidity_greenhouse_temperature
  - entity: sensor.greenhouse_temperature_humidity_greenhouse_humidity
  - entity: switch.greenhouse_lights
    tap_action:
      confirmation: 
        text: Are You Sure?
      action: toggle
  - entity: switch.greenhouse_heater_greenhouse_heater
    tap_action:
      confirmation: 
        text: Are You Sure?
      action: toggle
  - entity: binary_sensor.front_door_1_front_door_1
  - entity: binary_sensor.front_door_2_front_door_2
state_color: false
1 Like

Still not working. When I tap the switch it just toggles without the confirmation dialog.

I see that if I tap the entity name I get the confirmation though. Not sure how to fix this?

Could be a bug. You can open a new issue here:

I would say it’s expected behaviour. Use an action button instead. You could also add type: simple-entity to hide the toggle.

1 Like

Had already put in a bug report but it’s closed now.

The toggle or perhaps a radio button is necessary so that other people (wife) will have a visual reference for the associated action (on/off). I’m looking at the action button link you provided (thanks for that) but I don’t see any actual buttons in the screenshots. It just seems to be more of what I have now where tapping the text produces an action. Is this wrong? Is there code to display a toggle or radio button that will observe the associated tap action code?

Can you linkt the bug report? Only to have a look as well.

Beside this, you can use

image

type: entities
entities:
  - type: custom:restriction-card
    row: true
    card:
      entity: switch.entity_name
    restrictions:
      confirm:
        text: Klingon confirmation text or whatever else
card_mod:
  style: |
    :host {
      --restriction-lock-row-margin-left: calc(100% - 25px);
    }
1 Like

https://github.com/home-assistant/frontend/issues/19509

That’s right. The discussion has been stalled since last August, as far as I could see. I think another card would indeed be better suited to your requirements.

Recommendations??? Changing cards wouldn’t be a problem. Just need a visible toggle or button and ability to prevent stray taps.

I took a quick look at the restrictions card but didn’t see right off how to add it to Entities.

Arganto posted a full example of how to integrate a custom card in Entities Card.
Custom Button Card is another example but in my opinion Restriction Card is easier to set up.

Did you even read, what I have posted, including yaml, link and screenshot? :confused:

Yes. Thanks. Saw the link and the yaml but my german(???) isn’t good. Was going to try and translate when I get a little spare time.

No German needed. It is a boolean/switch entity as yours. And a confirmation text. You can put your text there as well.

1 Like

I know, absolutely ot, but…
:joy:

My Klingon is pretty bad too.:grin:

1 Like

Not my best day. Now can’t add the restriction card. I installed the card via HACS and added the resource to configuration.yaml and restarted but when I try to add the custom card i get this-

I can see the resource listed in Dashboards and don’t see any errors in the logs. Not sure what I missed?

Finally got it. Had to add the js file manually. Not sure why but it’s working. Thanks to everyone for the help.