Fix to get real data working with Micro850

Micro800s do not treat instructions as controller scope tags even though they show up in the controller tag list
This commit is contained in:
Patrick McDonagh
2018-08-13 17:42:54 -05:00
parent 7f352e6aec
commit c7f8d30446
69 changed files with 4016 additions and 2857 deletions

View File

@@ -40,4 +40,37 @@ id,name,deviceTypeId,fromMe,io,subTitle,helpExplanation,channelType,dataType,def
,an5ispond,465,FALSE,readonly,Analog 5 Is Pond Level,Use the input for pond level monitoring,device,boolean,FALSE,,,,,,,,
,an6ispond,465,FALSE,readonly,Analog 6 Is Pond Level,Use the input for pond level monitoring,device,boolean,FALSE,,,,,,,,
,an7ispond,465,FALSE,readonly,Analog 7 Is Pond Level,Use the input for pond level monitoring,device,boolean,FALSE,,,,,,,,
,public_ip_address,465,FALSE,readonly,Public IP Address,Network Address,device,string,,,,,,,,,
,public_ip_address,465,FALSE,readonly,Public IP Address,Network Address,device,string,,,,,,,,,
,an0name,465,FALSE,readwrite,Analog 0 Name,Name of Analog 0,user input,string,Analog 0,,,,,,,,
,an1name,465,FALSE,readwrite,Analog 1 Name,Name of Analog 1,user input,string,Analog 1,,,,,,,,
,an2name,465,FALSE,readwrite,Analog 2 Name,Name of Analog 2,user input,string,Analog 2,,,,,,,,
,an3name,465,FALSE,readwrite,Analog 3 Name,Name of Analog 3,user input,string,Analog 3,,,,,,,,
,an4name,465,FALSE,readwrite,Analog 4 Name,Name of Analog 4,user input,string,Analog 4,,,,,,,,
,an5name,465,FALSE,readwrite,Analog 5 Name,Name of Analog 5,user input,string,Analog 5,,,,,,,,
,an6name,465,FALSE,readwrite,Analog 6 Name,Name of Analog 6,user input,string,Analog 6,,,,,,,,
,an7name,465,FALSE,readwrite,Analog 7 Name,Name of Analog 7,user input,string,Analog 7,,,,,,,,
,an0min,465,FALSE,readonly,Analog 0 Min Value,Min Value of Analog 0,device,float,0,,,,,,,,
,an1min,465,FALSE,readonly,Analog 1 Min Value,Min Value of Analog 1,device,float,0,,,,,,,,
,an2min,465,FALSE,readonly,Analog 2 Min Value,Min Value of Analog 2,device,float,0,,,,,,,,
,an3min,465,FALSE,readonly,Analog 3 Min Value,Min Value of Analog 3,device,float,0,,,,,,,,
,an4min,465,FALSE,readonly,Analog 4 Min Value,Min Value of Analog 4,device,float,0,,,,,,,,
,an5min,465,FALSE,readonly,Analog 5 Min Value,Min Value of Analog 5,device,float,0,,,,,,,,
,an6min,465,FALSE,readonly,Analog 6 Min Value,Min Value of Analog 6,device,float,0,,,,,,,,
,an7min,465,FALSE,readonly,Analog 7 Min Value,Min Value of Analog 7,device,float,0,,,,,,,,
,an0max,465,FALSE,readonly,Analog 0 Max Value,Max Value of Analog 0,device,float,100,,,,,,,,
,an1max,465,FALSE,readonly,Analog 1 Max Value,Max Value of analog 1,device,float,100,,,,,,,,
,an2max,465,FALSE,readonly,Analog 2 Max Value,Max Value of Analog 2,device,float,100,,,,,,,,
,an3max,465,FALSE,readonly,Analog 3 Max Valu,Max Value of Analog 3,device,float,100,,,,,,,,
,an4max,465,FALSE,readonly,Analog 4 Max Value,Max Value of Analog 4,device,float,100,,,,,,,,
,an5max,465,FALSE,readonly,Analog 5 Max Value,Max Value of Analog 5,device,float,100,,,,,,,,
,an6max,465,FALSE,readonly,Analog 6 Max Value,Max Value of Analog 6,device,float,100,,,,,,,,
,an7max,465,FALSE,readonly,Analog 7 Max Value,Max Value of Analog 7,device,float,100,,,,,,,,
,an0decimals,465,FALSE,readwrite,Analog 0 Decimal Places,Decimal places to show for analog 0,user input,integer,2,,,,,,,,
,an1decimals,465,FALSE,readwrite,Analog 1 Decimal Places,Decimal places to show for analog 1,user input,integer,2,,,,,,,,
,an2decimals,465,FALSE,readwrite,Analog 2 Decimal Places,Decimal places to show for analog 2,user input,integer,2,,,,,,,,
,an3decimals,465,FALSE,readwrite,Analog 3 Decimal Places,Decimal places to show for analog 3,user input,integer,2,,,,,,,,
,an4decimals,465,FALSE,readwrite,Analog 4 Decimal Places,Decimal places to show for analog 4,user input,integer,2,,,,,,,,
,an5decimals,465,FALSE,readwrite,Analog 5 Decimal Places,Decimal places to show for analog 5,user input,integer,2,,,,,,,,
,an6decimals,465,FALSE,readwrite,Analog 6 Decimal Places,Decimal places to show for analog 6,user input,integer,2,,,,,,,,
,an7decimals,465,FALSE,readwrite,Analog 7 Decimal Places,Decimal places to show for analog 7,user input,integer,2,,,,,,,,
,sync,465,FALSE,readwrite,Sync,sync,device,string,,,,,,,,,
1 id name deviceTypeId fromMe io subTitle helpExplanation channelType dataType defaultValue regex regexErrMsg units min max change guaranteedReportPeriod minReportTime
40 an5ispond 465 FALSE readonly Analog 5 Is Pond Level Use the input for pond level monitoring device boolean FALSE
41 an6ispond 465 FALSE readonly Analog 6 Is Pond Level Use the input for pond level monitoring device boolean FALSE
42 an7ispond 465 FALSE readonly Analog 7 Is Pond Level Use the input for pond level monitoring device boolean FALSE
43 public_ip_address 465 FALSE readonly Public IP Address Network Address device string
44 an0name 465 FALSE readwrite Analog 0 Name Name of Analog 0 user input string Analog 0
45 an1name 465 FALSE readwrite Analog 1 Name Name of Analog 1 user input string Analog 1
46 an2name 465 FALSE readwrite Analog 2 Name Name of Analog 2 user input string Analog 2
47 an3name 465 FALSE readwrite Analog 3 Name Name of Analog 3 user input string Analog 3
48 an4name 465 FALSE readwrite Analog 4 Name Name of Analog 4 user input string Analog 4
49 an5name 465 FALSE readwrite Analog 5 Name Name of Analog 5 user input string Analog 5
50 an6name 465 FALSE readwrite Analog 6 Name Name of Analog 6 user input string Analog 6
51 an7name 465 FALSE readwrite Analog 7 Name Name of Analog 7 user input string Analog 7
52 an0min 465 FALSE readonly Analog 0 Min Value Min Value of Analog 0 device float 0
53 an1min 465 FALSE readonly Analog 1 Min Value Min Value of Analog 1 device float 0
54 an2min 465 FALSE readonly Analog 2 Min Value Min Value of Analog 2 device float 0
55 an3min 465 FALSE readonly Analog 3 Min Value Min Value of Analog 3 device float 0
56 an4min 465 FALSE readonly Analog 4 Min Value Min Value of Analog 4 device float 0
57 an5min 465 FALSE readonly Analog 5 Min Value Min Value of Analog 5 device float 0
58 an6min 465 FALSE readonly Analog 6 Min Value Min Value of Analog 6 device float 0
59 an7min 465 FALSE readonly Analog 7 Min Value Min Value of Analog 7 device float 0
60 an0max 465 FALSE readonly Analog 0 Max Value Max Value of Analog 0 device float 100
61 an1max 465 FALSE readonly Analog 1 Max Value Max Value of analog 1 device float 100
62 an2max 465 FALSE readonly Analog 2 Max Value Max Value of Analog 2 device float 100
63 an3max 465 FALSE readonly Analog 3 Max Valu Max Value of Analog 3 device float 100
64 an4max 465 FALSE readonly Analog 4 Max Value Max Value of Analog 4 device float 100
65 an5max 465 FALSE readonly Analog 5 Max Value Max Value of Analog 5 device float 100
66 an6max 465 FALSE readonly Analog 6 Max Value Max Value of Analog 6 device float 100
67 an7max 465 FALSE readonly Analog 7 Max Value Max Value of Analog 7 device float 100
68 an0decimals 465 FALSE readwrite Analog 0 Decimal Places Decimal places to show for analog 0 user input integer 2
69 an1decimals 465 FALSE readwrite Analog 1 Decimal Places Decimal places to show for analog 1 user input integer 2
70 an2decimals 465 FALSE readwrite Analog 2 Decimal Places Decimal places to show for analog 2 user input integer 2
71 an3decimals 465 FALSE readwrite Analog 3 Decimal Places Decimal places to show for analog 3 user input integer 2
72 an4decimals 465 FALSE readwrite Analog 4 Decimal Places Decimal places to show for analog 4 user input integer 2
73 an5decimals 465 FALSE readwrite Analog 5 Decimal Places Decimal places to show for analog 5 user input integer 2
74 an6decimals 465 FALSE readwrite Analog 6 Decimal Places Decimal places to show for analog 6 user input integer 2
75 an7decimals 465 FALSE readwrite Analog 7 Decimal Places Decimal places to show for analog 7 user input integer 2
76 sync 465 FALSE readwrite Sync sync device string

View File

@@ -28,9 +28,4 @@
<div class="col-xs-4">
<h4><%= node.vanityname %></h4>
</div>
<div class='col-xs-3'>
<h2>Total Volume</h2>
<p><%= Math.round(channels['plcpond.pondvolumetotal'].value) %> BBL</p>
</div>
</div>

View File

@@ -28,9 +28,4 @@
<div class="col-xs-4">
<h4><%= node.vanityname %></h4>
</div>
<div class='col-xs-3'>
<h2>Total Volume</h2>
<p><%= Math.round(channels['plcpond.pondvolumetotal'].value) %> BBL</p>
</div>
</div>

View File

@@ -1,143 +1,137 @@
<div class="box-me">
<div class="row">
<div class="col-xs-12 text-center">
<h1>Level</h1>
</div>
</div>
<div class="row">
<div class="make-gauge col-xs-4"
data-deviceName="plcpond"
data-channelName="pond1height"
data-displayName="Pond 1 Height"
data-units="Ft"
data-min="0"
data-max="50"
data-decimalPlaces="2"
data-channelId="<%= channels['plcpond.pond1height'].channelId %>"
data-timestamp="<%= channels['plcpond.pond1height'].timestamp %>"
></div>
<% if (parseInt(channels['plcpond.cfgnumberofponds'].value) >= 2) { %>
<div class="row row-flex">
<% if (channels['multisensor.an0active'].value == "true"){ %>
<div class="make-gauge col-xs-4"
data-deviceName="plcpond"
data-channelName="pond2height"
data-displayName="Pond 2 Height"
data-units="Ft"
data-min="0"
data-max="50"
data-decimalPlaces="2"
data-channelId="<%= channels['plcpond.pond2height'].channelId %>"
data-timestamp="<%= channels['plcpond.pond2height'].timestamp %>"
data-deviceName="multisensor"
data-channelName="an0val"
data-displayName="<%= channels['multisensor.an0name'].value %>"
data-units="<%= channels['multisensor.an0units'].value %>"
data-min="<%= channels['multisensor.an0min'].value %>"
data-max="<%= channels['multisensor.an0max'].value %>"
data-decimalPlaces="<%= Math.round(channels['multisensor.an0decimals'].value) %>"
data-channelId="<%= channels['multisensor.an0val'].channelId %>"
data-timestamp="<%= channels['multisensor.an0val'].timestamp %>"
data-ispond="<%= channels['multisensor.an0ispond'].value %>"
data-pondvolume="<%= channels['multisensor.pond0volume'].value %>"
></div>
<% }%>
<% } %>
<% if (parseInt(channels['plcpond.cfgnumberofponds'].value) >= 3) { %>
<% if (channels['multisensor.an1active'].value == "true"){ %>
<div class="make-gauge col-xs-4"
data-deviceName="plcpond"
data-channelName="pond3height"
data-displayName="Pond 3 Height"
data-units="Ft"
data-min="0"
data-max="50"
data-decimalPlaces="2"
data-channelId="<%= channels['plcpond.pond3height'].channelId %>"
data-timestamp="<%= channels['plcpond.pond3height'].timestamp %>"
data-deviceName="multisensor"
data-channelName="an1val"
data-displayName="<%= channels['multisensor.an1name'].value %>"
data-units="<%= channels['multisensor.an1units'].value %>"
data-min="<%= channels['multisensor.an1min'].value %>"
data-max="<%= channels['multisensor.an1max'].value %>"
data-decimalPlaces="<%= Math.round(channels['multisensor.an1decimals'].value) %>"
data-channelId="<%= channels['multisensor.an1val'].channelId %>"
data-timestamp="<%= channels['multisensor.an1val'].timestamp %>"
data-ispond="<%= channels['multisensor.an1ispond'].value %>"
data-pondvolume="<%= channels['multisensor.pond1volume'].value %>"
></div>
<% }%>
<% } %>
<% if (parseInt(channels['plcpond.cfgnumberofponds'].value) >= 4) { %>
<% if (channels['multisensor.an2active'].value == "true"){ %>
<div class="make-gauge col-xs-4"
data-deviceName="plcpond"
data-channelName="pond4height"
data-displayName="Pond 4 Height"
data-units="Ft"
data-min="0"
data-max="50"
data-decimalPlaces="2"
data-channelId="<%= channels['plcpond.pond4height'].channelId %>"
data-timestamp="<%= channels['plcpond.pond4height'].timestamp %>"
data-deviceName="multisensor"
data-channelName="an2val"
data-displayName="<%= channels['multisensor.an2name'].value %>"
data-units="<%= channels['multisensor.an2units'].value %>"
data-min="<%= channels['multisensor.an2min'].value %>"
data-max="<%= channels['multisensor.an2max'].value %>"
data-decimalPlaces="<%= Math.round(channels['multisensor.an2decimals'].value) %>"
data-channelId="<%= channels['multisensor.an2val'].channelId %>"
data-timestamp="<%= channels['multisensor.an2val'].timestamp %>"
data-ispond="<%= channels['multisensor.an2ispond'].value %>"
data-pondvolume="<%= channels['multisensor.pond2volume'].value %>"
></div>
<% }%>
<% } %>
<% if (channels['multisensor.an3active'].value == "true"){ %>
<div class="make-gauge col-xs-4"
data-deviceName="multisensor"
data-channelName="an3val"
data-displayName="<%= channels['multisensor.an3name'].value %>"
data-units="<%= channels['multisensor.an3units'].value %>"
data-min="<%= channels['multisensor.an3min'].value %>"
data-max="<%= channels['multisensor.an3max'].value %>"
data-decimalPlaces="<%= Math.round(channels['multisensor.an3decimals'].value) %>"
data-channelId="<%= channels['multisensor.an3val'].channelId %>"
data-timestamp="<%= channels['multisensor.an3val'].timestamp %>"
data-ispond="<%= channels['multisensor.an3ispond'].value %>"
data-pondvolume="<%= channels['multisensor.pond3volume'].value %>"
></div>
<% } %>
<% if (channels['multisensor.an4active'].value == "true"){ %>
<div class="make-gauge col-xs-4"
data-deviceName="multisensor"
data-channelName="an4val"
data-displayName="<%= channels['multisensor.an4name'].value %>"
data-units="<%= channels['multisensor.an4units'].value %>"
data-min="<%= channels['multisensor.an4min'].value %>"
data-max="<%= channels['multisensor.an4max'].value %>"
data-decimalPlaces="<%= Math.round(channels['multisensor.an4decimals'].value) %>"
data-channelId="<%= channels['multisensor.an4val'].channelId %>"
data-timestamp="<%= channels['multisensor.an4val'].timestamp %>"
data-ispond="<%= channels['multisensor.an4ispond'].value %>"
data-pondvolume="<%= channels['multisensor.pond4volume'].value %>"
></div>
<% } %>
<% if (channels['multisensor.an5active'].value == "true"){ %>
<div class="make-gauge col-xs-4"
data-deviceName="multisensor"
data-channelName="an5val"
data-displayName="<%= channels['multisensor.an5name'].value %>"
data-units="<%= channels['multisensor.an5units'].value %>"
data-min="<%= channels['multisensor.an5min'].value %>"
data-max="<%= channels['multisensor.an5max'].value %>"
data-decimalPlaces="<%= Math.round(channels['multisensor.an5decimals'].value) %>"
data-channelId="<%= channels['multisensor.an5val'].channelId %>"
data-timestamp="<%= channels['multisensor.an5val'].timestamp %>"
data-ispond="<%= channels['multisensor.an5ispond'].value %>"
data-pondvolume="<%= channels['multisensor.pond5volume'].value %>"
></div>
<% } %>
<% if (channels['multisensor.an6active'].value == "true"){ %>
<div class="make-gauge col-xs-4"
data-deviceName="multisensor"
data-channelName="an6val"
data-displayName="<%= channels['multisensor.an6name'].value %>"
data-units="<%= channels['multisensor.an6units'].value %>"
data-min="<%= channels['multisensor.an6min'].value %>"
data-max="<%= channels['multisensor.an6max'].value %>"
data-decimalPlaces="<%= Math.round(channels['multisensor.an6decimals'].value) %>"
data-channelId="<%= channels['multisensor.an6val'].channelId %>"
data-timestamp="<%= channels['multisensor.an6val'].timestamp %>"
data-ispond="<%= channels['multisensor.an6ispond'].value %>"
data-pondvolume="<%= channels['multisensor.pond6volume'].value %>"
></div>
<% } %>
<% if (channels['multisensor.an7active'].value == "true"){ %>
<div class="make-gauge col-xs-4"
data-deviceName="multisensor"
data-channelName="an7val"
data-displayName="<%= channels['multisensor.an7name'].value %>"
data-units="<%= channels['multisensor.an7units'].value %>"
data-min="<%= channels['multisensor.an7min'].value %>"
data-max="<%= channels['multisensor.an7max'].value %>"
data-decimalPlaces="<%= Math.round(channels['multisensor.an7decimals'].value) %>"
data-channelId="<%= channels['multisensor.an7val'].channelId %>"
data-timestamp="<%= channels['multisensor.an7val'].timestamp %>"
data-ispond="<%= channels['multisensor.an7ispond'].value %>"
data-pondvolume="<%= channels['multisensor.pond7volume'].value %>"
></div>
<% } %>
</div>
</div>
<div class="box-me">
<div class="row">
<div class="col-xs-12 text-center">
<h1>Volume</h1>
</div>
</div>
<div class="row">
<div class="make-gauge col-xs-4"
data-deviceName="plcpond"
data-channelName="pond1volume"
data-displayName="Pond 1 Volume"
data-units="BBL"
data-min="0"
data-max="1000000"
data-decimalPlaces="0"
data-channelId="<%= channels['plcpond.pond1volume'].channelId %>"
data-timestamp="<%= channels['plcpond.pond1volume'].timestamp %>"
></div>
<% if (parseInt(channels['plcpond.cfgnumberofponds'].value) >= 2) { %>
<div class="make-gauge col-xs-4"
data-deviceName="plcpond"
data-channelName="pond2volume"
data-displayName="Pond 2 Volume"
data-units="BBL"
data-min="0"
data-max="1000000"
data-decimalPlaces="0"
data-channelId="<%= channels['plcpond.pond2volume'].channelId %>"
data-timestamp="<%= channels['plcpond.pond2volume'].timestamp %>"
></div>
<% }%>
<% if (parseInt(channels['plcpond.cfgnumberofponds'].value) >= 3) { %>
<div class="make-gauge col-xs-4"
data-deviceName="plcpond"
data-channelName="pond3volume"
data-displayName="Pond 3 Volume"
data-units="BBL"
data-min="0"
data-max="1000000"
data-decimalPlaces="0"
data-channelId="<%= channels['plcpond.pond3volume'].channelId %>"
data-timestamp="<%= channels['plcpond.pond3volume'].timestamp %>"
></div>
<% }%>
<% if (parseInt(channels['plcpond.cfgnumberofponds'].value) >= 4) { %>
<div class="make-gauge col-xs-4"
data-deviceName="plcpond"
data-channelName="pond4volume"
data-displayName="Pond 4 Volume"
data-units="BBL"
data-min="0"
data-max="1000000"
data-decimalPlaces="0"
data-channelId="<%= channels['plcpond.pond4volume'].channelId %>"
data-timestamp="<%= channels['plcpond.pond4volume'].timestamp %>"
></div>
<% }%>
<% if (parseInt(channels['plcpond.cfgnumberofponds'].value) >= 2) { %>
<div class="make-gauge col-xs-4"
data-deviceName="plcpond"
data-channelName="pondvolumetotal"
data-displayName="Pond Volume Total"
data-units="BBL"
data-min="0"
data-max="1000000"
data-decimalPlaces="0"
data-channelId="<%= channels['plcpond.pondvolumetotal'].channelId %>"
data-timestamp="<%= channels['plcpond.pondvolumetotal'].timestamp %>"
></div>
<% }%>
</div>
</div>
<style>
.box-me {
@@ -228,12 +222,44 @@ $('.make-gauge').each(function(gaugeDiv) {
const decimalPlaces = $(this).attr("data-decimalPlaces");
const channelId = $(this).attr("data-channelId");
const timestamp = $(this).attr("data-timestamp");
const gaugeHTML = makeGauge(deviceName, channelName, displayName, units, min, max, decimalPlaces, channelId, timestamp);
const isPond = $(this).attr("data-ispond");
const pondVolume = $(this).attr("data-pondvolume");
const gaugeHTML = makeGauge(deviceName, channelName, displayName, units, min, max, decimalPlaces, channelId, timestamp, isPond, pondVolume);
$(this).html(gaugeHTML);
});
function makeGauge(deviceName, channelName, displayName, units, min, max, decimalPlaces, channelId, timestamp) {
function makeGauge(deviceName, channelName, displayName, units, min, max, decimalPlaces, channelId, timestamp, isPond, pondVolume) {
if (isPond === "true"){
return (
'<div class="text-center"> \
<h2>' + displayName + '</h2> \
<div class="gauge-box"> \
<div data-labelheight="10" \
style="height: 170px; background: transparent; margin: 0 auto;" \
id="gauge-' + channelName + '" \
data-chart="solidgauge" \
data-nodename="' + deviceName + '.' + channelName + '" \
data-units="'+ units + '" \
data-min="' + min + '" \
data-max="' + max + '" \
data-decimalplaces="' + decimalPlaces + '" \
data-colors="0.1:#DF5353,0.5:#DDDF0D,0.9:#55BF3B" \
data-valuefontsize="18px"> \
</div> \
<div class- "timestamp-box"> \
<a href="#" data-channelId="' + channelId + '" class="data-table" title="Download Channel History"> \
<i class="fa fa-download"></i> \
</a> \
</div> \
<span data-timeupdate="' + channelName + '">'+ timestamp + '</span> \
<hr /> \
<h3>Pond Volume</h3>\
<h4>' + pondVolume + ' BBL</h4>\
</div> \
</div>'
);
}
return (
'<div class="text-center"> \

View File

@@ -1,15 +1,15 @@
<a href="#"
data-channelId="<%= channels["plcpond.log"].channelId %>"
data-channelId="<%= channels["multisensor.log"].channelId %>"
class="data-table btn-block btn btn-theme animated"
title="Device Log"><i style='margin-left: 0.5em; cursor: pointer' class="fa fa-th-list icon-theme"></i> Device Log</a>
<a href="#"
data-refreshpause="1"
data-staticsend="1"
data-channelId="<%= channels["plcpond.sync"].channelId %>"
data-techname="<%=channels["plcpond.sync"].techName %>"
data-name="<%= channels["plcpond.sync"].name%>"
data-nodechannelcurrentId="<%= channels["plcpond.sync"].nodechannelcurrentId %>"
id="<%= channels["plcpond.sync"].channelId %>"
data-channelId="<%= channels["multisensor.sync"].channelId %>"
data-techname="<%=channels["multisensor.sync"].techName %>"
data-name="<%= channels["multisensor.sync"].name%>"
data-nodechannelcurrentId="<%= channels["multisensor.sync"].nodechannelcurrentId %>"
id="<%= channels["multisensor.sync"].channelId %>"
class="btn btn-large btn-block btn-theme animated setstatic mqtt">
<i class="icon-repeat icon-white mqtt" ></i>Sync All Data</a>

View File

@@ -29,6 +29,8 @@ def read_tag(addr, tag, plc_type="CLX"):
clx.close()
time.sleep(TAG_DATAERROR_SLEEPTIME)
log.error("Data Error during readTag({}, {}): {}".format(addr, tag, err))
else:
log.error("Error opening {}".format(addr))
except CommError:
# err = c.get_status()
clx.close()

View File

@@ -17,13 +17,18 @@ _ = None
log.info("multisensor startup")
# GLOBAL VARIABLES
WAIT_FOR_CONNECTION_SECONDS = 60
WAIT_FOR_CONNECTION_SECONDS = 10
WATCHDOG_ENABLE = True
WATCHDOG_SEND_PERIOD = 3600 # Seconds, the longest amount of time before sending the watchdog status
PLC_IP_ADDRESS = "192.168.1.12"
PLC_IP_ADDRESS = "10.20.4.18"
CALIBRATION_TABLES = [[] for x in xrange(8)]
TRUE_FALSE = {
0: "false",
1: "true"
}
CHANNELS = [
PLCChannel(PLC_IP_ADDRESS, 'an0val', 'input0.scaledValue', 'REAL', 1.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an1val', 'input1.scaledValue', 'REAL', 1.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
@@ -41,14 +46,30 @@ CHANNELS = [
PLCChannel(PLC_IP_ADDRESS, 'pond5volume', 'input5.pondVolume', 'REAL', 1000.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'pond6volume', 'input6.pondVolume', 'REAL', 1000.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'pond7volume', 'input7.pondVolume', 'REAL', 1000.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an0active', 'input0.active', 'BOOL', 1.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an1active', 'input1.active', 'BOOL', 1.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an2active', 'input2.active', 'BOOL', 1.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an3active', 'input3.active', 'BOOL', 1.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an4active', 'input4.active', 'BOOL', 1.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an5active', 'input5.active', 'BOOL', 1.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an6active', 'input6.active', 'BOOL', 1.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an7active', 'input7.active', 'BOOL', 1.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an0active', 'input0.active', 'BOOL', 1.0, 600, map_=TRUE_FALSE, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an1active', 'input1.active', 'BOOL', 1.0, 600, map_=TRUE_FALSE, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an2active', 'input2.active', 'BOOL', 1.0, 600, map_=TRUE_FALSE, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an3active', 'input3.active', 'BOOL', 1.0, 600, map_=TRUE_FALSE, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an4active', 'input4.active', 'BOOL', 1.0, 600, map_=TRUE_FALSE, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an5active', 'input5.active', 'BOOL', 1.0, 600, map_=TRUE_FALSE, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an6active', 'input6.active', 'BOOL', 1.0, 600, map_=TRUE_FALSE, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an7active', 'input7.active', 'BOOL', 1.0, 600, map_=TRUE_FALSE, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an0ispond', 'input0_cfg.isPondLevel', 'BOOL', 1.0, 600, map_=TRUE_FALSE, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an1ispond', 'input1_cfg.isPondLevel', 'BOOL', 1.0, 600, map_=TRUE_FALSE, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an2ispond', 'input2_cfg.isPondLevel', 'BOOL', 1.0, 600, map_=TRUE_FALSE, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an3ispond', 'input3_cfg.isPondLevel', 'BOOL', 1.0, 600, map_=TRUE_FALSE, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an4ispond', 'input4_cfg.isPondLevel', 'BOOL', 1.0, 600, map_=TRUE_FALSE, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an5ispond', 'input5_cfg.isPondLevel', 'BOOL', 1.0, 600, map_=TRUE_FALSE, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an6ispond', 'input6_cfg.isPondLevel', 'BOOL', 1.0, 600, map_=TRUE_FALSE, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'an7ispond', 'input7_cfg.isPondLevel', 'BOOL', 1.0, 600, map_=TRUE_FALSE, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'pond0volume', 'input0.pondVolume', 'REAL', 1000.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'pond1volume', 'input1.pondVolume', 'REAL', 1000.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'pond2volume', 'input2.pondVolume', 'REAL', 1000.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'pond3volume', 'input3.pondVolume', 'REAL', 1000.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'pond4volume', 'input4.pondVolume', 'REAL', 1000.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'pond5volume', 'input5.pondVolume', 'REAL', 1000.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'pond6volume', 'input6.pondVolume', 'REAL', 1000.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
PLCChannel(PLC_IP_ADDRESS, 'pond7volume', 'input7.pondVolume', 'REAL', 1000.0, 600, map_=False, write_enabled=False, plc_type="Micro800"),
]
@@ -106,6 +127,7 @@ class start(threading.Thread, deviceBase):
val = chan.read()
if chan.check(val, self.force_send):
self.sendtodbDev(1, chan.mesh_name, chan.value, 0, 'multisensor')
time.sleep(2)
# print("multisensor driver still alive...")
@@ -170,9 +192,9 @@ class start(threading.Thread, deviceBase):
def multisensor_watchdog(self):
"""Write a random integer to the PLC and then 1 seconds later check that it has been decremented by 1."""
randval = randint(0, 32767)
write_tag(str(PLC_IP_ADDRESS), 'watchdog_INT', randval)
write_tag(str(PLC_IP_ADDRESS), 'watchdog_INT', randval, plc_type="Micro800")
time.sleep(1)
watchdog_val = read_tag(str(PLC_IP_ADDRESS), 'watchdog_INT')
watchdog_val = read_tag(str(PLC_IP_ADDRESS), 'watchdog_INT', plc_type="Micro800")
try:
return (randval - 1) == watchdog_val[0]
except (KeyError, TypeError):