Confirmation dialog on switch/button UI actions

When interaction with buttons/switches/sliders in the interface, a confirmation dialog would be extremely useful. While it would be nice to be able to configure it on a per-component interface, it would suffice to have it global.

Right now, I’ve had a hard time using the interface from my phone, as I accidentally end up opening my garage doors as I scroll.

I think that this should be a per entity thing. I don’t want confirmation for lights, but I would really like it for things like system reboot or garage doors as you said.

Bump on this!

I suggest this implementation:

customize:
  switch.telldus_tzwp100_plugin_switch_switch_10_0:
    friendly_name: Media center power
    icon: mdi:power
    confirmation_dialog: Are you sure you want to power off the entire media center?

If confirmation_dialog is defined a dialog will appear asking you to confirm the action with a custom message.

I also accidentally opened my door. It wasn’t the garage door, but way worst… was the door that grant access to my 2 dogs and they slept on the couch that night… wife wasn’t happy!! this should be top priority!!

1 Like

I also think this is VERY important! I have several actions I don’t want to call without confirmation, just because I accidentally clicked the buttons with my big fingers.
It would be even better, if you can run a script before switching off - or add some conditions:

  1. User clicks power off (e.g. computer with Lightify plug)
  2. HA checks, if sensor.computer says that the computer is not running
  3. If computer is still running HA asks if you really want to power off the Lightify plug

Most of that you can already do using automations. Only the confirmation dialog would be missing, and automations don’t have if/else functionality. They (sadly) only support “if yes…then”.
But at least for the if / else stuff you could use AppDaemon and maybe even the new Python Scripts component.
Thinking of it, you could still probably get everything you want by using a Telegram bot which would notify you, and from there you could confirm. Although I have to admit, that it would be much more complicated that way. But in theory it should be possible already with Telegram instead of an extra WebUI confirmation dialog.

My (ugly) workaround is using two input booleans and only doing the action (opening the door or rebooting the system) when the are pressed. Both have an automation to reset them to OFF after 2 seconds or so.

This is a great idea can you share your config automation so I can use ( I am new to this )

Sure!

My use case is a bit different than the ideia I wrote on the previous post: I have a script which reboots the RaspberryPi, and only want the script to run if an Input Boolean is previously turned on. So, the input boolean:

input_boolean:
  allow_system_reboot:
    initial: off

The scrip that reboots the Pi has a condition to check that the input boolean is On, and won’t run the shell_command if the condition is false:

script:
  restart_pi:
    alias: "Reboot Raspberry"
    sequence:
      - condition: state
        entity_id: input_boolean.allow_system_reboot
        state: 'on'
      - service: shell_command.restart_pi

Finally, I have a simple automation to reset the Input Boolean to Off after 1 second:

- alias: Turn off reboot safety switch
  trigger:
    - platform: state
      entity_id: input_boolean.allow_system_reboot
      to: 'on'
      for:
        milliseconds: 1000
  action:
    - service: homeassistant.turn_off
      data_template: 
        entity_id: "{{ trigger.entity_id }}"
1 Like

Just adding in my 2 cents that i have smoke sensors that also work as sirens. If you click wrong at night, someone is going to be very unhappy. Same goes for the door opener option. Almost exactly like above, i thought a “confirmation: ‘Are you sure you want to open the door’” would be really nice.

2 Likes

So I ended up using Alarm Panel with a single digit code as follows, the code is the confirm as you cannot accidently enter the code

IN

configuration.yaml

alarm_control_panel:

  • platform: manual
    name: “Front Door Lock”
    pending_time: 2
    code: “1”

in

automation.yaml

##############################################################################################
################################### Alarm Panel to open Front Door ########################
##############################################################################################

  • alias: alarm open front door
    trigger:

    • platform: state
      entity_id: alarm_control_panel.front_door_lock
      to: pending
      action:
    • service: switch.turn_on
      entity_id: switch.front_door_lock
    • service: alarm_control_panel.alarm_disarm
      data:
      entity_id: alarm_control_panel.front_door_lock
      code: 1
  • alias: Turn off front door after 60 second
    trigger:
    platform: state
    entity_id: switch.front_door_lock
    to: “on”
    for:
    seconds: 60
    action:

    • service: switch.turn_off
      entity_id: switch.front_door_lock
1 Like

It would also be nice to have an error message if the command fails. My radio thermostat can time out sometimes when trying to change anything and there is no error message - it just never updates and you have to know to try again. Not sure if that should be a separate feature request…

I wonder, has anyone found a better solution than the workarounds mentioned above?

I’m surprised there’s not more interest in this topic, it seems like it should be a common problem and not too hard to address.

I agree. I was initially thinking a custom cover control would be best, but a simple dialogue box is what is needed. On HA, for a cover/garage door, actual status (closed/open/closing/opening) is more useful than them all.

I also think this would be an important feature for switches.
Especially after accidentally turning off all smart switches while I was away, including the modem, so non reversible, and the fridge/freezer plug. Oops.
I was scrolling on the phone screen and I accidentally pressed the off in the All Switches panel.
I have since learned to not have the modem on a smart switch, but it would still be good to be able to customize switches with a confirmation dialogue natively.

This is a must. Just accidentally turned off my 3D Printer in the middle of a very long print.

Custom ui has this feature, without the confirmation dialog, but with a lock on the switch that has to be pressed once to remove lock before pressing again for actually moving switch. Easy setup and either do all entities, all lights etc or per entity.

1 Like

Please to link @teachingbirds ? :slight_smile:

@teachingbirds can yoiu please link a post?

@benmprojects @ashmckenzie https://github.com/andrey-git/home-assistant-custom-ui

Also if you are using Lovelace there’s this: https://github.com/thomasloven/lovelace-toggle-lock-entity-row

3 Likes