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.

KNX connection statuss and device check
#1
Hi,

at Russian FB page found some interesting scripts, I think can be useful, not seen here..

1. KNX connection status:

Code:
if not client then  
   require('genohm-scada.eibdgm')  

   function statushandler(status)    
       if status == 0x00 then      
           grp.write('32/2/1', true)    
           elseif status == 0xFF then      
           grp.write('32/2/1', false)    
       end  
   end  
   client = eibdgm:new()  
   client:sethandler('status', statushandler)
end

client:step()

2. KNX device check, if any lost, automatically message can be sent (with russian comments, I added english translation):

Code:
-- Таблица адресов, которые нужно проверять на доступность на шине
-- Table of addresses which should be checked at KNX line
knx_addrs = {'1.1.2','1.1.4','1.1.5','1.1.6','1.1.7','1.1.8','1.1.9','1.1.10','1.1.11','1.1.12','1.1.13','1.1.14','1.1.15'}
-- Таблица подключенных устройств
-- Table of connected devices
knx_conn = {}
-- Таблица отключенных устройств
-- Table of disconnected devices
knx_disc = {}

-- Проверка доступности устройств на шине KNX
-- Checking devices are alive
for index, value in ipairs(knx_addrs) do
if knxlib.ping(value) then
table.insert(knx_conn, value)
else
table.insert(knx_disc, value)
end
end

-- Перевод таблицы в строку
-- Table translation to string
conn_str = table.concat(knx_conn, ', ')
disc_str = table.concat(knx_disc, ', ')

-- Вывод таблиц и строк в лог для просмотра при отладке.
-- Logging of tables and strings for debugging
--log(#knx_conn, #knx_disc)
--log(conn_str, disc_str)

-- отправляем письмо со списком недоступных устройств, если такие найдены
-- sending message with disconnected devices if any
if (#knx_disc > 0) then
log(disc_str)
--mail('example@email.com', 'Проверка устройств KNX', 'Отключены следующие устройства: ' .. disc_str)
-- translation of russian text above string: "KNX device checking" "These devices are disconnected:"
end

But please check second script, approx. every day I see in my log that some devices are offline, but they are different.. Looks a little strange for me.. But all works. May be something should be improved in script.

Alex
Reply
#2
Hi
I would add some delay in the second script in for loop.  During ping quite a lot of telegrams is sent so it is better to do it one by one slowly.
Thanks for sharing.
BR
------------------------------
Ctrl+F5
Reply


Forum Jump: