Templates for pressure transmitter and sets level/volume to only send every 5 min
This commit is contained in:
@@ -5,6 +5,6 @@
|
||||
},
|
||||
"deviceName": "pondlevel",
|
||||
"driverId": "0130",
|
||||
"releaseVersion": "1",
|
||||
"releaseVersion": "3",
|
||||
"driverFileName": "pondlevel.py"
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ psi_reading = {
|
||||
'timestamp': 0
|
||||
}
|
||||
|
||||
send_delta = 0.5
|
||||
send_delta = 2.0
|
||||
send_time = 300
|
||||
|
||||
temp_pl = pond_level['value']
|
||||
@@ -45,7 +45,7 @@ class start(threading.Thread, deviceBase):
|
||||
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 = "2"
|
||||
self.version = "3"
|
||||
self.finished = threading.Event()
|
||||
self.forceSend = False
|
||||
threading.Thread.start(self)
|
||||
@@ -144,10 +144,15 @@ class start(threading.Thread, deviceBase):
|
||||
temp_psi = scale_to_eu(analog1_val, self.PSI_RAWMAX, self.PSI_RAWMIN, self.PSI_EUMAX, self.PSI_EUMIN)
|
||||
|
||||
# Check if pond level needs to be sent
|
||||
if abs(temp_pl - pond_level['value']) > send_delta:
|
||||
print("Sending pond level {} due to value change".format(temp_pl))
|
||||
pl_send_now = True
|
||||
elif (time.time() - pond_level['timestamp']) > send_time:
|
||||
# 4/30/2018 -- COMMENTING OUT
|
||||
# Pond level was sending irregular data
|
||||
# -- Patrick McDonagh
|
||||
# if abs(temp_pl - pond_level['value']) > send_delta:
|
||||
# print("Sending pond level {} due to value change".format(temp_pl))
|
||||
# pl_send_now = True
|
||||
# 4/30/2018 -- END COMMENTING OUT
|
||||
|
||||
if (time.time() - pond_level['timestamp']) > send_time:
|
||||
print("Sending pond level {} due to time limit".format(temp_pl))
|
||||
pl_send_now = True
|
||||
|
||||
@@ -155,7 +160,7 @@ class start(threading.Thread, deviceBase):
|
||||
if abs(temp_psi - psi_reading['value']) > send_delta:
|
||||
print("Sending pressure psi {} due to value change".format(temp_psi))
|
||||
psi_send_now = True
|
||||
elif (time.time() - psi_reading['timestamp']) > send_time:
|
||||
if (time.time() - psi_reading['timestamp']) > send_time:
|
||||
print("Sending pressure psi {} due to time limit".format(temp_psi))
|
||||
psi_send_now = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user