19.12.2024, 10:47
Hello,
We are facing an issue with the push notification functionality. The application we are using the LM for is taking place in a ship, where we use the Logic Machine 5 (LMp2-GSM) in order to receive with the use of MODBUS RTU alarms from the Monitoring System of the ship (essentially the LM is connected to a PLC device) and then send a few push notifications to the crew of the ship to notify them for alarms etc.
More specifically:
1) a bit from the PLC is turned on, then the user receives a push notification. This is achieved with the use of an Event Script.
2) after a couple of minutes, the alarm will repeat itself unless it has been acknowledged from the crew members. This is achieved with the use of a Resident Script.
3) The acknowledgment is done through the Mosaic UI with the push of a button and an Event Script.
The issue here is that this whole application may not work as intended at all times:
1)the push notification from the first bit may not be sent at all and only receive push notifications from the repeat functionality.
2)the repeat function, which repeats the first message, is generally repeated after the correct time specified time (1minute)
but every few repeats its stops for 10-15 minutes and then starts again.
We are buffled as to why these things occure.
Thank you for your time.
We are facing an issue with the push notification functionality. The application we are using the LM for is taking place in a ship, where we use the Logic Machine 5 (LMp2-GSM) in order to receive with the use of MODBUS RTU alarms from the Monitoring System of the ship (essentially the LM is connected to a PLC device) and then send a few push notifications to the crew of the ship to notify them for alarms etc.
More specifically:
1) a bit from the PLC is turned on, then the user receives a push notification. This is achieved with the use of an Event Script.
2) after a couple of minutes, the alarm will repeat itself unless it has been acknowledged from the crew members. This is achieved with the use of a Resident Script.
3) The acknowledgment is done through the Mosaic UI with the push of a button and an Event Script.
The issue here is that this whole application may not work as intended at all times:
1)the push notification from the first bit may not be sent at all and only receive push notifications from the repeat functionality.
2)the repeat function, which repeats the first message, is generally repeated after the correct time specified time (1minute)
but every few repeats its stops for 10-15 minutes and then starts again.
We are buffled as to why these things occure.
Thank you for your time.
Code:
-- this is the Event Script that is activated with each alarm and sends the first message
-- Each alarm is a separate event script with a dedicated object that activated it
pusher = require('applibs.pusher')
Fire_Alarm=grp.getvalue("32/1/24")
if (Fire_Alarm==true) then
status, errors = pusher.send('Captain', '**FIRE ALARM ACTIVATED**\n Please Check The Fire Alarm System!')
status, errors = pusher.send('Chief_engineer', '**FIRE ALARM M/E ALARM ACTIVATED**\n Please Check The Fire Alarm System!')
grp.write('0/1/11',1)
end
Code:
--here the repeat function starts
-- essentially each alarm that is activated by an Event Script, activates the object '0/1/11' which then starts a counter. When the counter reaches 3 then is sends the correct message depending on the object that is active
-- when the alarm is ackowlegded, the object of the activation is turned to 0 and the object '0/1/11' is turned to 0 as well
ff=grp.getvalue("0/1/11") -- this bit is set to TRUE with each alarm
count=grp.getvalue('1/1/7') -- this is the counter variable
if (ff == true) then
count = count +1
grp.update('1/1/7',count)
elseif (ff==false) then
grp.update('1/1/7',0)
grp.update('1/1/3',0)
end
if count >= 3 then
grp.update('1/1/3',1) -- this variable when set to TRUE is what initiates the re-send of the push notification
grp.update('1/1/7',0)
elseif count == 1 then
grp.update('1/1/3',0)
end
pusher = require('applibs.pusher')
cnt = grp.getvalue('1/1/3') -- this variable is the trigger for repeatance
--table{"32/1/18","32/1/17"}
local objects={
obj1 = grp.getvalue("32/1/2"),
obj2 = grp.getvalue("32/1/3"),
obj3 = grp.getvalue("32/1/4"),
obj4 = grp.getvalue("32/1/5"),
obj5 = grp.getvalue("32/1/6"),
obj6 = grp.getvalue("32/1/7"),
obj7 = grp.getvalue("32/1/8"),
obj8 = grp.getvalue("32/1/9"),
}
local push={
obj1 = ' **POWER ALARM ACTIVATED**\n Please Check The Monitoring System! ',
obj2 = ' **TANK ALARM ACTIVATED**\n Please Check The Monitoring System! ',
obj3 = ' **PORT M/E ALARM ACTIVATED**\n Please Check The Monitoring System! ',
obj4 = '**STBD M/E ALARM ACTIVATED**\n Please Check The Monitoring System!',
obj5 = '**FIRE ALARM ACTIVATED**\n Please Check The Fire Alarm System!',
obj6 = '**WATERTIGHT DOOR ALARM**\n Please Check The System!',
obj7 = '**HI FOG ACTIVATED**\n Please Check The System!',
obj8 = 'This is the 8th',
}
if cnt == true then
for obj, isActive in pairs(objects) do
if isActive then
status, errors = pusher.send_all(push[obj])
end
end
end