V2 of driver with sleep function and larger deltas for data collection
Trying to use less energy
This commit is contained in:
18
abbflow.py
18
abbflow.py
@@ -2,23 +2,31 @@
|
|||||||
import threading
|
import threading
|
||||||
import time
|
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):
|
||||||
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)
|
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.daemon = True
|
||||||
self.version = "1"
|
self.version = "1"
|
||||||
self.finished = threading.Event()
|
self.finished = threading.Event()
|
||||||
threading.Thread.start(self)
|
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
|
# about your device so it can be seen on the web
|
||||||
def register(self):
|
def register(self):
|
||||||
self.channels["status"]["last_value"] = ""
|
self.channels["status"]["last_value"] = ""
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pass
|
while (true):
|
||||||
|
t = datetime.now()
|
||||||
|
if (t.minute == 5 or t.minute == 35):
|
||||||
|
self.mcu.sleep(self.sleep_minutes * 60)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"driverFileName":"abbflow.py",
|
"driverFileName":"abbflow.py",
|
||||||
"deviceName":"abbflow",
|
"deviceName":"abbflow",
|
||||||
"driverId":"0110",
|
"driverId":"0110",
|
||||||
"releaseVersion":"1",
|
"releaseVersion":"2",
|
||||||
"files": {
|
"files": {
|
||||||
"file1":"abbflow.py",
|
"file1":"abbflow.py",
|
||||||
"file2":"modbusMap.p" }
|
"file2":"modbusMap.p" }
|
||||||
|
|||||||
846
modbusMap.p
846
modbusMap.p
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user