January 24, 20242 yr I recently purchased an APC Smart-UPS 1500 (model SMT1500) and have it connected to my Unraid server via USB (type A to B). When using the ModBus protocol, communication eventually drops out without any "communication lost" warning. ModBus is enabled on the UPS. For a period of time after starting the APCUPSD server, everything works as expected. Power usage and voltage in/out are updated in real-time, and any power loss is detected immediately. After some time (say, 1-8 hours), all of the metrics stop being updated and a simulated power loss can't be detected. Even though none of the data is being updated, APCUPSD still thinks it's connected. The connection rarely recovers from this state without a manual restart of APCUPSD (or an Unraid reboot). If the connection does recover, a loss of communication is reported. The settings I'm using are: UPS cable: USB Custom UPS cable: <not specified> UPS type: ModBus Device: <not specified> When not using the ModBus protocol, communication seems stable, with no disconnections (detected or undetected) for the last week. I'd really prefer ModBus though, because APCUPSD is missing load percentage and various other metrics when using the default USB protocol. I also tried NUT using the ModBus protocol, but it seems like the updates are not as frequent, updating once per several minutes. I didn't notice any hard dropouts, but there were periods of time with suspiciously few updates. No restarts were required to restore communication, unlike APCUPSD. With a prior UPS, I had to periodically reset the USB connection (it was not using ModBus) when running NUT (but not APCUPSD). I have no idea if these problems are related. Has anybody else had similar issues? Do I need to modify the ModBus settings of the UPS for more reliable performance?
January 25, 20242 yr In the NUT Settings you can raise the "UPS Driver Debug Level" setting to see what's going on in the suspected stale times. Would be interesting to see what the driver is doing between the updates, raising the debug level should bring this clarity. 🙂
January 26, 20242 yr Author 12 hours ago, Rysz said: In the NUT Settings you can raise the "UPS Driver Debug Level" setting to see what's going on in the suspected stale times. Would be interesting to see what the driver is doing between the updates, raising the debug level should bring this clarity. 🙂 I'll try that and let it run for a bit. Do you know what debug level I should be using? 1 didn't seem to do much, but 2 is giving me entries like this one: Jan 25 20:35:02 BatRAID apc_modbus[21197]: [D2:21197] send_to_one: sending SETINFO battery.charge "100.00" Thing is, I got many of those all at once and none in the several minutes since then. Is that indicative of no new data from the UPS or is this expected for level 2 debug logging? Edit: I stepped up the levels until I got to 5, which seems to be providing a lot more information. Perhaps too much--this will be a big log file. But I'm getting very frequent entries with the updated data. As an alternative, I see that I can download data from the NUT Statistics Server, but I see two potential issues. The first is that there are no timestamps for each entry, just the date, though perhaps I can infer each entry is a minute based on my configuration. But more importantly, will the statistics server still include an entry if it thinks it's connected to the UPS but actually has stale data? Edited January 26, 20242 yr by Batman
January 26, 20242 yr Author Even with this brief bit of logging, I'm seeing something interesting--but on the client side. Below is the history captured by Home Assistant, running a NUT Client. It shows the UPS load flat at 5.8% from 20:56:27 until 21:00:27, when it decreases to 5.19%: Unraid's log shows a number of updates during this period that aren't reflected in Home Assistant: Jan 25 20:56:21 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.80" Jan 25 20:56:39 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "6.50" Jan 25 20:56:43 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.80" Jan 25 20:56:45 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "6.50" Jan 25 20:56:47 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "7.09" Jan 25 20:56:49 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.80" Jan 25 20:57:01 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "6.50" Jan 25 20:57:03 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "7.80" Jan 25 20:57:05 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "6.50" Jan 25 20:57:11 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.80" Jan 25 20:57:25 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "6.50" Jan 25 20:57:27 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.80" Jan 25 20:57:29 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "6.50" Jan 25 20:57:31 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "7.09" Jan 25 20:57:33 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.80" Jan 25 20:57:49 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "6.50" Jan 25 20:57:51 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "7.09" Jan 25 20:57:53 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.80" Jan 25 20:57:57 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "6.50" Jan 25 20:57:59 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.80" Jan 25 20:58:05 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "6.50" Jan 25 20:58:15 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.80" Jan 25 20:58:17 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "6.50" Jan 25 20:58:23 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.80" Jan 25 20:58:25 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "7.09" Jan 25 20:58:27 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.80" Jan 25 20:59:01 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "6.50" Jan 25 20:59:07 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.80" Jan 25 20:59:17 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "6.50" Jan 25 20:59:21 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.80" Jan 25 20:59:23 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "6.50" Jan 25 20:59:27 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.80" Jan 25 20:59:31 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "6.50" Jan 25 20:59:35 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.80" Jan 25 20:59:47 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "6.50" Jan 25 20:59:49 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.80" Jan 25 20:59:55 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "6.50" Jan 25 20:59:59 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.19" Jan 25 21:00:03 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "7.80" Jan 25 21:00:05 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "7.09" Jan 25 21:00:07 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.80" Jan 25 21:00:11 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "7.09" Jan 25 21:00:13 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "6.50" Jan 25 21:00:15 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.19" Jan 25 21:00:17 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "7.09" Jan 25 21:00:21 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.80" Jan 25 21:00:25 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.19" Jan 25 21:00:31 BatRAID apc_modbus[19406]: [D5:19406] send_to_all: SETINFO ups.load "5.80" It's notable that 1) Home Assistant appears to only update NUT data on the 27th second of each minute and 2) it's discarding the point if the data did not change. This is probably why I thought I was seeing period without data being updated. (Edit: Home Assistant documentation confirms the NUT integration indeed uses Local Polling but doesn't specify the frequency, though that's apparently every minute.) Anyway, I'll let this run for a bit, but I may have gotten to the root cause of (what I believed was the) NUT problem. The APCUPSD problem on the other hand, is real. It would go days at a time without updating the value and didn't recognize if I were to simulate a power outage during those periods. Is there similar debugging I can do with APCUPSD? I don't see logging/debug options in the GUI so I presume I'll need to modify the configuration file. Edited January 26, 20242 yr by Batman Reformat post and replace plot with the correct one.
January 26, 20242 yr Regarding the NUT Statistics Module, it'll also include stale data for a time-point if no new data is available at the time of querying. By your logs everything seems to work as it should NUT-wise, so it'll likely be a problem with HA's data retention and/or polling frequency. I have no idea about APCUPSD as I've never used it myself, but it likely doesn't get updated as often as NUT so maybe it's a protocol-related bug there. I use this quite successfully for monitoring NUT on my PRTG server, maybe there's also a JSON parser option within HA?: https://github.com/dietah/nut-http Edited January 26, 20242 yr by Rysz
February 4, 20242 yr 58 minutes ago, Whiskey90 said: I have the same issue with APCUPSD with the same APC unit. It seems APCUPSD development has been stale for a couple of years now, so wouldn't expect much there. In the meantime it seems the NUT ModBus implementation seems to work (see above), so might be worth testing that.
February 4, 20242 yr 33 minutes ago, Rysz said: It seems APCUPSD development has been stale for a couple of years now, so wouldn't expect much there. In the meantime it seems the NUT ModBus implementation seems to work (see above), so might be worth testing that. Unfortunately I am only able to get the usb driver to work and not the modbus. The auto tool seems to be able to pick up modbus, but I just get the same connection driver error issues despite playing with every setting I have seen on the internet related to APC units. Quote root: Duplicate driver instance detected (PID file /var/run/nut/apc_modbus-ups.pid exists)! Terminating other driver! apc_modbus[20570]: _apc_modbus_read_registers: Read of 0:27 failed: Connection timed out (auto) apc_modbus[20570]: Signal 15: exiting kernel: usb 3-4: usbfs: process 20595 (apc_modbus) did not claim interface 0 before use root: _apc_modbus_read_registers: Read of 516:604 failed: Connection timed out (auto) apc_modbus[20595]: _apc_modbus_read_registers: Read of 516:604 failed: Connection timed out (auto)
February 4, 20242 yr 1 minute ago, Whiskey90 said: Unfortunately I am only able to get the usb driver to work and not the modbus. The auto tool seems to be able to pick up modbus, but I just get the same connection driver error issues despite playing with every setting I have seen on the internet related to APC units. Did you enable ModBus on the UPS itself? It needs to be specifically enabled on the hardware and particularly if the regular USB driver works for you that seems to me a sign that ModBus is not enabled on your UPS.
February 4, 20242 yr 27 minutes ago, Rysz said: Did you enable ModBus on the UPS itself? It needs to be specifically enabled on the hardware and particularly if the regular USB driver works for you that seems to me a sign that ModBus is not enabled on your UPS. I did, it seems to be either a reoccurring issue with the UPS, the cable, or something else as this was happening with APCUPSD as well were I might have to enable/disable a few times to get it to connect. I will give a new cable a shot and see if thats it.
March 6, 20242 yr I'm also experiencing the same issue with apcupsd and modbus on a SMT2200. Did changing the cable fixed the problem for you? I've used the SNMP driver as a temporary fix for now and it seems to be very stable but i'm loosing the output current metric and battery temperature and other sensors are rounded up (not that it is a big deal really).
March 6, 20242 yr 1 hour ago, hollywood said: I'm also experiencing the same issue with apcupsd and modbus on a SMT2200. Did changing the cable fixed the problem for you? I've used the SNMP driver as a temporary fix for now and it seems to be very stable but i'm loosing the output current metric and battery temperature and other sensors are rounded up (not that it is a big deal really). It seems APCUPSD development has been stale for a couple of years now, so wouldn't expect much there. In the meantime it seems the NUT ModBus implementation seems to work (see above), so might be worth testing that.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.