diff --git a/tsdriver.py b/tsdriver.py index 4fa2fe2..c27175c 100644 --- a/tsdriver.py +++ b/tsdriver.py @@ -73,19 +73,23 @@ def setupChannels(): class start(threading.Thread, deviceBase): - + def updateGPS(self): + gps = self.mcu.gps + print("GPS found me at {0}".format(gps)) + self.sendtodb("gps", gps, 0) def __init__(self, name=None, number=None, mac=None, Q=None, mcu=None, companyId=None, offset=None, mqtt=None, Nodes=None): 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.version = "3" self.device_address = addr self.finished = threading.Event() threading.Thread.start(self) self.sendtodbJSON("device_address", self.device_address, 0) setupChannels() + self.updateGPS() # 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): @@ -139,8 +143,7 @@ class start(threading.Thread, deviceBase): self.device_address = value return True + def tagserver_gpsUpdate(self, name, value): - gps = self.mcu.gps - print("GPS found me at {0}".format(gps)) - self.sendtodb("gps", gps, 0) + updateGPS() return True