Fix for MAXH2O-41. PLC Write function was not firing
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
"driverFileName":"rigpump.py",
|
"driverFileName":"rigpump.py",
|
||||||
"deviceName":"rigpump",
|
"deviceName":"rigpump",
|
||||||
"driverId":"0150",
|
"driverId":"0150",
|
||||||
"releaseVersion":"5",
|
"releaseVersion":"7",
|
||||||
"files": {
|
"files": {
|
||||||
"file1":"rigpump.py",
|
"file1":"rigpump.py",
|
||||||
"file2":"Channel.py",
|
"file2":"Channel.py",
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ except Exception:
|
|||||||
persist = {}
|
persist = {}
|
||||||
|
|
||||||
PLC_IP_ADDRESS = "192.168.1.10"
|
PLC_IP_ADDRESS = "192.168.1.10"
|
||||||
|
WATCHDOG_SEND_PERIOD = 3600 # seconds
|
||||||
|
|
||||||
|
|
||||||
def reverse_map(value, map_):
|
def reverse_map(value, map_):
|
||||||
@@ -49,7 +50,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)
|
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 = "5"
|
self.version = "7"
|
||||||
self.finished = threading.Event()
|
self.finished = threading.Event()
|
||||||
self.forceSend = False
|
self.forceSend = False
|
||||||
threading.Thread.start(self)
|
threading.Thread.start(self)
|
||||||
@@ -73,13 +74,14 @@ class start(threading.Thread, deviceBase):
|
|||||||
# after its booted up assuming that M1 is now reading modbus data
|
# after its booted up assuming that M1 is now reading modbus data
|
||||||
# we can replace the reference made to this device name to the M1 driver with this
|
# we can replace the reference made to this device name to the M1 driver with this
|
||||||
# driver. The 01 in the 0199 below is the device number you referenced in the modbus wizard
|
# driver. The 01 in the 0199 below is the device number you referenced in the modbus wizard
|
||||||
# self.nodes["rigpump_0199"] = self
|
self.nodes["rigpump_0199"] = self
|
||||||
|
|
||||||
public_ip_address = get_public_ip_address()
|
public_ip_address = get_public_ip_address()
|
||||||
self.sendtodbDev(1, 'public_ip_address', public_ip_address, 0, 'rigpump')
|
self.sendtodbDev(1, 'public_ip_address', public_ip_address, 0, 'rigpump')
|
||||||
|
|
||||||
watchdog = self.rigpump_watchdog()
|
watchdog = self.rigpump_watchdog()
|
||||||
self.sendtodbDev(1, 'watchdog', watchdog, 0, 'rigpump')
|
self.sendtodbDev(1, 'watchdog', watchdog, 0, 'rigpump')
|
||||||
|
watchdog_send_timestamp = time.time()
|
||||||
|
|
||||||
send_loops = 0
|
send_loops = 0
|
||||||
watchdog_loops = 0
|
watchdog_loops = 0
|
||||||
@@ -104,8 +106,9 @@ class start(threading.Thread, deviceBase):
|
|||||||
watchdog_loops += 1
|
watchdog_loops += 1
|
||||||
if (watchdog_loops >= watchdog_check_after):
|
if (watchdog_loops >= watchdog_check_after):
|
||||||
test_watchdog = self.rigpump_watchdog()
|
test_watchdog = self.rigpump_watchdog()
|
||||||
if not test_watchdog == watchdog:
|
if test_watchdog != watchdog or (time.time() - watchdog_send_timestamp) > WATCHDOG_SEND_PERIOD:
|
||||||
self.sendtodbDev(1, 'watchdog', test_watchdog, 0, 'rigpump')
|
self.sendtodbDev(1, 'watchdog', test_watchdog, 0, 'rigpump')
|
||||||
|
watchdog_send_timestamp = time.time()
|
||||||
watchdog = test_watchdog
|
watchdog = test_watchdog
|
||||||
|
|
||||||
test_public_ip = get_public_ip_address()
|
test_public_ip = get_public_ip_address()
|
||||||
|
|||||||
Reference in New Issue
Block a user