check_modem: Check modem registration state and warn if unexpected
This commit is contained in:
parent
9014bf2b6a
commit
809ceb7cb0
1 changed files with 7 additions and 3 deletions
|
|
@ -61,9 +61,13 @@ if __name__ == "__main__":
|
|||
status['state_text'] = MMModemState(status['state']).name
|
||||
|
||||
# return code: if registered and signal > 0, return 0
|
||||
if modem.GetStatus()["state"] in [ MMModemState.REGISTERED, MMModemState.CONNECTED ] and modem.SignalQuality[0] > 0 and modem.RegistrationState == 1:
|
||||
print("OK: ", end='')
|
||||
exit_code = 0
|
||||
if modem.GetStatus()["state"] in [ MMModemState.REGISTERED, MMModemState.CONNECTED ] and modem.SignalQuality[0] > 0:
|
||||
if modem.RegistrationState == 1:
|
||||
print("OK: ", end='')
|
||||
exit_code = 0
|
||||
else:
|
||||
print("WARNING: Registration state is not HOME - ", end='')
|
||||
exit_code = 1
|
||||
elif modem.GetStatus()["state"] in [ MMModemState.INITIALIZING, MMModemState.ENABLED, MMModemState.SEARCHING, MMModemState.DISCONNECTING ]:
|
||||
print("WARNING: ", end='')
|
||||
exit_code = 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue