Button for Shutdown

Hi,
I have created a button to turn off Home Assistant and I show it to you:

Captura de pantalla de 2021-12-22 21-42-28

Testing the new button function. I just have to call the service hassio.host shutdown, this is Poweroff the host system.

Me at the time of a storm for example. I usually turn off my equipments. I needed a quick shutdown function. At the moment it works perfect in my HA.

Please, opinions, suggestions, ideas and discussion on shutting down HA. Thanks.-

Code:

type: button
tap_action:
  action: call-service
  service: hassio.host_shutdown
  service_data: {}
  target: {}
show_state: false
show_icon: true
name: Apagar sistema
icon: mdi:power
hold_action:
  action: none
icon_height: 30px

February 5, 2022 UPDATE

I’m going to add a confirmation, to avoid accidents.
I am going to use “Options For Confirmation” of Actions.
Source: Actions-HA
and the code is this:

type: button
tap_action:
  action: call-service
  confirmation:
    text: confirm HA shutdown
  service: hassio.host_shutdown
  service_data: {}
  target: {}
show_state: false
show_icon: true
name: Apagar sistema
icon: mdi:power
hold_action:
  action: none
icon_height: 30px

A confirmation will be requested, the options will “yes” or “no”

4 Likes

Capture:

2 Likes

Thanks! Works well

1 Like

Hi Juan_Diego_Tortul,
thanks! How can I insert a password field for security before the script is executed? So that you can protect the reboot of the HA with the correct password.
thanks for your help!!!
Best regards
Novell1