Logic Machine Forum
Alert Manager - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Application Store (https://forum.logicmachine.net/forumdisplay.php?fid=11)
+--- Thread: Alert Manager (/showthread.php?tid=601)

Pages: 1 2 3 4 5


RE: Alert Manager - admin - 03.06.2024

You can check the structure of the Alerts manager data using the Storage viewer app. But if you modify this data via a script the client won't see these changes unless a reload is performed.


RE: Alert Manager - Erwin van der Zwart - 03.06.2024

It's only possible when the alert manager is loaded into an frame in the visu by using this custom JS:
Code:
$(function(){
   $(document).ready(function() {
      var f= $('iframe');
      f.load(function(){
         if (typeof grp != 'undefined') {
            grp.listen('1/1/1', function(object, state) {
               if (state == 'value' && object.value == true ){
                  f.contents().find('#AcknowledgeButton').click();
               }
            }, true);
          }
      });
   });
});



RE: Alert Manager - iJAF - 03.06.2024

Hi, I have used this app in the past but I have noticed that I have no more access to this alert manager in Schneider Spacelynk.

Where could I find the latest version of this app ?

Thank you


RE: Alert Manager - Daniel - 03.06.2024

https://forum.logicmachine.net/showthread.php?tid=3497&pid=22783#pid22783


RE: Alert Manager - xxyzz - 05.08.2024

I have written this script for surveillance of alarms. It will only generate one alarm if an Object is not updated within a range of time. You can use it as Resident or Scheduled Script. It takes every object with the tag "Alarm". Change the "controlltime" to your desire.

Code:
--This script is for Object surveillance passivley with the updatetime property
--Alarms will be updated on change!

alarms = grp.tag('Alarm') --add the Tag or Tags of the Object that need surveillance

controlltime = 30 --Allowed Time between recieved Telegramms in Seconds

--initializing Tables for Alarming
currentstate = {}
previousstate = storage.get("previousstate") or {}


now = os.time()

--Iteration throgh the alarms Table to get the update time of every Object

for index, alarm in ipairs(alarms) do
    lastrecieved = alarm.updatetime

    local online
    --calculating the Timedelta and comparing it with our Variable
    if (now - lastrecieved) > controlltime then
        online = false
    else
        online = true
    end

    -- Store the current status in the currentstatus table
    currentstate[alarm.id] = {id = alarm.id, comment = alarm.comment, online = online}

    -- Compare the current status with the previous status
    if previousstate[alarm.id] == nil or currentstate[alarm.id].online ~= previousstate[alarm.id].online then
        if not currentstate[alarm.id].online then
            alert("Alarm " .. currentstate[alarm.id].comment .. " nicht verfügbar")
          else
                  alert("Alarm " ..currentstate[alarm.id].comment .. " verfügbar")
        end
    end

end

-- Log the current status
-- log(currentstate)

-- Save the current status to persistent storage as previous status
storage.set("previousstate", currentstate)




And this script that will actively send a read request to check if alarms are still available. It will take every objekt with the tag "Alarm". This is designed to be used as resedent or scheduled script.

Code:
-- Variables as Tag
alarms = grp.tag('Alarm')


currentstatus = {}
previousstate = storage.get("previousstate") or {}

-- Iterate over all alarms
for index, alarm in ipairs(alarms) do
    value, responding = grp.readvalue(alarm.address, readtimeout)
    local online

    if responding == "timeout" then
        online = false
    else
        online = true
    end

    -- Store the current status in the currentstatus table
    currentstatus[alarm.id] = {id = alarm.id, name = alarm.name, online = online}

    -- Compare the current status with the previous status
    if previousstate[alarm.id] == nil or currentstatus[alarm.id].online ~= previousstate[alarm.id].online then
        if not currentstatus[alarm.id].online then
            alert("Alarm " .. currentstatus[alarm.id].name .. " nicht verfügbar")
        end
    end
end

-- Log the current status
--log(currentstatus)

-- Save the current status to persistent storage as previous status
storage.set("previousstate", currentstatus)