Hassio.addon_restart

Hello, I would like to understand how the “hassio.addon_restart” / stop / start service works?

I want to send it the name of a service and restart that service but I don’t know how to structure the JSON?

Anyone got any insight on this?

Here’s my JSON payload to restart the Node-RED addon:

{
  "addon": "27e642c6_nodered"
}

You can find the addon name by using the hassio addon SSH commands.

2 Likes

Hey, Thanks for the info… What are the hassio addon SSH commands?

Thanks!

I’m talking about the hassio commands available when you connect to your Hassio SSH:

NAME:
   hassio - Commandline tool to allow interation with hass.io

USAGE:
   hassio [global options] command [command options] [arguments...]

VERSION:
   1.2.1

AUTHOR:
   Home-Assistant <[email protected]>

COMMANDS:
     homeassistant, ha  info, logs, check, restart, start, stop, update
     supervisor, su     info, logs, reload, update
     host, ho           hardware, reboot, shutdown, update
     network, ne        info, options
     snapshots, sn      list, info, reload, new, restore, remove
     addons, ad         list, info, logo, changelog, logs, stats,
 reload, start, stop, install, uninstall, update
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --debug, -d    Prints Debug information
   --help, -h     show help
   --version, -v  print the version

hassio addon list will give you a list of all your addons. You can find the add-on name there.

2 Likes

slight typo there, should be hassio addons list
Took me a minute but this worked, thanks!

One question though, what does the number before _nodered mean?
Will it ever change in the future? Mine was “a0d7b954_nodered”

That’s your unique container ID I think. That shouldn’t change unless you remove and re-install the addon.

You can also find the slug by looking at the URL. http://[ip]:[port]/hassio/addon/[slug]/

2 Likes