Templates for pressure transmitter and sets level/volume to only send every 5 min

This commit is contained in:
Patrick McDonagh
2018-04-30 14:07:22 -05:00
parent 50f64b41c2
commit 115f5ed9f0
5 changed files with 161 additions and 10 deletions

View File

@@ -65,6 +65,41 @@
</div>
</div>
<% } %>
<% if (channels["pondlevel.pressure_psi"].value > 0.0){ %>
<div class="row row-flex box-me">
<div class='col-xs-4 text-center'>
<h2>Pressure</h2>
<div class="gauge-box">
<div data-labelheight="10"
style="height: 170px; background: transparent; margin: 0 auto;"
id="gauge-pressure_psi"
data-chart="solidgauge"
data-nodename="pondlevel.pressure_psi"
data-units="PSI"
data-min="0"
data-max="600"
data-decimalplaces="1"
data-colors="0.1:#DF5353,0.5:#DDDF0D,0.9:#55BF3B"
data-valuefontsize="18px">
</div>
<div class- "timestamp-box">
<a href="#" data-channelId="<%= channels['pondlevel.pressure_psi'].channelId %>" class="data-table" title="Download Channel History">
<i class="fa fa-download"></i>
</a>
</div>
<span data-timeupdate="pond_level">
<%= channels["pondlevel.pressure_psi"].timestamp %>
</span>
</div>
</div>
<div class='col-xs-8'>
<div style="height:300px" id="chart-pressure_psi" data-chart="chart" data-nodename1="pondlevel.pressure_psi" data-datalabel1="Pressure" data-daysofhistory="2" data-chartlabel="Pond Volume" data-ylabel="" data-xlabel="Date" data-units=" PSI"></div>
</div>
</div>
<% } %>
<h1 class="pad15">Configuration</h1>
<div class="row row-flex">
<div class="col-md-6 box-me entry-top-level" id="low_level_limit">

View File

@@ -1,7 +1,10 @@
<div class="row row-flex">
<div class="col-xs-12">
<h1>Level</h1>
</div>
<div class="col-md-6 box-me entry-top-level" id="setrawmax">
<div class="pad15">
<h2>Raw Max (mA)</h2>
@@ -104,6 +107,114 @@
</div>
<div class="row row-flex">
<div class="col-xs-12">
<h1>Pressure</h1>
</div>
<div class="col-md-6 box-me entry-top-level" id="setpsirawmax">
<div class="pad15">
<h2>Raw Max (V)</h2>
<form class="form-inline">
<div class="form-group">
<input class="form-control val_box"
type="number"
step="any"
value="<%=channels['pondlevel.setpsirawmax'].value %>">
</div>
<a href="#"
data-confirm-message="Are you sure you want to do this?"
data-refreshpause="1"
data-command=""
data-staticsend=25.0
data-channelId="<%= channels["pondlevel.setpsirawmax"].channelId %>"
data-techname="<%=channels["pondlevel.setpsirawmax"].techName %>"
data-name="<%= channels["pondlevel.setpsirawmax"].name%>"
data-nodechannelcurrentId="<%= channels["pondlevel.setpsirawmax"].nodechannelcurrentId %>"
id="<%= channels["pondlevel.setpsirawmax"].channelId %>"
class="btn btn-large btn-theme animated setstatic material-icons">send</a>
</form>
</div>
</div>
<div class="col-md-6 box-me entry-top-level" id="setpsirawmin">
<div class="pad15">
<h2>Raw Min (V)</h2>
<form class="form-inline">
<div class="form-group">
<input class="form-control val_box"
type="number"
step="any"
value="<%=channels['pondlevel.setpsirawmin'].value %>">
</div>
<a href="#"
data-confirm-message="Are you sure you want to do this?"
data-refreshpause="1"
data-command=""
data-staticsend=25.0
data-channelId="<%= channels["pondlevel.setpsirawmin"].channelId %>"
data-techname="<%=channels["pondlevel.setpsirawmin"].techName %>"
data-name="<%= channels["pondlevel.setpsirawmin"].name%>"
data-nodechannelcurrentId="<%= channels["pondlevel.setpsirawmin"].nodechannelcurrentId %>"
id="<%= channels["pondlevel.setpsirawmin"].channelId %>"
class="btn btn-large btn-theme animated setstatic material-icons">send</a>
</form>
</div>
</div>
<div class="col-md-6 box-me entry-top-level" id="setpsieumax">
<div class="pad15">
<h2>EU Max (PSI)</h2>
<form class="form-inline">
<div class="form-group">
<input class="form-control val_box"
type="number"
step="any"
value="<%=channels['pondlevel.setpsieumax'].value %>">
</div>
<a href="#"
data-confirm-message="Are you sure you want to do this?"
data-refreshpause="1"
data-command=""
data-staticsend=25.0
data-channelId="<%= channels["pondlevel.setpsieumax"].channelId %>"
data-techname="<%=channels["pondlevel.setpsieumax"].techName %>"
data-name="<%= channels["pondlevel.setpsieumax"].name%>"
data-nodechannelcurrentId="<%= channels["pondlevel.setpsieumax"].nodechannelcurrentId %>"
id="<%= channels["pondlevel.setpsieumax"].channelId %>"
class="btn btn-large btn-theme animated setstatic material-icons">send</a>
</form>
</div>
</div>
<div class="col-md-6 box-me entry-top-level" id="seteumin">
<div class="pad15">
<h2>EU Min (PSI)</h2>
<form class="form-inline">
<div class="form-group">
<input class="form-control val_box"
type="number"
step="any"
value="<%=channels['pondlevel.setpsieumin'].value %>">
</div>
<a href="#"
data-confirm-message="Are you sure you want to do this?"
data-refreshpause="1"
data-command=""
data-staticsend=25.0
data-channelId="<%= channels["pondlevel.setpsieumin"].channelId %>"
data-techname="<%=channels["pondlevel.setpsieumin"].techName %>"
data-name="<%= channels["pondlevel.setpsieumin"].name%>"
data-nodechannelcurrentId="<%= channels["pondlevel.setpsieumin"].nodechannelcurrentId %>"
id="<%= channels["pondlevel.setpsieumin"].channelId %>"
class="btn btn-large btn-theme animated setstatic material-icons">send</a>
</form>
</div>
</div>
</div>
<style>
.box-me {

View File

@@ -9,7 +9,7 @@
</div>
</div>
<hr>
<div class='clearfix col-xs-12' style='height: 450px' id="dynamicChart" data-chart="dynamicchart" data-daysofhistory="7" data-chartlabel="Data" data-ylabel="" data-xlabel="Date" data-units="" data-channelnames="pondlevel.pond_level,pondlevel.pond_volume"></div>
<div class='clearfix col-xs-12' style='height: 450px' id="dynamicChart" data-chart="dynamicchart" data-daysofhistory="7" data-chartlabel="Data" data-ylabel="" data-xlabel="Date" data-units="" data-channelnames="pondlevel.pond_level,pondlevel.pond_volume,pondlevel.pressure_psi"></div>
<style>
.dynamic-chart-form {
background-color: whiteSmoke;

View File

@@ -5,6 +5,6 @@
},
"deviceName": "pondlevel",
"driverId": "0130",
"releaseVersion": "1",
"releaseVersion": "3",
"driverFileName": "pondlevel.py"
}

View File

@@ -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