It would be great to have the option to add a confirmation for button entities (from integration standpoint) when clicked in the UI by the user. Obviously, automations would not be affected. This would allow an integration developer to mark a button as requiring confirmation or as destructive to prevent a user from accidently activating it out of curiosity.
The issue is some buttons can be very destructive and not having a user confirmation can cause unintended harm to the user’s home automation platform.
A couple of examples of buttons that would need a confirmation:
A reboot/update button (especially for devices that should have high availability, such as a Security Camera)
A Delete/Remove/Unadopt button to remove the device completely from the upstream system
type: button
name: Turn Off Lights
show_state: false
tap_action:
action: call-service
confirmation:
text: Are you sure, this could be really bad?
service: script.turn_on
data:
entity_id: script.turn_off_lights
Keep in mind that, button action can be triggered by an automation using button.press service and there is no user interaction while executing these scripts and automations. I don’t think we should mess backend implementation (entities) and frontend representation (lovelace cards)
That only works for action: call-service, right?
I need a confirmation for a action: toggle.
I get error “duplicated mapping key (10:7)” when I try to combine the confirmation with the toggle action.
The frontend uses an entity’s device class for customizing things like icon and such. I wouldn’t think it would be too difficult to implement one or more new ButtonDeviceClasses that the frontend could default to prompting to confirm. Then you just add that device class in the entity descriptions on the backend.
For the cover, try to make the action call-service and call cover.toggle. Otherwise, wrap cover.toggle in a script.toggle_cover call and see if that works (you’d need to hardcode the entity in the script, or better, pass it via data: as a parameter).
Also check GitHub to see if this is a known issue.