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
#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


Messages In This Thread
Device monitoring and reporting - by anve - 18.11.2023, 08:23
RE: Device monitoring and reporting - by anve - 19.11.2023, 20:40
Device monitoring and reporting - by anve - 18.11.2023, 14:28
Device monitoring and reporting - by anve - 18.11.2023, 15:02
RE: Device monitoring and reporting - by anve - 21.11.2023, 21:13

Forum Jump: