07.04.2022, 13:12
(07.04.2022, 06:53)admin Wrote: The 0..100 range is only needed when binary and scale objects are used together. This way binary ON is considered 100%.
For general average use this:
Code:-- AVERAGE value calc['avg'] = function(group) local result, count, value = 0, 0 for _, address in ipairs(group.objects) do value = values[ address ] if type(value) == 'number' then result = result + value count = count + 1 end end if count > 0 then grp.checkwrite(group.output, result / count) end end
Thank you for the great support as usual!!!