kantlivelong / OctoPrint-UPS

Integrates a UPS monitored by NUT into OctoPrint
GNU Affero General Public License v3.0
17 stars 7 forks source link

UPS plugin stops updating after a while. #3

Closed ManuelMcLure closed 2 years ago

ManuelMcLure commented 2 years ago

What were you doing?

  1. Install UPS plugin
  2. Point to already configured NUT entry for local UPS
  3. Plugin correctly shows UPS status
  4. Print with OctoPrint
  5. At some point the UPS plugin will stop updating and show stale data
  6. Check with "upsc" on the command line that the UPS is still connected and sending data.
  7. Sometimes (not always) opening the UPS plugin settings and saving makes the connection come back.

UPS is an APC BackUPS 1500M

What did you expect to happen?

Plugin would still update

What happened instead?

Version of OctoPrint

1.6.1

Version of OctoPrint-UPS

0.0.1

Operating System running OctoPrint

Debian Bullseye 11.0 on amd64 - Python 3.9

Printer model & used firmware incl. version

Custom, running Marlin bugfix-2.0.x

Link to octoprint.log with octoprnt.plugins.ups set to DEBUG

octoprint.zip

kantlivelong commented 2 years ago

How repeatable is this for you?

The next time it happens can you try the following via SSH.

$ nc localhost 3493
LIST UPS
BEGIN LIST UPS
UPS Dummy "Dummy UPS"
END LIST UPS
LIST VAR "Dummy"
BEGIN LIST VAR Dummy
VAR Dummy battery.charge "100.00"
VAR Dummy battery.runtime "3180.00"
VAR Dummy battery.runtime.low "300.00"
VAR Dummy battery.temperature "29.00"
VAR Dummy battery.voltage "27.60"
VAR Dummy device.mfr "DummyMfr"
VAR Dummy device.model "DummyModel"
VAR Dummy device.type "ups"
VAR Dummy driver.name "dummy-ups"
VAR Dummy driver.parameter.mode "dummy"
VAR Dummy driver.parameter.pollinterval "2"
VAR Dummy driver.parameter.port "dummy.ups"
VAR Dummy driver.parameter.synchronous "no"
VAR Dummy driver.version "2.7.4"
VAR Dummy driver.version.internal "0.14"
VAR Dummy ups.mfr "Dummy Manufacturer"
VAR Dummy ups.model "Dummy UPS"
VAR Dummy ups.status "OL"
END LIST VAR Dummy

Then shoot over the OctoPrint log and the result you get from the commands above.. Obviously replace the UPS identifier with your own.

ManuelMcLure commented 2 years ago

Will do. I can't figure out a way to make sure it happens - it's more a matter of "check the popover and see the data isn't valid", but next time it happens I'll run the above command. If you want me to run a debug version of the code let me know.

kantlivelong commented 2 years ago

When the issue occurs again you can simply just switch it to DEBUG and let it run for a minute or so. No need to restart OctoPrint or anything.

ManuelMcLure commented 2 years ago

That's the thing - the first time I noticed this, I turned on DEBUG for the plugin and there was absolutely nothing written to the log. It was like the loop had stopped executing. I was in the middle of a long print, I couldn't get any debug information from the plugin until the print was over and I could restart OctoPrint.

kantlivelong commented 2 years ago

Ah, Yeah that's likely the case. For now lets see what the nc session returns so we don't fill your log with debug statements for who knows how long.

InoSiX commented 2 years ago

Hiya,

Give this a shot:

https://nmaggioni.xyz/2017/03/14/NUT-CyberPower-UPS/

I had the same issue and this fixed it.

ManuelMcLure commented 2 years ago

I haven't been able to reproduce this, so I'll close this for now. If I see the problem occur again I'll reopen.