Shell command and SSH to NUT addon

Hi All

I’m running Hommassistant os on a raspberry pi

Wonder if anyone here can help me I do not really know SSH and since hassio.addon_stdin was removed from the addon i have been stuck just manually running the below command from the terminal.

I’m using Homeassistant on a Raspberry PI

sudo docker exec addon_a0d7b954_nut upscmd -u xxx -p xxx Cabinet_UPS@localhost beeper.toggle

I use to use the following in an automantion but it does not work any more.

action:
  - service: hassio.addon_stdin
    data:
      addon: a0d7b954_ssh
      input: sh /config/boff.sh

Everywhere I look people say to use Shell_command to Call ssh but I have no idea how to do this. And what the command should look like as I have virtually no experience in SSH is there anyone here who can guide me in getting this working again it is either that or takes my pliers open the ups and break off the buzzer from the pc board lol(don’t really want to do that) :slight_smile:

I have also tried this shell command in configuration.yaml

shell_command:
  beeper_off: ssh -i /config/.ssh/id.rsa -o 'PreferredAuthentications=publickey' cartman@localhost -T 'bash /config/boff.sh'

But I get the following error return code: 255
The same command works in the terminal

Any help will be appreciated

I’m not sure if I understand how you are running Home Assistant on the RPI, you seem to be using Docker for your UPS monitor. Are you running HA in a Docker container?

I run HA in a Docker container and I have a couple sensors that use SSH to go out and get the data. Each time I upgrade HA, after downloading the new Docker HA image I have to do a console into the HA Docker instance (I use Portainer to manage and connect into the Docker running containers) and reinstall the ssh keys (I think I might be using a different SSH connection method), example below. Good hunting!

# must re authenticate remote ssh connections, inside console terminal in portainer:

bash-5.1#ssh -i /config/ssh_keys/id_rsa [email protected] 'cat /sys/devices/platform/applesmc.768/fan1_input'
The authenticity of host '192.168.55.12 (192.168.55.12)' can't be established.
ECDSA key fingerprint is SHA256:blahblah.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.55.12' (ECDSA) to the list of known hosts.
2002
bash-5.1#ssh -i /config/ssh_keys/id_rsa [email protected] 'cat /sys/devices/platform/applesmc.768/fan1_input'
1999
bash-5.1# 

did you get anywhere with this. When i first setup nut i had a way of changing the beeper status but ive completely forgotten how to get into the addons console. I’ve got HAOS installed and nut is an addon. How to i ssh into the addon to run the nut commands?

I just ran this command successfully using the terminal ssh addon to turn off the beeper in the NUT addon:

docker exec addon_a0d7b954_nut upscmd -u xxx -p xxx ups-name@localhost beeper.disable

Looks like you were using a command that doesn’t exist.
beeper.toggle → should be beeper.disable.

See also:

Did you ever find out how to do this? I’m facing the same…

I started taking better notes when I do things.

Here’s my notes on this.

With Nut installed as an HA addon and configured in unraid, use unraid terminal for ups commands where ups is the configred name in NUT

upsc [email protected]
See all parameters output by the UPS

upscmd -l [email protected]
Instant commands supported on UPS

upscmd [email protected] beeper.disable

then enter nut username and password

Alternate
From Shell command and SSH to NUT addon - #4 by imeekle

in HA terminal

docker exec addon_a0d7b954_nut upscmd -u nutuser -p nutpassword ups@localhost beeper.disable