forked from sqozz/sem6000
example: restart on BrokenPipeError
This commit is contained in:
parent
2f13d6f6a5
commit
7b82461f03
1 changed files with 1 additions and 1 deletions
|
@ -29,7 +29,7 @@ while True:
|
|||
socket.setStatus(True)
|
||||
print("=== {} ({}) ===".format(socket.mac_address, "on" if socket.powered else "off"))
|
||||
print("\t{}V {}A → {}W@{}Hz (PF: {})".format(socket.voltage, socket.current, socket.power, socket.frequency, socket.power_factor))
|
||||
except (SEMSocket.NotConnectedException, bluepy.btle.BTLEDisconnectError):
|
||||
except (SEMSocket.NotConnectedException, bluepy.btle.BTLEDisconnectError, BrokenPipeError):
|
||||
print("Restarting...")
|
||||
if socket != None:
|
||||
socket.disconnect()
|
||||
|
|
Loading…
Reference in a new issue