ESPhome dashboard - instalation Problems

Hi Guys,

today, I’m here with a Problem during the installation of the optional ESSPhome component of Openhabian.

I have already made an ticket on github which was closed because I use Ubuntu as my base OS, which is absolutly correct from the maintainers.

https://github.com/openhab/openhabian/issues/1994

Afterward I tried the same with an fresh Debian 12 installation and also with an official RPi image, and I was running into the same issue.

So my question is if anyone had the same Problems with the installation.

@milo I believe this is your code which is inside the openhabian config for that.

If anyone could help I would be very happy and if anyone needs more information please tell what you need.

PS: all packages are up to date :wink:

Mhhm strange…

Can you check

cd /opt/esphomedashboard
ls venv

You ran it as root? If not it might be a user access issue

Hi,
yes, the openhabia-config is running as sudo.

I don’t know, but in my opinion the file which the script is looking for is available on all 3 system.

Ubuntu:

openhabian@openhab:/opt/esphomedashboard$ ls venv
bin  include  lib  lib64  pyvenv.cfg
openhabian@openhab:/opt/esphomedashboard/venv/bin$ ls
Activate.ps1                        aioesphomeapi-discover  async-json-rpc-server  espefuse.py   hex2bin.py     menuconfig    pip                python                                        savedefconfig
__pycache__                         aioesphomeapi-logs      bin2hex.py             esphome       hex2dump.py    normalizer    pip3               python-argcomplete-check-easy-install-script  setconfig
activate                            alldefconfig            bottle                 espsecure.py  hexdiff.py     oldconfig     pip3.10            python3                                       tabulate
activate-global-python-argcomplete  allmodconfig            bottle.py              esptool.py    hexinfo.py     olddefconfig  platformio         python3.10                                    uvicorn
activate.csh                        allnoconfig             defconfig              genconfig     hexmerge.py    pio           pyserial-miniterm  readelf.py
activate.fish                       allyesconfig            esp_rfc2217_server.py  guiconfig     listnewconfig  piodebuggdb   pyserial-ports     register-python-argcomplete
activate
# This file must be used with "source bin/activate" *from bash*
# you cannot run it directly

deactivate () {
    # reset old environment variables
    if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
        PATH="${_OLD_VIRTUAL_PATH:-}"
        export PATH
        unset _OLD_VIRTUAL_PATH
    fi
    if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
        PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
        export PYTHONHOME
        unset _OLD_VIRTUAL_PYTHONHOME
    fi

    # This should detect bash and zsh, which have a hash command that must
    # be called to get it to forget past commands.  Without forgetting
    # past commands the $PATH changes we made may not be respected
    if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
        hash -r 2> /dev/null
    fi

    if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
        PS1="${_OLD_VIRTUAL_PS1:-}"
        export PS1
        unset _OLD_VIRTUAL_PS1
    fi

    unset VIRTUAL_ENV
    unset VIRTUAL_ENV_PROMPT
    if [ ! "${1:-}" = "nondestructive" ] ; then
    # Self destruct!
        unset -f deactivate
    fi
}

# unset irrelevant variables
deactivate nondestructive

VIRTUAL_ENV=/opt/esphomedashboard/venv
export VIRTUAL_ENV

_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/"bin":$PATH"
export PATH

# unset PYTHONHOME if set
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
# could use `if (set -u; : $PYTHONHOME) ;` in bash
if [ -n "${PYTHONHOME:-}" ] ; then
    _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
    unset PYTHONHOME
fi

if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
    _OLD_VIRTUAL_PS1="${PS1:-}"
    PS1='(venv) '"${PS1:-}"
    export PS1
    VIRTUAL_ENV_PROMPT='(venv) '
    export VIRTUAL_ENV_PROMPT
fi

# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands.  Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
    hash -r 2> /dev/null
fi

Debian 12:

patrick@openhabian:/opt/esphomedashboard$ ls venv
bin  include  lib  lib64  pyvenv.cfg
patrick@openhabian:/opt/esphomedashboard$ ls venv/bin
activate                            alldefconfig           bottle.py              esptool.py   hexmerge.py    piodebuggdb        pyserial-ports                                savedefconfig
activate.csh                        allmodconfig           cairosvg               genconfig    listnewconfig  pip                python                                        setconfig
activate.fish                       allnoconfig            defconfig              guiconfig    menuconfig     pip3               python3                                       tabulate
activate-global-python-argcomplete  allyesconfig           espefuse.py            hex2bin.py   normalizer     pip3.11            python3.11                                    uvicorn
Activate.ps1                        async-json-rpc-server  esphome                hex2dump.py  oldconfig      platformio         python-argcomplete-check-easy-install-script
aioesphomeapi-discover              bin2hex.py             esp_rfc2217_server.py  hexdiff.py   olddefconfig   __pycache__        readelf.py
aioesphomeapi-logs                  bottle                 espsecure.py           hexinfo.py   pio            pyserial-miniterm  register-python-argcomplete
activate
# This file must be used with "source bin/activate" *from bash*
# you cannot run it directly

deactivate () {
    # reset old environment variables
    if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
        PATH="${_OLD_VIRTUAL_PATH:-}"
        export PATH
        unset _OLD_VIRTUAL_PATH
    fi
    if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
        PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
        export PYTHONHOME
        unset _OLD_VIRTUAL_PYTHONHOME
    fi

    # This should detect bash and zsh, which have a hash command that must
    # be called to get it to forget past commands.  Without forgetting
    # past commands the $PATH changes we made may not be respected
    if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
        hash -r 2> /dev/null
    fi

    if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
        PS1="${_OLD_VIRTUAL_PS1:-}"
        export PS1
        unset _OLD_VIRTUAL_PS1
    fi

    unset VIRTUAL_ENV
    unset VIRTUAL_ENV_PROMPT
    if [ ! "${1:-}" = "nondestructive" ] ; then
    # Self destruct!
        unset -f deactivate
    fi
}

# unset irrelevant variables
deactivate nondestructive

VIRTUAL_ENV=/opt/esphomedashboard/venv
export VIRTUAL_ENV

_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/"bin":$PATH"
export PATH

# unset PYTHONHOME if set
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
# could use `if (set -u; : $PYTHONHOME) ;` in bash
if [ -n "${PYTHONHOME:-}" ] ; then
    _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
    unset PYTHONHOME
fi

if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
    _OLD_VIRTUAL_PS1="${PS1:-}"
    PS1='(venv) '"${PS1:-}"
    export PS1
    VIRTUAL_ENV_PROMPT='(venv) '
    export VIRTUAL_ENV_PROMPT
fi

# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands.  Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
    hash -r 2> /dev/null
fi

RPI 4 official Openhabian image:

openhabian@openhabian:/opt/esphomedashboard $ cd /opt/esphomedashboard
openhabian@openhabian:/opt/esphomedashboard $ ls venv
bin  include  lib  lib64  pyvenv.cfg
openhabian@openhabian:/opt/esphomedashboard $ ls venv/bin
activate  activate.csh  activate.fish  Activate.ps1  pip  pip3  pip3.11  python  python3  python3.11
openhabian@openhabian:/opt/esphomedashboard $
activate
# This file must be used with "source bin/activate" *from bash*
# you cannot run it directly

deactivate () {
    # reset old environment variables
    if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
        PATH="${_OLD_VIRTUAL_PATH:-}"
        export PATH
        unset _OLD_VIRTUAL_PATH
    fi
    if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
        PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
        export PYTHONHOME
        unset _OLD_VIRTUAL_PYTHONHOME
    fi

    # This should detect bash and zsh, which have a hash command that must
    # be called to get it to forget past commands.  Without forgetting
    # past commands the $PATH changes we made may not be respected
    if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
        hash -r 2> /dev/null
    fi

    if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
        PS1="${_OLD_VIRTUAL_PS1:-}"
        export PS1
        unset _OLD_VIRTUAL_PS1
    fi

    unset VIRTUAL_ENV
    unset VIRTUAL_ENV_PROMPT
    if [ ! "${1:-}" = "nondestructive" ] ; then
    # Self destruct!
        unset -f deactivate
    fi
}

# unset irrelevant variables
deactivate nondestructive

VIRTUAL_ENV=/opt/esphomedashboard/venv
export VIRTUAL_ENV

_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/"bin":$PATH"
export PATH

# unset PYTHONHOME if set
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
# could use `if (set -u; : $PYTHONHOME) ;` in bash
if [ -n "${PYTHONHOME:-}" ] ; then
    _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
    unset PYTHONHOME
fi

if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
    _OLD_VIRTUAL_PS1="${PS1:-}"
    PS1='(venv) '"${PS1:-}"
    export PS1
    VIRTUAL_ENV_PROMPT='(venv) '
    export VIRTUAL_ENV_PROMPT
fi

# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands.  Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
    hash -r 2> /dev/null
fi

@milo I believe i had an idea:

original Code from Github:

    echo "$(timestamp) [openHABian] Activating the virtual environment and installing ESPHome..."
    if ! sudo -u "$USER" bash -c "source venv/bin/activate && pip install esphome"; then
      echo "$(timestamp) [openHABian] Error: Failed to install ESPHome."
      return
    fi

I beliieve the command should be

sudo -u "$USER" bash -c "source $ESPHOME_DIR/venv/bin/activate && pip install esphome";

instead of

sudo -u "$USER" bash -c "source venv/bin/activate && pip install esphome";

@milo are you able to have a look about it?

@all does anyone else get the same problem with the following Versions?

openHABian Configuration Tool — [openHAB]{2025-04-27T00:37:57-06:00}(7f01c79)
openHAB 4.3.5 - Release Build

@Oetzi-1987 Sorry I have right now some troubles with my raspberry pi and I need to have a look at this first… But anyway I guess you are right wth the path but as I tested before it runs fine…I am now on dietpi therefore no need of openhabian anymore

Hi.

I have not been able to install the espHome dasboard (didn’t know it was was available till i saw the first post for this thread several days ago). I updated my OH system earlier today and am encountering the same error for the file/directory not found.
My system is set up as a proxmox VM with Debian 12 x86.

 openHABian Configuration Tool — [openHAB]{2025-04-27T00:37:57-06:00}(7f01c79)
 openHAB 4.3.5 - Release Build

The error is receive after running the installation with openHABian-config:

2025-06-01_08:06:17_EDT [openHABian] Activating the virtual environment and installing ESPHome...
bash: line 1: venv/bin/activate: No such file or directory

Craig

wohoo I’m not the only one :smiley:

@milo don’t stress up i’m not in a hury :wink:

if you need any informations from my side or if i should open a ticket @github give me a hint and i will be here.

I am not sure if I can fix it so fast …as I wrote I am on dietpi now and have right now no big interest to setup an pi with openhabian during summer time

@milo thats not a big deal i know your situation my garden and my wife also need more attention in summer than in winter :wink:

@mstormi maybe you could reopen the Github ticket and link to this post, so no one forgets this open issue :wink:

https://github.com/openhab/openhabian/issues/1994

Hi Guys,

I made some major improvemts of the script from @milo I had some questions:

  1. what would be the best path for the configurationfolder, so that the openhabian Backup function is catching this files
  2. How can i get the permission to create a new branch to upload the files on Github?

Hello,

  1. I am not the openhabian maintainer, can’t answer these questions ( I also asked these questions but there was no answer for me) but @mstormi can answer?
  2. Simply create a GitHub pull request

That’s a misunderstanding. There’s no openHABian backup function, only - optional - full system backups via Amanda or the SD mirror.
So that’s not really a factor in choosing the install dir.
There’s /opt/openhabian/includes and its subdirs for scripts.

@mstormi I’m not talking about the install path. I would like to aks for a good path where the configuration files for all the ESPhome devices getting saved when I would use the openhabian option “50 | Backup/Restore”

That is not the way to go. That option calls the openhab-cli script from the openhab(not -ian) distro which will only ever backup a fixed set of files that belong to openhab not any 3rd party tool like ESPhome is.
As I said there is no openHABian backup tool that would or could take care of your stuff.

Sorry Guys, for the long time which i need since my last reply :frowning:

Since this morning, a fixed install / update and remove script is available for the ESPHome Device builder inside openhabian! :slight_smile:

Please test it on your system and if there are any issues pleas give me a call.

Please also take a look at the Doc section about the Update, which is necessary if newer ESPHome Versions are available.

@mstormi thank you for your support and patience during my first pull request on git