Hi,
I have a UPS and I build an AddOn to shutdown gracefully HAOS, when the power fails. But so far it’s only me faileing.
I tried to call the Supervisor with :
curl -X POST \
-H "Authorization: Bearer ${SUPERVISOR_TOKEN}" \
-H "Content-Type: application/json" \
http://supervisor/host/shutdown
But I get:
403: Forbidden
But I get that for all calls:
local-sh-rpi-daemon:/app# curl -X POST \
-H "Authorization: Bearer ${SUPERVISOR_TOKEN}" \
-H "Content-Type: application/json" \
http://supervisor/host/shutdown
403: Forbiddenlocal-sh-rpi-daemon:/app#
local-sh-rpi-daemon:/app# curl -X POST -H "Authorization: Bearer ${SUPERVISOR_TOKEN}" -H "Content-Type: application/json" http://supervisor/core/stop
403: Forbiddenlocal-sh-rpi-daemon:/app#
local-sh-rpi-daemon:/app# #
local-sh-rpi-daemon:/app# curl -sSL -H "Authorization: Bearer $SUPERVISOR_TOKEN" http://supervisor/network/info
403: Forbiddenlocal-sh-rpi-daemon:/app#
local-sh-rpi-daemon:/app#
I tried a script, but that fails as well, even stranger:
local-sh-rpi-daemon:/app# cat /custom-poweroff.sh
#!/usr/bin/with-contenv bashio
set -e
bashio::log.info "Called to power off Home Assistant!!!"
bashio::host.shutdown()local-sh-rpi-daemon:/app# ^C
local-sh-rpi-daemon:/app# /custom-poweroff.sh
[03:34:17] INFO: Called to power off Home Assistant!!!
/custom-poweroff.sh: line 7: syntax error: unexpected end of file
local-sh-rpi-daemon:/app#
Here is my config.yaml ha_addon_sh_rpi_daemon/shrpi-daemon-container/config.yaml at e5f667ce641d341805b2d4c37a451b6acb2c5130 · eburi/ha_addon_sh_rpi_daemon · GitHub
And here is my Dockerfile and all the rest ha_addon_sh_rpi_daemon/shrpi-daemon-container/Dockerfile at e5f667ce641d341805b2d4c37a451b6acb2c5130 · eburi/ha_addon_sh_rpi_daemon · GitHub