Nut Commands (upscmd)

The nut integration is used when you want HA to become a client of an existing NUT server. It pulls info from it into sensors and such so you can use that info in automations.

The NUT addon is a NUT server. It’s used when you have a UPS attached to the HA machine. Then HA can use the NUT integration to talk to the addon and pull in info from that UPS.

Also in general integrations are part of HA. They don’t run in a separate container or even a separate process, they’re just HA. If you use them the code is loaded, if not then it’s not.

Addons are entirely separate software. They run in their own docker container. It’s often possible to load/configure an integration in HA which then talks to them (Mqtt, nut, influx, etc). Sometimes they only talk to HA (nginx ssl proxy, node red, studio code server, etc). Sometimes they just completely do their own thing alongside HA (let’s encrypt, duckdns, bitwarden, bookstacks, etc). It varies.

2 Likes

Thanks so much for helping.

Yes I just figured that out :slight_smile:

nut is running in proxmox host, just figured out how to ssh into the prox host and execute a command.

1 Like

I submitted a pull request to add a new service to run the commands. Let’s see if it makes it to the next release.

In the next iteration I can add a sensor with the available commands.

My Cyber Power unit was displaying that the battery was healthy but in reality it was not. The unit failed a couple of times when we lost power, so I decided to run a self test and it failed again. With the new service I can run periodic self tests and be alerted about when it is time to replace the battery again.

2 Likes

That is really nice to hear! Could you inform us when it will be released?

Just one question - how it will be possible then to issue commands? If you are able to provide some examples/how to’s, it would really be nice.

I believe in the release of April 2023, since it looks like we just missed the cutoff date for the March one (the pull request is still open).

The commands will show up as device actions, meaning that you can use them in automations. My initial idea was to use services, but after some discussion we agreed that device actions were a better fit.

I am attaching a screenshot from my local dev environment. Apologies for the delayed response, somehow I had missed your comment.

2 Likes

I also created a separate feature request to include a new section under Developer Tools to run device actions easily.

2 Likes

Is this locked down for the April release? Thanks!

The PR has not had activity for some time and is still pending approval, so I guess it won’t be included in the April release. I just pinged the reviewer to see if there is anything else required from my end.

1 Like

Here’s hoping @bdraco can move this forward soon.

Thanks for all your work so far, @pmestevez :muscle:

1 Like

The wait is over :tada:. The ability to run commands as device actions made it to the May 2023 release. The NUT integration now includes a section dedicated to Device Actions.

3 Likes

can this be used to change battery.date or other variables? and how do I execute the commands. in your link it shows upscmd -l and and example, but I don’t know where to input the commands.

I would really like to contribute, but have no experience with contributing to an add-on.

Is there a guide?

I have a large UPS ( 9355-30-NL-15 by Powerware Corporation - 27 kW - 28 kWh)
The driver in NUT has only a few device actions.
I have communication up and running and can perform test :smiley:

I would ideally have all the controls that are described in the manual- see pic.

I don’t really understand how I can send commands using NUT integration. I’m running HAOS and don’t see any Device Actions.

I have the NUT add-on running as server on the same HAOS device.

Maybe there is some guide how to do this? Unfortunately I do not have an access to my HA with UPS right now (it is in other country), so I cannot check this… But maybe the integration author can help?

Sorry, but where can I see these Actions?

1 Like

You can see the actions in a few ways, like when creating a script or automation from the UI and selecting as one of the actions Device Actions.

For a script: Settings > Automations & scenes > Scripts (on the top) > Add script > Create new script > Add Action > Device > Look for your UPS device in the Device dropdown

The Action dropdown will have all the available actions.

ezgif-1-e1b10c5e22

5 Likes

Noob question, but how are you running docker exec? I’ve tried to run it in both the VSCode addon’s terminal & ssh addon, and in both cases, I’m getting:

$ docker
zsh: command not found: docker

Obviously, this is because both of these terminals are running a docker container themselves, but that begs the question, how do you shell into the docker host itself? Are you using the Home Assistant debug mode?

Looks like OP is inactive, but is it possible for a moderate to mark this post as the solution for this thread?

CC @tom_l

You can enable SSH in HAOS to run docker commands.

Yes, I used Debug Mode to execute the command (you need ssh access to the host in order to control the docker containers, you cannot send commands from within an Add-on itself).

But if you don’t want to go through all that, now device actions are available for Network UPS Tools, so you can create a script / automation that executes the command on the chosen UPS.

When you are creating your script / automation, just add a device action and search for your UPS with the name you have given to it, then it will list all the possible commands you can run.

1 Like