24.01.2020, 06:23
Try this (untested, so might not work) scheduled script, set to run every minute. Change 1/2/3 to object that will store current bus load (datatype is scale %).
Code:
key = 'bus-telegrams'
prev = storage.get(key)
stats = buslib.getstats()
if stats then
curr = stats.tprx + stats.tprx
if prev and prev < curr then
delta = curr - prev
-- convert to percent
load = math.ceil(delta / 9 + 0.5)
load = math.min(100, load)
grp.update('1/2/3', load)
end
storage.set(key, curr)
end