networkupstools / nut

The Network UPS Tools repository. UPS management protocol Informational RFC 9271 published by IETF at https://www.rfc-editor.org/info/rfc9271 Please star NUT on GitHub, this helps with sponsorships!
https://networkupstools.org/
Other
1.92k stars 345 forks source link

[HCL] APC Back-UPS "Essential" BE850G2-FR supported by usbhid-ups #2579

Open cornebistouille opened 1 month ago

cornebistouille commented 1 month ago

device APC Back-UPS "Essential" BE850G2-FR

not sure how to speak to the server via home assistant terminal (upsc myupsname@localhost won't work) so i put my server log after a start)

   0.066364 User upsmonmaster@127.0.0.1 logged into UPS [myups]
   0.010384 [D1] Logged into UPS myups@localhost
s6-rc: info: service legacy-services: stopping
3982.868695 mainloop: Interrupted system call
3982.869192 Signal 15: exiting
3982.869682 [D1] driver_free: forgetting UPS [myups] (FD 4)
3982.814016 Signal 15: exiting
Network UPS Tools upsd 2.8.0
Network UPS Tools upsmon 2.8.0
[19:07:14] INFO: upsd stopped, restarting...
[19:07:14] INFO: upsmon stopped, restarting...
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-timezone: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-timezone successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
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.13.1
 You are running the latest version of this add-on.
 System: Home Assistant OS 12.4  (aarch64 / green)
 Home Assistant Core: 2024.7.3
 Home Assistant Supervisor: 2024.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
[19:09:35] INFO: Configuring timezone (Europe/Paris)...
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
[19:09:39] INFO: Setting mode to netserver...
[19:09:40] INFO: Connected USB devices:
Bus 006 Device 002: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 002: ID 10c4:ea60 Silicon Labs CP210x UART Bridge
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[19:09:41] INFO: Generating /etc/nut/upsd.users...
[19:09:42] INFO: Configuring user: nutsy
[19:09:45] INFO: Password is NOT in the Have I Been Pwned database! Nice!
[19:09:51] INFO: Configuring Device named myups...
[19:09:51] INFO: Starting the UPS drivers...
Using subdriver: APC HID 0.98
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
[19:09:54] INFO: Starting the UPS information server...
   0.000000 fopen /run/nut/upsd.pid: No such file or directory
   0.000082 Could not find PID file '/run/nut/upsd.pid' to see if previous upsd instance is already running!

   0.000970 [D1] debug level is '1'
   0.001400 listening on 0.0.0.0 port 3493
   0.002742 Connected to UPS [myups]: usbhid-ups-myups
   0.005927 Running as foreground process, not saving a PID file
[19:09:55] INFO: Starting the UPS monitor and shutdown controller...
   0.000000 fopen /run/nut/upsmon.pid: No such file or directory
   0.000086 Could not find PID file to see if previous upsmon instance is already running!

   0.000585 Using power down flag file /etc/killpower
   0.000871 UPS: myups@localhost (primary) (power value 1)
   0.000935 [D1] debug level is '1'
   0.001099 [D1] debug level is '1'
   0.001118 Warning: running as one big root process by request (upsmon -p)
   0.001343 [D1] Saving PID 464 into /run/nut/upsmon.pid
Init SSL without certificate database
   0.029998 [D1] Trying to connect to UPS [myups@localhost]
   0.497678 User upsmonmaster@127.0.0.1 logged into UPS [myups]
   0.033475 [D1] Logged into UPS myups@localhost

shutdown tested successfully

link to the product (APC) : documentation

jimklimov commented 1 month ago

Thank you! I believe HA plugins are containers, so localhost is relative to each one (e.g. if you can log into the container with NUT plugin, upsc might work). I am not sure if those container definitions expose the NUT port (3493) on the host system or beyond, or have a configuration to do so.

The data server does say listening on 0.0.0.0 port 3493 so if that container has an IP address, at least accessible within its host system and not firewalled away by container infrastructure, you might upsc myupsname@1.2.3.4 using that container's IP address or name. Google commonly reports a0d7b954-nut as a hostname the plugin could be exposed as. UPDATE: Actually the plugin README says as much :)