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.

TP Load
#4
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
Reply


Messages In This Thread
TP Load - by DGrandes - 20.01.2020, 09:06
RE: TP Load - by admin - 20.01.2020, 09:28
RE: TP Load - by DGrandes - 23.01.2020, 14:27
RE: TP Load - by admin - 24.01.2020, 06:23
RE: TP Load - by Erwin van der Zwart - 24.01.2020, 07:19
RE: TP Load - by admin - 24.01.2020, 07:38
RE: TP Load - by manos@dynamitec - 31.08.2020, 17:29
RE: TP Load - by Tokatubs - 08.02.2021, 10:29
RE: TP Load - by Trond Hoyem - 08.02.2021, 12:13

Forum Jump: