Skip to content

NUT-Monitor: Add automatic reconnection mechanism for Py2Gtk2 too#3530

Open
jimklimov wants to merge 3 commits into
networkupstools:masterfrom
jimklimov:issue-3509
Open

NUT-Monitor: Add automatic reconnection mechanism for Py2Gtk2 too#3530
jimklimov wants to merge 3 commits into
networkupstools:masterfrom
jimklimov:issue-3509

Conversation

@jimklimov

Copy link
Copy Markdown
Member

Replicate the solution from #3523; testing needed

Should help UI on antique platforms that can not for some reason be updated; in fact I currently struggle to find testbeds with GUI that would be so far behind ;)

developersorli and others added 3 commits July 5, 2026 14:42
- Add automatic reconnection when connection to NUT server is lost
- Implement proper teardown of old PyNUTClient instances
- Use specific exceptions (socket.error, ConnectionError, EOFError, OSError, PyNUT.PyNUTError)
- Prevent multiple simultaneous reconnection attempts
- Add 'was_online' flag to track connection state changes
- Tested and confirmed working on both Qt5 and Qt6

Closes: networkupstools#3509
Signed-off-by: Programer <developer.sorli@gmail.com>
…tion modeled after PR networkupstools#3523 for Python3 siblings [networkupstools#3509]

Co-Authored-By: Programer <developer.sorli@gmail.com>
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov jimklimov added this to the 2.8.6 milestone Jul 15, 2026
@jimklimov jimklimov added need testing Code looks reasonable, but the feature would better be tested against hardware or OSes python portability We want NUT to build and run everywhere possible Connection stability issues Issues about driver<->device and/or networked connections (upsd<->upsmon...) going AWOL over time AI For good or bad, machine tools are upon us. Humans are still the responsible ones. labels Jul 15, 2026
@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown

A ZIP file with standard source tarball and another tarball with pre-built docs for commit 39637b8 is temporarily available: NUT-tarballs-PR-3530.zip.

@AppVeyorBot

Copy link
Copy Markdown

Build nut 2.8.5.4929-master completed (commit acaf0b2929 by @jimklimov)

@jimklimov

jimklimov commented Jul 16, 2026

Copy link
Copy Markdown
Member Author

Seems to work. I found a host where Py2Gtk could still run (NetBSD 9.2), connected to a NUT server from NUT-Monitor, and stopped the server.

Within a few seconds, the client status bar was cycling the reconnection messages every couple of seconds:

  • image
  • image

and it was satisfied soon after I started the data server back:

  • image

NOTE: The status bar message remains "Reconnected" even after a couple of hours, as opposed to "Connected..." seen initially.

Double-checked that at least Py3Qt5 variant worked similarly at least once, more details in #3523.

Kudos to @developersorli for the original work on Python3 versions, and IntelliJ Junie for porting it to Python2 :)

@jimklimov jimklimov added ready / gonna merge The PR is in final cycles leading to merge unless someone logs an objection before we hit the button and removed need testing Code looks reasonable, but the feature would better be tested against hardware or OSes labels Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI For good or bad, machine tools are upon us. Humans are still the responsible ones. Connection stability issues Issues about driver<->device and/or networked connections (upsd<->upsmon...) going AWOL over time portability We want NUT to build and run everywhere possible python ready / gonna merge The PR is in final cycles leading to merge unless someone logs an objection before we hit the button

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants