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.

Creating a KNx point for Modbus Device Communication Error Situation
#2
Hi Savaskorkmaz,

I don't know if there is a function for this in the system, but i solved it once with a little resident script.

Put your actions on the position where the logging is now (replace them with your action).

Code:
-- Check all modbus meters for connection
query = 'SELECT * FROM modbus_devices'
meter_state = db:getall(query)
previous_state = storage.get('meterstate')
if previous_state == nil then
 for _, device in ipairs(meter_state) do
   if device.active == 0 then
     log(device.name .. " = down")
   else
     log(device.name .. " = active")
   end
 end
 storage.set('meterstate', meter_state)
else
 for _, device in ipairs(meter_state) do
   if device.active ~= previous_state[_].active then
     log(device.name .. ' is changed to ' .. device.active)
   end    
 end
 storage.set('meterstate', meter_state)
end

BR,

Erwin van der Zwart
Reply


Messages In This Thread
RE: Creating a KNx point for Modbus Device Communication Error Situation - by Erwin van der Zwart - 03.10.2016, 15:36

Forum Jump: