Delete unnecessary files
This commit is contained in:
@@ -1,75 +0,0 @@
|
||||
"""Driver for promagmbs."""
|
||||
|
||||
import threading
|
||||
from device_base import deviceBase
|
||||
from utilities import get_public_ip_address
|
||||
import time
|
||||
|
||||
|
||||
_ = None
|
||||
|
||||
|
||||
class start(threading.Thread, deviceBase):
|
||||
"""Start class required by Meshify."""
|
||||
|
||||
def __init__(self, name=None, number=None, mac=None, Q=None, mcu=None, companyId=None, offset=None, mqtt=None, Nodes=None):
|
||||
"""Initialize the driver."""
|
||||
threading.Thread.__init__(self)
|
||||
deviceBase.__init__(self, name=name, number=number, mac=mac, Q=Q, mcu=mcu, companyId=companyId, offset=offset, mqtt=mqtt, Nodes=Nodes)
|
||||
|
||||
self.daemon = True
|
||||
self.version = "1"
|
||||
self.finished = threading.Event()
|
||||
self.forceSend = False
|
||||
threading.Thread.start(self)
|
||||
|
||||
# this is a required function for all drivers, its goal is to upload some piece of data
|
||||
# about your device so it can be seen on the web
|
||||
def register(self):
|
||||
"""Register the driver."""
|
||||
# self.sendtodb("log", "BOOM! Booted.", 0)
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
# pass
|
||||
"""Actually run the driver."""
|
||||
global persist
|
||||
wait_sec = 60
|
||||
for i in range(0, wait_sec):
|
||||
print("promagmbs driver will start in {} seconds".format(wait_sec - i))
|
||||
time.sleep(1)
|
||||
print("BOOM! Starting promagmbs driver...")
|
||||
|
||||
public_ip_address = get_public_ip_address()
|
||||
self.sendtodbDev(1, 'public_ip_address', public_ip_address, 0, 'promagmbs')
|
||||
|
||||
send_loops = 0
|
||||
watchdog_loops = 0
|
||||
watchdog_check_after = 5000
|
||||
while True:
|
||||
if self.forceSend:
|
||||
print "FORCE SEND: TRUE"
|
||||
|
||||
print("promagmbs driver still alive...")
|
||||
if self.forceSend:
|
||||
if send_loops > 2:
|
||||
print("Turning off forceSend")
|
||||
self.forceSend = False
|
||||
send_loops = 0
|
||||
else:
|
||||
send_loops += 1
|
||||
|
||||
watchdog_loops += 1
|
||||
if (watchdog_loops >= watchdog_check_after):
|
||||
test_public_ip = get_public_ip_address()
|
||||
if not test_public_ip == public_ip_address:
|
||||
self.sendtodbDev(1, 'public_ip_address', test_public_ip, 0, 'promagmbs')
|
||||
public_ip_address = test_public_ip
|
||||
watchdog_loops = 0
|
||||
time.sleep(10)
|
||||
|
||||
def promagmbs_sync(self, name, value):
|
||||
"""Sync all data from the driver."""
|
||||
self.forceSend = True
|
||||
self.sendtodb("log", "synced", 0)
|
||||
return True
|
||||
Reference in New Issue
Block a user