made mappings for channels reporting a number that needed to be mapped
This commit is contained in:
@@ -3,19 +3,19 @@ from dual_flowmeter import PLC_IP_ADDRESS
|
||||
|
||||
tags = [
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_1_daily_total","Pump_1_Daily_Flow_Rate_Total","REAL", 10, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_1_run_status","Pump_1_Run_Status","BOOL", 0, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_1_run_status","Pump_1_Run_Status","BOOL", 0, 3600, plc_type="Micro800", map_={0: "Off", 1: "On"}),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_1_flowrate","Pump_1_SCL_Flow_Meter","REAL", 250, 600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_1_yesterdays_total","Pump_1_Yesterdays_Total","REAL", 10, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_1_power","Pump_1_Power","BOOL", 0, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_1_power","Pump_1_Power","BOOL", 0, 3600, plc_type="Micro800", map_={0: "Off", 1: "On"}),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_1_prevmonth_total","Pump_1_PrevMonth_Total","REAL", 10, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_1_month_total","Pump_1_Current_Month_Total","REAL", 10, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_1_lifetime_total","Pump_1_Lifetime_Flow","REAL", 10, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_1_suction","Suction_PSI_TP1_Scaled","REAL", 10, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_2_daily_total","Pump_2_Daily_Flow_Rate_Total","REAL", 10, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_2_run_status","Pump_2_Run_Status","BOOL", 0, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_2_run_status","Pump_2_Run_Status","BOOL", 0, 3600, plc_type="Micro800", map_={0: "Off", 1: "On"}),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_2_flowrate","Pump_2_SCL_Flow_Meter","REAL", 250, 600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_2_yesterdays_total","Pump_2_Yesterdays_Total","REAL", 10, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_2_power","Pump_2_Power","BOOL", 0, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_2_power","Pump_2_Power","BOOL", 0, 3600, plc_type="Micro800", map_={0: "Off", 1: "On"}),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_2_prevmonth_total","Pump_2_PrevMonth_Total","REAL", 100, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_2_month_total","Pump_2_Current_Month_Total","REAL", 50, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "pump_2_lifetime_total","Pump_2_Lifetime_Flow","REAL", 10, 3600, plc_type="Micro800"),
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"file4": "Tags.py"
|
||||
},
|
||||
"deviceName": "dual_flowmeter",
|
||||
"releaseVersion": "4",
|
||||
"releaseVersion": "5",
|
||||
"driverFileName": "dual_flowmeter.py",
|
||||
"driverId": "0100"
|
||||
}
|
||||
@@ -18,7 +18,7 @@ _ = None
|
||||
log.info("dual_flowmeter startup")
|
||||
|
||||
# GLOBAL VARIABLES
|
||||
WAIT_FOR_CONNECTION_SECONDS = 60
|
||||
WAIT_FOR_CONNECTION_SECONDS = 20
|
||||
IP_CHECK_PERIOD = 60
|
||||
WATCHDOG_ENABLE = False
|
||||
WATCHDOG_CHECK_PERIOD = 60
|
||||
@@ -42,7 +42,7 @@ class start(threading.Thread, deviceBase):
|
||||
mqtt=mqtt, Nodes=Nodes)
|
||||
|
||||
self.daemon = True
|
||||
self.version = "4"
|
||||
self.version = "5"
|
||||
self.finished = threading.Event()
|
||||
self.force_send = False
|
||||
self.public_ip_address = ""
|
||||
|
||||
@@ -3,9 +3,9 @@ from dualactuator import PLC_IP_ADDRESS
|
||||
|
||||
tags = [
|
||||
PLCChannel(PLC_IP_ADDRESS, "open_cmd","Open_Cmd","BOOL", 1, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "v1_open_fbk","V1_Open_FBK","BOOL", 1, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "v1_open_fbk","V1_Open_FBK","BOOL", 1, 3600, plc_type="Micro800", map_={0: "Closed", 1: "Open"}),
|
||||
PLCChannel(PLC_IP_ADDRESS, "v1_closed_fbk","V1_Closed_FBK","BOOL", 1, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "v2_open_fbk","V2_Open_FBK","BOOL", 1, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "v2_open_fbk","V2_Open_FBK","BOOL", 1, 3600, plc_type="Micro800", map_={0: "Closed", 1: "Open"}),
|
||||
PLCChannel(PLC_IP_ADDRESS, "v2_closed_fbk","V2_Closed_FBK","BOOL", 1, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "sep_valve_cmd","sep_valve_cmd","BOOL", 1, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "v1_open_cmd","V1_Open_Cmd","BOOL", 1, 3600, plc_type="Micro800"),
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"file4": "Tags.py"
|
||||
},
|
||||
"deviceName": "dualactuator",
|
||||
"releaseVersion": "3",
|
||||
"releaseVersion": "4",
|
||||
"driverFileName": "dualactuator.py",
|
||||
"driverId": "0100"
|
||||
}
|
||||
@@ -40,7 +40,7 @@ class start(threading.Thread, deviceBase):
|
||||
mqtt=mqtt, Nodes=Nodes)
|
||||
|
||||
self.daemon = True
|
||||
self.version = "3"
|
||||
self.version = "4"
|
||||
self.finished = threading.Event()
|
||||
self.force_send = False
|
||||
self.public_ip_address = ""
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
},
|
||||
"deviceName": "flowmonitor",
|
||||
"driverId": "0140",
|
||||
"releaseVersion": "18",
|
||||
"releaseVersion": "19",
|
||||
"driverFileName": "flow-monitor.py"
|
||||
}
|
||||
@@ -113,7 +113,11 @@ class ChannelSimple(object):
|
||||
"""Check to see if the value needs to be pushed."""
|
||||
if self.last_sent_value is None or self.last_sent_timestamp == 0:
|
||||
return True
|
||||
|
||||
if type(value) == str:
|
||||
if value != self.last_sent_value:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
if abs(value - self.last_sent_value) > self.senddelta_value:
|
||||
return True
|
||||
|
||||
@@ -180,7 +184,7 @@ class start(threading.Thread, deviceBase):
|
||||
self.force_send = False
|
||||
|
||||
self.daemon = True
|
||||
self.version = "18"
|
||||
self.version = "19"
|
||||
self.finished = threading.Event()
|
||||
threading.Thread.start(self)
|
||||
|
||||
@@ -370,17 +374,17 @@ class start(threading.Thread, deviceBase):
|
||||
bpd_val = 0
|
||||
|
||||
#Determine run status
|
||||
runstatus = 0
|
||||
runstatus = "undefined"
|
||||
if din1_val == 0 and gpm_val == 0:
|
||||
runstatus = 0 #Stopped
|
||||
runstatus = "Stopped" #Stopped
|
||||
elif din1_val == 0 and gpm_val > 10:
|
||||
runstatus = 1 #Assumed running might not have run indication
|
||||
runstatus = "Running" #Assumed running might not have run indication
|
||||
elif din1_val == 1 and gpm_val == 0:
|
||||
runstatus = 3 #no flow warning
|
||||
runstatus = "Running: No Flow" #no flow warning
|
||||
elif din1_val == 1 and gpm_val < self.lowflow:
|
||||
runstatus = 4 #low flow warning
|
||||
runstatus = "Running: Low Flow" #low flow warning
|
||||
elif din1_val == 1 and gpm_val >= self.lowflow:
|
||||
runstatus = 1 #running normally
|
||||
runstatus = "Running" #running normally
|
||||
|
||||
now = time.time()
|
||||
time_diff = now - last_measured_timestamp
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
},
|
||||
"deviceName": "ipp",
|
||||
"driverId": "0090",
|
||||
"releaseVersion": "9",
|
||||
"releaseVersion": "10",
|
||||
"driverFileName": "ipp.py"
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ CHANNELS = [
|
||||
PLCChannel(PLC_IP_ADDRESS, 'rptemperature', 'RP_Temperature', 'REAL', 0.0, 3600, plc_type='Micro800'),
|
||||
PLCChannel(PLC_IP_ADDRESS, 'rptrip', 'RP_Trip', 'REAL', 0.0, 3600, plc_type='Micro800'),
|
||||
PLCChannel(PLC_IP_ADDRESS, 'rptubingpressure', 'RP_TubingPressure', 'REAL', 0.0, 3600, plc_type='Micro800'),
|
||||
PLCChannel(PLC_IP_ADDRESS, 'runpermissive', 'Run_Permissive', 'REAL', 0.0, 3600, plc_type='Micro800'),
|
||||
PLCChannel(PLC_IP_ADDRESS, 'runpermissive', 'Run_Permissive', 'REAL', 0.0, 3600, plc_type='Micro800', map_=map_permissive),
|
||||
PLCChannel(PLC_IP_ADDRESS, 'spmode', 'SP_Mode', 'REAL', 0.0, 3600, plc_type='Micro800'),
|
||||
PLCChannel(PLC_IP_ADDRESS, 'sppressure', 'SP_Pressure', 'REAL', 0.0, 3600, plc_type='Micro800'),
|
||||
PLCChannel(PLC_IP_ADDRESS, 'sptemperature', 'SP_Temperature', 'REAL', 0.0, 3600, plc_type='Micro800'),
|
||||
@@ -194,7 +194,7 @@ CHANNELS = [
|
||||
PLCChannel(PLC_IP_ADDRESS, 'spvoltage', 'SP_Voltage', 'REAL', 0.0, 3600, plc_type='Micro800'),
|
||||
PLCChannel(PLC_IP_ADDRESS, 'startbutton', 'Start_Button', 'REAL', 0.0, 3600, plc_type='Micro800'),
|
||||
PLCChannel(PLC_IP_ADDRESS, 'startcommand', 'Start_Command', 'REAL', 0.0, 3600, plc_type='Micro800', write_enabled=True),
|
||||
PLCChannel(PLC_IP_ADDRESS, 'startpermissive', 'Start_Permissive', 'REAL', 0.0, 3600, plc_type='Micro800'),
|
||||
PLCChannel(PLC_IP_ADDRESS, 'startpermissive', 'Start_Permissive', 'REAL', 0.0, 3600, plc_type='Micro800',map_=map_permissive),
|
||||
PLCChannel(PLC_IP_ADDRESS, 'stopcommand', 'Stop_Command', 'REAL', 0.0, 3600, plc_type='Micro800', write_enabled=True),
|
||||
PLCChannel(PLC_IP_ADDRESS, 'tempshutdown', 'Temp_Shutdown', 'REAL', 1.0, 3600, plc_type='Micro800', write_enabled=True),
|
||||
PLCChannel(PLC_IP_ADDRESS, 'tempshutdownenabled', 'Temp_Shutdown_Enabled', 'REAL', 0.0, 3600, plc_type='Micro800', write_enabled=True),
|
||||
@@ -259,7 +259,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 = "9"
|
||||
self.version = "10"
|
||||
self.finished = threading.Event()
|
||||
self.forceSend = False
|
||||
threading.Thread.start(self)
|
||||
|
||||
@@ -75,3 +75,8 @@ map_device_status = {
|
||||
10: "User stopped",
|
||||
11: "Waiting to start (Timer Mode)"
|
||||
}
|
||||
|
||||
map_permissive = {
|
||||
0: "Not Ready",
|
||||
1: "OK"
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"driverFileName": "multisensor.py",
|
||||
"deviceName": "multisensor",
|
||||
"driverId": "0240",
|
||||
"releaseVersion": "5",
|
||||
"releaseVersion": "6",
|
||||
"files": {
|
||||
"file1": "multisensor.py",
|
||||
"file2": "utilities.py",
|
||||
|
||||
@@ -78,7 +78,7 @@ class start(threading.Thread, deviceBase):
|
||||
mqtt=mqtt, Nodes=Nodes)
|
||||
|
||||
self.daemon = True
|
||||
self.version = "5"
|
||||
self.version = "6"
|
||||
self.finished = threading.Event()
|
||||
self.force_send = False
|
||||
self.public_ip_address = ""
|
||||
@@ -120,15 +120,15 @@ class start(threading.Thread, deviceBase):
|
||||
if "active" in chan.plc_tag:
|
||||
PERSIST[chan.mesh_name] = val
|
||||
persistence.store(PERSIST,'persist.json')
|
||||
if "scaledValue" in chan.plc_tag:
|
||||
if val <= PERSIST[chan.mesh_name[:3]+"low"] and PERSIST[chan.mesh_name[:3]+"active"] == 1:
|
||||
self.sendtodbDev(1, chan.mesh_name[:3]+"alarm", "LOW", 0, 'multisensor')
|
||||
elif val >= PERSIST[chan.mesh_name[:3]+"high"] and PERSIST[chan.mesh_name[:3]+"active"] == 1:
|
||||
self.sendtodbDev(1, chan.mesh_name[:3]+"alarm", "HIGH", 0, 'multisensor')
|
||||
else:
|
||||
self.sendtodbDev(1, chan.mesh_name[:3]+"alarm", "OK", 0, 'multisensor')
|
||||
if chan.check(val, self.force_send):
|
||||
self.sendtodbDev(1, chan.mesh_name, chan.value, 0, 'multisensor')
|
||||
if "scaledValue" in chan.plc_tag:
|
||||
if val <= PERSIST[chan.mesh_name[:3]+"low"] and PERSIST[chan.mesh_name[:3]+"active"] == 1:
|
||||
self.sendtodbDev(1, chan.mesh_name[:3]+"alarm", "LOW", 0, 'multisensor')
|
||||
elif val >= PERSIST[chan.mesh_name[:3]+"high"] and PERSIST[chan.mesh_name[:3]+"active"] == 1:
|
||||
self.sendtodbDev(1, chan.mesh_name[:3]+"alarm", "HIGH", 0, 'multisensor')
|
||||
else:
|
||||
self.sendtodbDev(1, chan.mesh_name[:3]+"alarm", "OK", 0, 'multisensor')
|
||||
#time.sleep(5)
|
||||
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ class Channel(object):
|
||||
"""Check to see if the new_value needs to be stored."""
|
||||
send_needed = False
|
||||
send_reason = ""
|
||||
if self.data_type == 'BOOL' or self.data_type == 'STRING':
|
||||
if self.data_type == 'BOOL' or self.data_type == 'STRING' or type(new_value) == str:
|
||||
if self.last_send_time == 0:
|
||||
send_needed = True
|
||||
send_reason = "no send time"
|
||||
@@ -171,6 +171,145 @@ def identity(sent):
|
||||
"""Return exactly what was sent to it."""
|
||||
return sent
|
||||
|
||||
def volume_units(vunit):
|
||||
units = {
|
||||
0: "cm cubed/s",
|
||||
1: "cm cubed/min",
|
||||
2: "cm cubed/h",
|
||||
3: "cm cubed/d",
|
||||
4: "dm cubed/s",
|
||||
5: "dm cubed/min",
|
||||
6: "dm cubed/h",
|
||||
7: "dm cubed/d",
|
||||
8: "m cubed/s",
|
||||
9: "m cubed/min",
|
||||
10: "m cubed/h",
|
||||
11: "m cubed/d",
|
||||
12: "ml/s",
|
||||
13: "ml/min",
|
||||
14: "ml/h",
|
||||
15: "ml/d",
|
||||
16: "l/s",
|
||||
17: "l/min",
|
||||
18: "l/h (+)",
|
||||
19: "l/d",
|
||||
20: "hl/s",
|
||||
21: "hl/min",
|
||||
22: "hl/h",
|
||||
23: "hl/d",
|
||||
24: "Ml/s",
|
||||
25: "Ml/min",
|
||||
26: "Ml/h",
|
||||
27: "Ml/d",
|
||||
32: "af/s",
|
||||
33: "af/min",
|
||||
34: "af/h",
|
||||
35: "af/d",
|
||||
36: "ft cubed/s",
|
||||
37: "ft cubed/min",
|
||||
38: "ft cubed/h",
|
||||
39: "ft cubed/d",
|
||||
40: "fl oz/s (us)",
|
||||
41: "fl oz/min (us)",
|
||||
42: "fl oz/h (us)",
|
||||
43: "fl oz/d (us)",
|
||||
44: "gal/s (us)",
|
||||
45: "gal/min (us)",
|
||||
46: "gal/h (us)",
|
||||
47: "gal/d (us)",
|
||||
48: "Mgal/s (us)",
|
||||
49: "Mgal/min (us)",
|
||||
50: "Mgal/h (us)",
|
||||
51: "Mgal/d (us)",
|
||||
52: "bbl/s (us;liq.)",
|
||||
53: "bbl/min (us;liq.)",
|
||||
54: "bbl/h (us;liq.)",
|
||||
55: "bbl/d (us;liq.)",
|
||||
56: "bbl/s (us;beer)",
|
||||
57: "bbl/min (us;beer)",
|
||||
58: "bbl/h (us;beer)",
|
||||
59: "bbl/d (us;beer)",
|
||||
60: "bbl/s (us;oil)",
|
||||
61: "bbl/min (us;oil)",
|
||||
62: "bbl/h (us;oil)",
|
||||
63: "bbl/d (us;oil)",
|
||||
64: "bbl/s (us;tank)",
|
||||
65: "bbl/min (us;tank)",
|
||||
66: "bbl/h (us;tank)",
|
||||
67: "bbl/d (us;tank)",
|
||||
68: "gal/s (imp)",
|
||||
69: "gal/min (imp)",
|
||||
70: "gal/h (imp)",
|
||||
71: "gal/d (imp)",
|
||||
72: "Mgal/s (imp)",
|
||||
73: "Mgal/min (imp)",
|
||||
74: "Mgal/h (imp)",
|
||||
75: "Mgal/d (imp)",
|
||||
76: "bbl/s (imp;beer)",
|
||||
77: "bbl/min (imp;beer)",
|
||||
78: "bbl/h (imp;beer)",
|
||||
79: "bbl/d (imp;beer)",
|
||||
80: "bbl/s (imp;oil)",
|
||||
81: "bbl/min (imp;oil)",
|
||||
82: "bbl/h (imp;oil)",
|
||||
83: "bbl/d (imp;oil)",
|
||||
88: "kgal/s (us)",
|
||||
89: "kgal/min (us)",
|
||||
90: "kgal/h (us)",
|
||||
91: "kgal/d (us)",
|
||||
92: "MMft cubed/s",
|
||||
93: "MMft cubed/min",
|
||||
94: "MMft cubed/h",
|
||||
96: "Mft cubed/d"
|
||||
}
|
||||
return units[vunit]
|
||||
|
||||
def totalizer_units(tunit):
|
||||
|
||||
units = {
|
||||
0: "cm cubed",
|
||||
1: "dm cubed",
|
||||
2: "m cubed",
|
||||
3: "ml",
|
||||
4: "l",
|
||||
5: "hl",
|
||||
6: "Ml Mega",
|
||||
8: "af",
|
||||
9: "ft cubed",
|
||||
10: "fl oz (us)",
|
||||
11: "gal (us)",
|
||||
12: "Mgal (us)",
|
||||
13: "bbl (us;liq.)",
|
||||
14: "bbl (us;beer)",
|
||||
15: "bbl (us;oil)",
|
||||
16: "bbl (us;tank)",
|
||||
17: "gal (imp)",
|
||||
18: "Mgal (imp)",
|
||||
19: "bbl (imp;beer)",
|
||||
20: "bbl (imp;oil)",
|
||||
22: "kgal (us)",
|
||||
23: "Mft cubed",
|
||||
50: "g",
|
||||
51: "kg",
|
||||
52: "t",
|
||||
53: "oz",
|
||||
54: "lb",
|
||||
55: "STon",
|
||||
100: "Nl",
|
||||
101: "Nm cubed",
|
||||
102: "Sm cubed",
|
||||
103: "Sft cubed",
|
||||
104: "Sl",
|
||||
105: "Sgal (us)",
|
||||
106: "Sbbl (us;liq.)",
|
||||
107: "Sgal (imp)",
|
||||
108: "Sbbl (us;oil)",
|
||||
109: "MMSft cubed",
|
||||
110: "Nhl",
|
||||
251: "None"
|
||||
}
|
||||
return units[tunit]
|
||||
|
||||
def int_to_bits(n,x):
|
||||
return pad_to_x([int(digit) for digit in bin(n)[2:]],x) # [2:] to chop off the "0b" part
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class start(threading.Thread, deviceBase):
|
||||
mqtt=mqtt, Nodes=Nodes)
|
||||
|
||||
self.daemon = True
|
||||
self.version = "18"
|
||||
self.version = "19"
|
||||
self.finished = threading.Event()
|
||||
self.force_send = False
|
||||
self.public_ip_address = ""
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from Channel import PLCChannel,Channel, ModbusChannel, status_codes, fault_code_a, fault_code_b
|
||||
from Channel import PLCChannel,Channel, ModbusChannel, status_codes, fault_code_a, fault_code_b, volume_units, totalizer_units
|
||||
import persistence
|
||||
|
||||
data = persistence.load('persist.json')
|
||||
@@ -14,10 +14,10 @@ if drive_enabled:
|
||||
ModbusChannel('totalizer_1', 2609, 'FLOAT', 10,600,channel_size=2, unit_number=flowmeter_unit_number),
|
||||
ModbusChannel('totalizer_2', 2809, 'FLOAT', 10,600,channel_size=2, unit_number=flowmeter_unit_number),
|
||||
ModbusChannel('totalizer_3', 3009, 'FLOAT', 10,600,channel_size=2, unit_number=flowmeter_unit_number),
|
||||
ModbusChannel('volume_flow_units', 2102, 'INTEGER', 1,3600,channel_size=1, unit_number=flowmeter_unit_number),
|
||||
ModbusChannel('totalizer_1_units', 4603, 'INTEGER', 1,3600,channel_size=1, unit_number=flowmeter_unit_number),
|
||||
ModbusChannel('totalizer_2_units', 4604, 'INTEGER', 1,3600,channel_size=1, unit_number=flowmeter_unit_number),
|
||||
ModbusChannel('totalizer_3_units', 4605, 'INTEGER', 1,3600,channel_size=1, unit_number=flowmeter_unit_number),
|
||||
ModbusChannel('volume_flow_units', 2102, 'INTEGER', 1,3600,channel_size=1, unit_number=flowmeter_unit_number, transform_fn=volume_units),
|
||||
ModbusChannel('totalizer_1_units', 4603, 'INTEGER', 1,3600,channel_size=1, unit_number=flowmeter_unit_number, transform_fn=totalizer_units),
|
||||
ModbusChannel('totalizer_2_units', 4604, 'INTEGER', 1,3600,channel_size=1, unit_number=flowmeter_unit_number, transform_fn=totalizer_units),
|
||||
ModbusChannel('totalizer_3_units', 4605, 'INTEGER', 1,3600,channel_size=1, unit_number=flowmeter_unit_number, transform_fn=totalizer_units),
|
||||
ModbusChannel('run_status', 13, 'STRING', 0, 3600, channel_size=1, unit_number=drive_unit_number, transform_fn=status_codes),
|
||||
ModbusChannel('frequency', 9, 'INTEGER', 0.5, 600, channel_size=2, unit_number=drive_unit_number,scaling=2 ),
|
||||
ModbusChannel('current', 8, 'INTEGER', 0.5, 600, channel_size=2, unit_number=drive_unit_number,scaling=1 ),
|
||||
@@ -34,10 +34,10 @@ else:
|
||||
ModbusChannel('totalizer_1', 2609, 'FLOAT', 10,600,channel_size=2, unit_number=flowmeter_unit_number),
|
||||
ModbusChannel('totalizer_2', 2809, 'FLOAT', 10,600,channel_size=2, unit_number=flowmeter_unit_number),
|
||||
ModbusChannel('totalizer_3', 3009, 'FLOAT', 10,600,channel_size=2, unit_number=flowmeter_unit_number),
|
||||
ModbusChannel('volume_flow_units', 2102, 'INTEGER', 1,3600,channel_size=1, unit_number=flowmeter_unit_number),
|
||||
ModbusChannel('totalizer_1_units', 4603, 'INTEGER', 1,3600,channel_size=1, unit_number=flowmeter_unit_number),
|
||||
ModbusChannel('totalizer_2_units', 4604, 'INTEGER', 1,3600,channel_size=1, unit_number=flowmeter_unit_number),
|
||||
ModbusChannel('totalizer_3_units', 4605, 'INTEGER', 1,3600,channel_size=1, unit_number=flowmeter_unit_number)
|
||||
ModbusChannel('volume_flow_units', 2102, 'INTEGER', 1,3600,channel_size=1, unit_number=flowmeter_unit_number, transform_fn=volume_units),
|
||||
ModbusChannel('totalizer_1_units', 4603, 'INTEGER', 1,3600,channel_size=1, unit_number=flowmeter_unit_number, transform_fn=totalizer_units),
|
||||
ModbusChannel('totalizer_2_units', 4604, 'INTEGER', 1,3600,channel_size=1, unit_number=flowmeter_unit_number, transform_fn=totalizer_units),
|
||||
ModbusChannel('totalizer_3_units', 4605, 'INTEGER', 1,3600,channel_size=1, unit_number=flowmeter_unit_number, transform_fn=totalizer_units)
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"driverFileName":"PiFlow.py",
|
||||
"deviceName":"piflow",
|
||||
"driverId":"0280",
|
||||
"releaseVersion":"18",
|
||||
"releaseVersion":"19",
|
||||
"files": {
|
||||
"file1":"PiFlow.py",
|
||||
"file2":"Channel.py",
|
||||
|
||||
@@ -5,13 +5,14 @@ import urllib
|
||||
import contextlib
|
||||
def get_private_ip_address():
|
||||
"""Find the private IP Address of the host device."""
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
try:
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
sock.connect(("8.8.8.8", 80))
|
||||
ip_address = sock.getsockname()[0]
|
||||
sock.close()
|
||||
except Exception as e:
|
||||
return e
|
||||
ip_address = sock.getsockname()[0]
|
||||
sock.close()
|
||||
|
||||
return ip_address
|
||||
|
||||
def get_public_ip_address():
|
||||
|
||||
@@ -4,12 +4,10 @@ from plcfreshwater import PLC_IP_ADDRESS
|
||||
tags = [
|
||||
PLCChannel(PLC_IP_ADDRESS, "scaled_flow_meter","Scaled_Flow_Meter","REAL", 3, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "scaled_pressure_transducer","Scaled_Pressure_Transducer","REAL", 3, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "raw_hand_input","Raw_Hand_Input","BOOL", 0, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "raw_auto_input","Raw_Auto_Input","BOOL", 0, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "raw_run_status","Raw_Run_Status","BOOL", 0, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "raw_run_indication","Raw_Run_Indication","BOOL", 0, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "raw_hand_input","Raw_Hand_Input","BOOL", 0, 3600, plc_type="Micro800", map_={0: "Off", 1: "On"}),
|
||||
PLCChannel(PLC_IP_ADDRESS, "raw_auto_input","Raw_Auto_Input","BOOL", 0, 3600, plc_type="Micro800", map_={0: "Off", 1: "On"}),
|
||||
PLCChannel(PLC_IP_ADDRESS, "raw_run_status","Raw_Run_Status","BOOL", 0, 3600, plc_type="Micro800", map_={0: "Stopped", 1: "Running"}),
|
||||
PLCChannel(PLC_IP_ADDRESS, "raw_local_start","Raw_Local_Start","BOOL", 0, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "cmd_cloud_control","CMD_Cloud_Control","BOOL", 0, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "lifetime_flow_meter_gal","Lifetime_Flow_Meter_Gal","REAL", 1000, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "total_fm_yesterday_gal","Totalizer_FM_Yesterday_Total_Gal","REAL", 50, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "total_fm_day_gal","Totalizer_FM_Current_Day_Total_Gal","REAL", 50, 3600, plc_type="Micro800"),
|
||||
@@ -21,5 +19,5 @@ tags = [
|
||||
PLCChannel(PLC_IP_ADDRESS, "total_fm_month_bbls","Totalizer_FM_Current_Month_BBLs","REAL", 50, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "lifetime_flow_meter_bbls","Lifetime_Flow_Meter_BBLS","REAL", 1000, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "spt_flow_meter_unit","SPT_Flow_Meter_Unit","BOOL", 0, 3600, plc_type="Micro800"),
|
||||
PLCChannel(PLC_IP_ADDRESS, "raw_overload_status", "Raw_Overload_Status", "BOOL", 0, 3600, plc_type="Micro800")
|
||||
PLCChannel(PLC_IP_ADDRESS, "raw_overload_status", "Raw_Overload_Status", "BOOL", 0, 3600, plc_type="Micro800", map_={0: "Good", 1: "Down on Overload Tripped"})
|
||||
]
|
||||
@@ -8,7 +8,7 @@
|
||||
"file4": "Tags.py"
|
||||
},
|
||||
"deviceName": "plcfreshwater",
|
||||
"releaseVersion": "7",
|
||||
"releaseVersion": "8",
|
||||
"driverFileName": "plcfreshwater.py",
|
||||
"driverId": "0100"
|
||||
}
|
||||
@@ -52,7 +52,7 @@ class start(threading.Thread, deviceBase):
|
||||
mqtt=mqtt, Nodes=Nodes)
|
||||
|
||||
self.daemon = True
|
||||
self.version = "7"
|
||||
self.version = "8"
|
||||
self.finished = threading.Event()
|
||||
self.force_send = False
|
||||
self.public_ip_address = ""
|
||||
|
||||
Reference in New Issue
Block a user