added try/catch
This commit is contained in:
@@ -69,28 +69,31 @@ class start(threading.Thread, deviceBase):
|
|||||||
send_loops = 0
|
send_loops = 0
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
now = time.time()
|
try:
|
||||||
if self.force_send:
|
now = time.time()
|
||||||
log.warning("FORCE SEND: TRUE")
|
if self.force_send:
|
||||||
|
log.warning("FORCE SEND: TRUE")
|
||||||
|
|
||||||
for chan in CHANNELS:
|
for chan in CHANNELS:
|
||||||
val = chan.read()
|
val = chan.read()
|
||||||
if chan.check(val, self.force_send):
|
if chan.check(val, self.force_send):
|
||||||
self.sendtodbDev(1, chan.mesh_name, chan.value, 0, 'tankalarms')
|
self.sendtodbDev(1, chan.mesh_name, chan.value, 0, 'tankalarms')
|
||||||
time.sleep(TAG_DATAERROR_SLEEPTIME) # sleep to allow Micro800 to handle ENET requests
|
time.sleep(TAG_DATAERROR_SLEEPTIME) # sleep to allow Micro800 to handle ENET requests
|
||||||
|
|
||||||
# print("tankalarms driver still alive...")
|
# print("tankalarms driver still alive...")
|
||||||
if self.force_send:
|
if self.force_send:
|
||||||
if send_loops > 2:
|
if send_loops > 2:
|
||||||
log.warning("Turning off force_send")
|
log.warning("Turning off force_send")
|
||||||
self.force_send = False
|
self.force_send = False
|
||||||
send_loops = 0
|
send_loops = 0
|
||||||
else:
|
else:
|
||||||
send_loops += 1
|
send_loops += 1
|
||||||
|
|
||||||
|
|
||||||
if (now - self.public_ip_address_last_checked) > IP_CHECK_PERIOD:
|
if (now - self.public_ip_address_last_checked) > IP_CHECK_PERIOD:
|
||||||
self._check_ip_address()
|
self._check_ip_address()
|
||||||
|
except Exception as e:
|
||||||
|
log.error(e)
|
||||||
|
|
||||||
|
|
||||||
def _check_ip_address(self):
|
def _check_ip_address(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user