This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Device monitoring and reporting
#1
I want to make these functions:

Alarm Functionality: Develop a mechanism to alert when a device is offline or missing.
Email Alert System: Configure an email notification system for device status changes or alarms.

Is there a native functionality in LM5 Lite to support such detailed device monitoring and alerting?

If there is no native support. How do I make this function?
Reply
#2
There are several ways to do that..

When the devices are on TP you could use knxlib.ping('1.1.1')

Another option when you also need to check devices on IP is to have on each device at least 1 object with the read flag enabled and set to a grp address where it’s the only object that can respond on a read request and use grp.readvalue('1/1/1'), when you get a response you know the device is online.

A 3th option is to let each device send to a grp address cyclically and monitor the timestamp of that object. When the timestamp updates are stopping your devices is offline. This is the least prevered method as it increases the traffic a bit.
Reply
#3
(18.11.2023, 10:46)Erwin van der Zwart Wrote: There are several ways to do that..

When the devices are on TP you could use knxlib.ping('1.1.1')

Another option when you also need to check devices on IP is to have on each device at least 1 object with the read flag enabled and set to a grp address where it’s the only object that can respond on a read request and use grp.readvalue('1/1/1'), when you get a response you know the device is online.

A 3th option is to let each device send to a grp address cyclically and monitor the timestamp of that object. When the timestamp updates are stopping your devices is offline. This is the least prevered method as it increases the traffic a bit.


Thank you so much for this info.

I am very new to scripting in LM.
Is there any chance you can make a example script for me that i can use as a template, option 1, TP knxlib.ping?


Skickat från min iPhone med Tapatalk
Reply
#4
If you search the forum for knxlib.ping you will find enough samples..
Reply
#5
(18.11.2023, 14:58)Erwin van der Zwart Wrote: If you search the forum for knxlib.ping you will find enough samples..


Thanks, I will do that Smile


Skickat från min iPhone med Tapatalk
Reply
#6
(18.11.2023, 10:46)Erwin van der Zwart Wrote: There are several ways to do that..

When the devices are on TP you could use knxlib.ping('1.1.1')

Another option when you also need to check devices on IP is to have on each device at least 1 object with the read flag enabled and set to a grp address where it’s the only object that can respond on a read request and use grp.readvalue('1/1/1'), when you get a response you know the device is online.

A 3th option is to let each device send to a grp address cyclically and monitor the timestamp of that object. When the timestamp updates are stopping your devices is offline. This is the least prevered method as it increases the traffic a bit.

What do you think about this script?
The interval time can be longer, yes. But other than that?




Code:
local deviceAddress = '4/0/13'  -- Group address to monitor
local checkInterval = 60        -- Time in seconds between each check
local readTimeout = 5          -- Timeout for read request in seconds
-- Function to check the device
local function checkDevice(address, timeout)
    local response = grp.readvalue(address, timeout)
    if response then
        log('OK - Response received from ' .. address)
    else
        log('ERROR - No response from ' .. address)
    end
end
-- Main loop
while true do
    checkDevice(deviceAddress, readTimeout)
    os.sleep(checkInterval)
end
Reply
#7
It won't work. grp.getvalue returns the value that is stored in the database, it does not send a read request.

See this thread for a solution with knxlib.ping: https://forum.logicmachine.net/showthread.php?tid=3510
Reply
#8
He uses grp.readvalue and in my experience that returns the value of the read action, or am i wrong?
Reply
#9
You are right, I've misread the function name. grp.readvalue can be used for monitoring. Alternatively poll interval can be set for certain objects then updatetime property can be checked using a scheduled script.
Reply
#10
I use an MDT STC power supply with diagnostic function that can detect failed devices.
It also measures bus traffic.
Reply
#11
(20.11.2023, 11:52)baggins Wrote: I use an MDT STC power supply with diagnostic function that can detect failed devices.
It also measures bus traffic.

Veri nice suggestion as well! I have exactly this product in another installation. Smile

Code:
-- List of group addresses to monitor
local addresses = {'4/5/2', '2/0/8', '2/0/24', '2/0/22', '1/0/24'}

-- Time in seconds between each full round of checks
local checkInterval = 60

-- Timeout in seconds for each read request to a device
local readTimeout = 5

-- Delay in seconds between consecutive read requests within a round
local delayBetweenReads = 2

-- Function to check a single device
local function checkDevice(address, timeout)
    -- Safely attempt to read from the device at 'address' with 'timeout'
    -- 'pcall' is used for safe function call, it returns status and response
    local status, response = pcall(grp.readvalue, address, timeout)

    -- Check if the read attempt was successful (status is true)
    if status then
        -- Log a message indicating a successful read
        log('OK - Response received from ' .. address)
    else
        -- Log a message indicating a failed read
        log('ERROR - No response from ' .. address)
    end
end

-- Main loop of the script
while true do
    -- Iterate over each address in the 'addresses' list
    for _, address in ipairs(addresses) do
        -- Check each device using the checkDevice function
        checkDevice(address, readTimeout)

        -- Pause for 'delayBetweenReads' seconds before checking the next device
        os.sleep(delayBetweenReads)
    end

    -- Once all devices are checked, pause for 'checkInterval' seconds
    os.sleep(checkInterval)
end

This is my latest code for this solution. entering the group addresses to scan for is the "big" job now. Is it possible to upload a css file with all addresses to check and refer to the csv ?

I also added that the error message should not appear if any other response than true is responding from the bus.
Reply
#12
Just TAG your objects and fetch them by the TAG and iterate the table…
Reply


Forum Jump: