Ha: command not found

I installed Home Assistant on Raspbian Lite using the curl command, and I can’t use any command from this page.

1 Like

You need to add it manually.

The CLI is available at https://github.com/home-assistant/cli

I did

sudo apt update && sudo apt upgrade
sudo apt-get install git
sudo apt-get install golang
go get -d github.com/home-assistant/cli
cd /root/go/src/github.com/home-assistant/cli/
go build main.go
mv main ha
export SUPERVISOR_ENDPOINT=http://IP:8123/api/hassio
create a long lived api token longandsafesecret (in HA Web ui)
export SUPERVISOR_API_TOKEN=longandsafesecret
cp ha /usr/bin

add the exports to /etc/profile at the bottom !!!

(if using SSL export SUPERVISOR_ENDPOINT=https://yourdomain:8123/api/hassio instead)

2 Likes

I see. Shouldn’t this be in this docs page then?

1 Like

I think they suppose you use one of the ssh add-ons, on which it is installed. If you use native ssh, you have to install it yourself. But I agree, it could be better documented.

I see. But if you install Home Assistant manually in a Linux distribution, you don’t think of adding the SSH add-on, if Raspbian already comes with SSH installed.

1 Like

Exactly. .

Alternative solution: use a bash alias to redirect ha into the proper container.

Edit ~/.bashrc and append the following:

ha(){
  docker exec -it hassio_cli ha "${@}"
}

Then either logout and back in or run source ~/.bashrc

2 Likes

Just install the ssh addon and set it to not use port 22 and you can then just run either depending on what you want to do. An ssh session into the HA container is useful to have available or even to run from the ingress sidebar…

1 Like

thanks for this solution, it’s work for me

@francisp do I need to do this inside the container that is running home assistant or the host OS that is running the home assistant container?

You should not have to do this anymore

I think I’m missing something. I’m trying to solve an issue that I have with my matter server.I’m running home assistant on my ubuntu server using docker. If I go into the home assistant container and I run ha resolution info it tells me command not found:

indeed. the ‘ha’ command is only available on HAOS and HA Supervised, not on HA Container or HA Core.

1 Like

I’ve installed HA Supervised successfully on my ubuntu 22.04.The container HA cli is running but I still got the error “HA: command not found” once I run ha command from terminal.
If I using docker exec -it hassio_cli bash then trying to run ha command within container, there is no problem

So could you suggest the solution how to make the ha command work on host machine?

thank you.