(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.

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)
endThis 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.
 
 

