- if ( pcu_state == 'NetDown' or pcu_state == 'Not_Run' or not ( pcu_state == 0 or pcu_state == "0" ) ) and \
- ( pcu.status == 'online' or pcu.status == 'good' ):
- print "changed status from %s to offline" % pcu.status
- pcu.status = 'offline'
- pcu.last_changed = datetime.now()
-
- if ( pcu_state == 0 or pcu_state == "0" ) and pcu.status not in [ 'online', 'good' ]:
+ # DOWN
+ if pcu_state not in [0, "0"] and pcu.status not in ['offline', 'down']:
+ print "changed status from %s to offline" % pcu.status
+ pcu.status = 'offline'
+ pcu.last_changed = datetime.now()
+
+ # ONLINE
+ if pcu_state in [0, "0"] and pcu.status not in [ 'online', 'good' ]: