Restart button

Hi, I want to make a restart button on the UI
I have done that script but got an error
Screen Shot 2020-02-27 at 20.52.37

also in the UI I have added this and got an error as well

what am I missing?

Why write a script that executes one service???

The error you got is due to wrong indentation.
cards: and the second - type: are indented too far.


action: call-service
service: homeassistant.restart

so how to do it without a script?

this is not what I did?

Nope. No scripts.
Just add:

      - type: vertical-stack
          - type: glance
            title: Maintenance
            show_header_toggle: false
            show_state: false
            - entity: zone.home
              icon: 'mdi:restart'
              name: Home Assistant
                action: call-service
                service: homeassistant.restart

Correct indentation, based on your ui-lovelace.yaml


thanks, works like charm

Seems to work here too, thanks!

But the “homeassistant.restart” service only restarts Home Assisstant I guess? And is this the same “service” as in [Configuration] - [Server Controls] - [restart]?

What if I would like to restart the complete Raspberry PI? Should I use “hassio.host_reboot” in this case then? And is this the same “service” which is called with [Supervisor] - [System] - [Reboot]?

Add below:

            - entity: zone.home
              icon: 'mdi:restart'
              name: Server
                action: call-service
                service: hassio.host_reboot

For any other future visitors via Google searches - my usecase for this was restarting HomeAssistant via Alexa - and using a script is the easiest way to expose a 1-off action to Alexa via NabuCasa / Home Assistant Cloud


alias: Restart HomeAssistant
  - service: homeassistant.restart
mode: single
icon: hass:power

Then in Alexa app create routine “Alexa, restart home assistant” with a single action => Smart home => Control scene => Restart HomeAssistant

This is mostly cause I’m lazy and I get tired of digging through the UI to restart HA when I’m messing with new configurations. Telling Alexa to do it is convenient and means I don’t need a 24th new browser tab of HA. :dancer:


That’s a completely different need than OP has and is not related to this post.

You asked for a reason to have script that executes one service, specifically to restart HA. I gave you a valid usecase for exactly that; so it’s quite clearly related.

There’s no need to be bitter just because you were dismissive of OP’s question, which was perfectly reasonable :slight_smile: have a great day.

OP wanted to have a button to execute a single service, he did not say anything about exposing it to Alexa or whatever. For his specific usecase it’s completely unnecessary to create a script and call the script instead of just executing the service directly from the button. As I always say, keep it simple.

It wasn’t meant dismissive just a simplification…

Hi all,
Sorry for the “stupid question”: where should I place this snippet for enabling this functionality?
Should it be placed inside “config.yaml”?
I read that you mentioned a “ui-lovelace.yaml”, but I cannot find this file…
Thanks for your time!

Edit your Dashboard. Click + Add Card. Scroll to end and click “Manual”. Copy and paste code. Correct indentation.

Thank you very much for your reply!
I had the error “no card type found”. Do you have any idea of the reason why?
Should I install anything more to make this button works?
From your previous answer, I understood that adding this card should be enough.

Thank you again for your time.

Go to HACS ==> Frontend.
Search for “vertical-stack”, install “Vertical Stack in card”

It seems we have the button entity in the new Version 2021.12. Can you help to make a restart button with the new button entity?