V2 of driver with sleep function and larger deltas for data collection

Trying to use less energy
This commit is contained in:
Patrick McDonagh
2017-02-09 18:32:43 -06:00
parent 55f0b3e726
commit 80ba59cdb2
3 changed files with 430 additions and 436 deletions

View File

@@ -2,23 +2,31 @@
import threading
import time
from device_base import deviceBase
from datetime import datetime
class start(threading.Thread, deviceBase):
def __init__(self, name=None, number=None, mac=None, Q=None, mcu=None, companyId=None, offset=None, mqtt=None, Nodes=None):
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)
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()
threading.Thread.start(self)
self.sleep_minutes = 25
# this is a required function for all drivers, its goal is to upload some piece of data
# 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):
self.channels["status"]["last_value"] = ""
def run(self):
pass
while (true):
t = datetime.now()
if (t.minute == 5 or t.minute == 35):
self.mcu.sleep(self.sleep_minutes * 60)

View File

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

File diff suppressed because it is too large Load Diff