hassio-addons / addon-nut

Network UPS Tools - Home Assistant Community Add-ons
https://addons.community
MIT License
179 stars 35 forks source link

Cannot shutdown ups in HA with NUT Addon #306

Closed danmrossi closed 1 year ago

danmrossi commented 1 year ago

Hi all

I am using Home Assistant with various other Add-ons and NUT to control all life support systems on an Aquarium, The UPS has been hacked as such to use much larger batteries so i get hours and hours of runtime - This part works fine.

I can read voltages, load, status etc fine from the UPS.

The issue is when i create an automation using: "Turn off the load possibly after a delay and return when power is back" image

I get the following error: image

Even if i choose "Start a quick battery test" get an error.

Also how long is the delay before the ups turns off. Is it something we can find out and/or override to make delay longer? Reason being is i would like to make sure enough time has passed for the Pi to shutdown before the UPS turns off. As we all know if we don't have the UPS turn off and then come back on when the power to the UPS is reinstated then the Pi will stay in its off state.

Used Hardware and HA Versions Hardware: Raspberry Pi 4 8GB RAM -Home Assistant 2023.5.4 -Supervisor: 2023.06.2 -Operating System: 10.3 -Frontend: 20230503.3 - Latest

Using Network UPS Tools v0.12.0

CyberPower UPS connected directly via USB to the Home Assistant Raspberry Pi and the username/password in the NUT Config is the same as my HA login.

These are my settings:

NUT Addon Config: image

NUT Addon Log: s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service base-addon-banner: starting

Add-on: Network UPS Tools Manage battery backup (UPS) devices

Add-on version: 0.12.0 You are running the latest version of this add-on. System: Home Assistant OS 10.3 (aarch64 / raspberrypi4-64) Home Assistant Core: 2023.5.4 Home Assistant Supervisor: 2023.06.2

Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat.

s6-rc: info: service base-addon-banner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service base-addon-timezone: starting s6-rc: info: service base-addon-log-level: starting s6-rc: info: service fix-attrs successfully started [14:53:51] INFO: Configuring timezone (Australia/Perth)... s6-rc: info: service base-addon-log-level successfully started s6-rc: info: service base-addon-timezone successfully started s6-rc: info: service legacy-cont-init: starting cont-init: info: running /etc/cont-init.d/nut.sh [14:53:53] INFO: Setting mode to netserver... [14:53:53] INFO: Connected USB devices: Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 003: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub [14:53:53] INFO: Generating /etc/nut/upsd.users... [14:53:53] INFO: Configuring user: Daniel [14:53:54] INFO: Password is NOT in the Have I Been Pwned database! Nice! [14:53:55] INFO: Configuring Device named Aquarium-UPS... [14:53:55] INFO: Starting the UPS drivers... Using subdriver: CyberPower HID 0.6 Network UPS Tools - Generic HID driver 0.47 (2.8.0) USB communication driver (libusb 1.0) 0.43 Network UPS Tools - UPS driver controller 2.8.0 cont-init: info: /etc/cont-init.d/nut.sh exited 0 cont-init: info: running /etc/cont-init.d/nutclient.sh cont-init: info: /etc/cont-init.d/nutclient.sh exited 0 s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting services-up: info: copying legacy longrun upsd (no readiness notification) services-up: info: copying legacy longrun upsmon (no readiness notification) s6-rc: info: service legacy-services successfully started [14:53:56] INFO: Starting the UPS information server... 0.000000 fopen /run/nut/upsd.pid: No such file or directory 0.000069 Could not find PID file '/run/nut/upsd.pid' to see if previous upsd instance is already running! 0.000875 [D1] debug level is '1' 0.001239 listening on 0.0.0.0 port 3493 0.003437 Connected to UPS [Aquarium-UPS]: usbhid-ups-Aquarium-UPS 0.004941 Running as foreground process, not saving a PID file [14:53:57] INFO: Starting the UPS monitor and shutdown controller... 0.000000 fopen /run/nut/upsmon.pid: No such file or directory 0.000279 Could not find PID file to see if previous upsmon instance is already running! 0.000803 Using power down flag file /etc/killpower 0.001260 UPS: Aquarium-UPS@localhost (primary) (power value 1) 0.001879 [D1] debug level is '1' 0.002199 [D1] debug level is '1' 0.002579 Warning: running as one big root process by request (upsmon -p) 0.002992 [D1] Saving PID 469 into /run/nut/upsmon.pid Init SSL without certificate database 0.008528 [D1] Trying to connect to UPS [Aquarium-UPS@localhost] 0.544378 User upsmonmaster@127.0.0.1 logged into UPS [Aquarium-UPS] 0.010713 [D1] Logged into UPS Aquarium-UPS@localhost

sinclairpaul commented 1 year ago

I'll be honest and don't really understand what this issue has to do with the addon, sounds like the integration isn't configured with the correct permissions, or maybe an issue with the integration itself.

Perhaps expose the addon and run upsc commands from an alternate host to test?

danmrossi commented 1 year ago

Should I post this somewhere else such as the ha core GitHub section?

Have exposed the instance and accessed it remotely it as part of my tests before logging this and sending commands to it from another pc works without issue.

Sent from my iPhone

On 23 Jun 2023, at 9:07 am, Paul Sinclair @.***> wrote:



I'll be honest and don't really understand what this issue has to do with the addon, sounds like the integration isn't configured with the correct permissions, or maybe an issue with the integration itself.

Perhaps expose the addon and run upsc commands from an alternate host to test?

— Reply to this email directly, view it on GitHubhttps://github.com/hassio-addons/addon-nut/issues/306#issuecomment-1603496356, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMCDRZM5ODG3RGATFBAT2DDXMTT4DANCNFSM6AAAAAAZPYTWH4. You are receiving this because you authored the thread.Message ID: @.***>

sinclairpaul commented 1 year ago

I'd suggest looking at the documentation for the integration in relation to User Permissions https://www.home-assistant.io/integrations/nut/#user-credentials-and-permissions, specifically the actions.

Closing here as it appears to be integration related.