3c9fea3
diff -up nut-2.6.5/scripts/python/app/NUT-Monitor.unreachable nut-2.6.5/scripts/python/app/NUT-Monitor
3c9fea3
--- nut-2.6.5/scripts/python/app/NUT-Monitor.unreachable	2012-07-31 19:38:56.000000000 +0200
3c9fea3
+++ nut-2.6.5/scripts/python/app/NUT-Monitor	2013-01-07 18:04:26.532531441 +0100
3c9fea3
@@ -674,6 +674,11 @@ class interface :
3c9fea3
             self.gui_status_notification( _("Device '%s' not found on server") % self.__current_ups, "warning.png" )
3c9fea3
             return
3c9fea3
 
3c9fea3
+        if not self.__ups_handler.CheckUPSAvailable( self.__current_ups ): 
3c9fea3
+            self.gui_status_message( _("UPS '{0}' is not reachable").format( self.__current_ups ) )
3c9fea3
+            self.gui_status_notification( _("UPS '{0}' is not reachable").format( self.__current_ups ), "warning.png" )
3c9fea3
+            return
3c9fea3
+
3c9fea3
         self.__connected = True
3c9fea3
         self.__widgets["ups_connect"].hide()
3c9fea3
         self.__widgets["ups_disconnect"].show()
3c9fea3
diff -up nut-2.6.5/scripts/python/module/PyNUT.py.unreachable nut-2.6.5/scripts/python/module/PyNUT.py
3c9fea3
--- nut-2.6.5/scripts/python/module/PyNUT.py.unreachable	2012-07-31 19:38:56.000000000 +0200
3c9fea3
+++ nut-2.6.5/scripts/python/module/PyNUT.py	2013-01-07 17:41:26.548440712 +0100
3c9fea3
@@ -158,6 +158,20 @@ available vars.
3c9fea3
 
3c9fea3
         return( ups_vars )
3c9fea3
 
3c9fea3
+    def CheckUPSAvailable( self, ups="") :
3c9fea3
+        """ Check whether UPS is reachable
3c9fea3
+
3c9fea3
+Just tries to contact UPS with safe command.
3c9fea3
+The result is True (rechable) or False (unreachable)
3c9fea3
+        """
3c9fea3
+        self.__srv_handler.write( "LIST CMD %s\n" % ups )
3c9fea3
+        result = self.__srv_handler.read_until( "\n" )
3c9fea3
+        if result != "BEGIN LIST CMD %s\n" % ups :
3c9fea3
+            return False
3c9fea3
+
3c9fea3
+        self.__srv_handler.read_until( "END LIST CMD %s\n" % ups )
3c9fea3
+        return True
3c9fea3
+
3c9fea3
     def GetUPSCommands( self, ups="" ) :
3c9fea3
         """ Get all available commands for the specified UPS
3c9fea3