(23.11.2020, 08:35)admin Wrote: You should use checkwrite and also send false when there's no error. This will send true when delta is more than 4 minutes, false otherwise:
Code:grp.checkwrite('1/1/1', delta1 > 240)
Status is not updated because there's a response from the gateway. "Illegal data address" is not a connection error. There's a special error code 11 (Gateway Target Device Failed to Respond) that should have been used for this.
ok understood !
Adding a column error in modbus_device or mapping could be a solution...
In my case, if I check every adress, it should be too much cpu load no ??
I was thinking to something like this:
What's your point ?
Code:
function checkSlaveTcpModbus(resultCheckTemp)
local retour_modbus = ''
local heartbeat_time = 5 -- Minutes
local now = os.time() -- current timestamp in seconds
local res = db:getall('SELECT name, updatetime FROM objects WHERE (address>?) AND (address<?)', 39999, 50000)
if res then
for _, liste_modbus in ipairs(res) do
if (now - liste_modbus.updatetime) >= (heartbeat_time * 60) then
retour_modbus=retour_modbus .. '[' ..liste_modbus.name ..']'
end
end
end
--log( retour_modbus)
return retour_modbus
end
-----------
FRANCE SMARTHOME & SMARTBUILDING INTEGRATION
SE ECO EXPERT
FRANCE SMARTHOME & SMARTBUILDING INTEGRATION
SE ECO EXPERT