Removes sleep logic and grabs daily total every 12 hours

Also increments version number to 6
This commit is contained in:
Patrick McDonagh
2017-05-24 09:48:07 -05:00
parent 273f29b851
commit 79767d383b
3 changed files with 484 additions and 477 deletions

View File

@@ -1,34 +1,31 @@
"""Driver for connecting ABB Flowmeter to Meshify."""
import threading import threading
import time
from device_base import deviceBase from device_base import deviceBase
from datetime import datetime
class start(threading.Thread, deviceBase): class start(threading.Thread, deviceBase):
"""Start class required for driver."""
def __init__(self, name=None, number=None, mac=None, Q=None, mcu=None, def __init__(self, name=None, number=None, mac=None, Q=None, mcu=None,
companyId=None, offset=None, mqtt=None, Nodes=None): companyId=None, offset=None, mqtt=None, Nodes=None):
"""Initalize the driver."""
threading.Thread.__init__(self) threading.Thread.__init__(self)
deviceBase.__init__(self, name=name, number=number, mac=mac, Q=Q, deviceBase.__init__(self, name=name, number=number, mac=mac, Q=Q,
mcu=mcu, companyId=companyId, offset=offset, mcu=mcu, companyId=companyId, offset=offset,
mqtt=mqtt, Nodes=Nodes) mqtt=mqtt, Nodes=Nodes)
self.daemon = True self.daemon = True
self.version = "5" self.version = "6"
self.finished = threading.Event() self.finished = threading.Event()
threading.Thread.start(self) threading.Thread.start(self)
self.sleep_minutes = 20
# this is a required function for all drivers # this is a required function for all drivers
# its goal is to upload some piece of data # its goal is to upload some piece of data
# about your device so it can be seen on the web # about your device so it can be seen on the web
def register(self): def register(self):
"""Register the driver."""
self.channels["status"]["last_value"] = "" self.channels["status"]["last_value"] = ""
def run(self): def run(self):
self.sendtodbDev("01", 'sleeplog', "I'm awake!", 0, "abbflow") """Run the driver."""
while (True): pass
t = datetime.now()
if (t.minute == 10 or t.minute == 40):
self.sendtodbDev("01", 'sleeplog', "Going to sleep...", 0, "abbflow")
self.mcu.sleep(self.sleep_minutes * 60)

View File

@@ -3,7 +3,7 @@
"driverFileName":"abbflow.py", "driverFileName":"abbflow.py",
"deviceName":"abbflow", "deviceName":"abbflow",
"driverId":"0110", "driverId":"0110",
"releaseVersion":"5", "releaseVersion":"6",
"files": { "files": {
"file1":"abbflow.py", "file1":"abbflow.py",
"file2":"modbusMap.p" } "file2":"modbusMap.p" }

File diff suppressed because it is too large Load Diff