kantlivelong / OctoPrint-UPS

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

config['ups'] gets set to 'null' #12

Open kantlivelong opened 2 years ago

kantlivelong commented 2 years ago

Not sure where or why this happens yet but...

022-03-17 20:44:26,381 - octoprint.plugins.ups - ERROR - An exception occurred while getting vars info Traceback (most recent call last): File "/home/pi/.octoprint/plugins/ups/init.py", line 132, in _loop vars = self.ups.list_vars(ups=self.config['ups']) File "/home/pi/oprint/lib/python3.7/site-packages/nut2.py", line 157, in list_vars self._srv_handler.write(b"LIST VAR %s\n" % ups.encode('utf-8')) AttributeError: 'NoneType' object has no attribute 'encode'

config yaml shows ups is 'null'. Opening settings. selecting the ups again, and saving works around for a short while until it happens again.

kantlivelong commented 2 years ago

So far I can't replicate it on demand. If anyone is able to please provide.

kantlivelong commented 2 years ago

I think I see what's happening. Normally this shouldn't happen (obviously) but in some cases a response may not be received when requesting the UPS list during showing the settings window. Since we don't need to get the list every time we open the window I've adjusted to set the list options to the current value on load then grab the list when clicking the dropdown or the refresh button.

@InoSiX would you be willing to test this version?

https://github.com/kantlivelong/OctoPrint-UPS/archive/6a1769f1e4a556c488a4eafba698c71cb39ba232.zip

kantlivelong commented 2 years ago

This is fixed with 5d4cec97497eabba4a9c0802ca91a21aa1f4c690 and will be in the next release.

InoSiX commented 2 years ago

I'm so sorry, @kantlivelong I failed to pay attention to my emails/this issue. I would have loved to be part of the solution. I'll try the update here soon. Thank you for following up.

kantlivelong commented 2 years ago

All good. The changrs in devel should do the trick.

InoSiX commented 2 years ago

Maybe I misread your post, I thought I read you fixed it in an upcoming release but no update is available on the plugin manager. How do I go about installing your zip to assist you? I reenabled the plugin and it is currently disconnected (although it is configured as far as I can tell).

kantlivelong commented 2 years ago

Use the zip link above in plugin manager where the option is available to install from URL.

InoSiX commented 2 years ago

I have successfully updated using your zip link. It wasn't connected immediately and I had to open the options page and select the UPS again. Once I did, however, it is connected.

I will monitor the log to make sure it doesn't inflate again.

edalquist commented 1 year ago

Fixes the issue for me as well, any chance this can get pushed into an actual release?

kantlivelong commented 1 year ago

I'm hoping to do some work on this plugin soon :tm: and get a release out.