Cannot find SUPERVISOR_TOKEN environment variable

how do I get the environment variable set to access/set the SUPERVISOR_TOKEN?

my config.yaml is:

hassio_api: true
hassio_role: admin
homeassistant_api: true
host_network: true

all environment variables printed with os.environ:
environ({'OLDPWD': '/', 'PATH': '/command:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'PWD': '/app_data', 'LC_CTYPE': 'C.UTF-8'})

Looks like nothing is set.

My project: GitHub - FelixMarschall/HA_ProcessMining_Addon at 580b2a861c6ed0b4f58db6e45e85803c873d8441

How ca I set and access the environment variable?

Thanks!

1 Like

I also have this issue in 2023.4.1. I followed the example addon to a T, added config options for api access and I changed run to print the environment variables.

config.yaml

name: "Hello world"
description: "My first real add-on!"
version: "1.0.2"
slug: "hello_world"
init: false
arch:
  - aarch64
  - amd64
  - armhf
  - armv7
  - i386
homeassistant_api: true
hassio_api: true
startup: "application"
boot: "auto"
ports:
  8025/tcp: 8025

run.sh

#!/bin/bash
#print out environment vars
set

I get the following, the docs says there will be a SUPERVISOR_TOKEN that doesn’t exist

DIRSTACK=()
EUID=0
GROUPS=()
HOSTNAME=local-hello-world
HOSTTYPE=x86_64
IFS=$' \t\n'
MACHTYPE=x86_64-alpine-linux-musl
OLDPWD=/
OPTERR=1
OPTIND=1
OSTYPE=linux-musl
PATH=/command:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PPID=14
PS4='+ '
PWD=/
SHELL=/bin/ash
SHELLOPTS=braceexpand:hashall:interactive-comments
SHLVL=2
TERM=dumb
UID=0
_=/bin/bash

Same here! Any advice ??

I have the same issue, any resolution?