I have had some deadlock problems with the EnOcean plug-in deadlocking with other processes and causing restarts. Frequently the other process is a PLEG process, but that makes sense as PLEG is doing most of my heavy-lifting in climate, lighting, and security automation. I have spent a lot of time troubleshooting and optimizing my PLEGs, so now I am looking at other processes to see if they can be optimized.
What strikes me immediately when I look at my verbose logging, is that the EnOcean gateway is recursively calling function CheckTime every 5 seconds for every EnOcean device. CheckTime sets occupancy sensors back to untripped if they have not had a telegram within the OccupancyReset number of seconds. But instead of just checking a tripped sensor every OccupancyReset number of seconds, we are checking all sensors 24x7 every 5 seconds. With 11 devices, that is a lot of overhead. In my (slightly) custom version of the plug-in, I commented out the recursive call against all child devices, and replaced it with an explicit call OccupancyReset +1 seconds after a device is tripped. So far seems to work, and this HAS to dramatically reduce the overhead from running the EnOcean plug-in…
Change to CheckTime function, which is just to comment out two lines:
--child = tostring(child) comment out user wilme2 2015-01-05
--luup.call_delay("CheckTime", 5, child) comment out user wilme2 2015-01-05
Change to radio telegram handler 4BS, occupancy sensor section (just the last two lines with my comment at the end, but I wanted you to see where it went…)
[code] – Occupancy sensor
–
elseif eepFunc == 0x07 then
if not g_childDevices[altid] then
log( “(EnOceanPlugin::4BS)8 Device not known. Return” )
return
end
log( "(EnOceanPlugin::4BS)9 Device known: "… g_childDevices[altid] )
– user wilme2 comment out on 2014-05-02: ShowSysMessage( “A valid telegram has been received ! Target device : " … altid … " Occupancy sensor” )
local tripped = GetValueAtLocation( data, LOCATIONS[“4BS_07_PIRS”] ) – 0…255
–tripped = (tripped > 127) and 0 or 1
luup.variable_set( SID.SECURITY, "Tripped", tonumber(tripped), g_childDevices[altid] )
local timeNow = os.time()
luup.variable_set( SID.SECURITY, "LastTriped", timeNow, g_childDevices[altid] )
local childforcalldelay = tostring(g_childDevices[altid]) -- user wilme2 added 2015-01-05
luup.call_delay("CheckTime", (resetTime+1) , childforcalldelay) -- user wilme2 added 2015-01-05
end
[/code]