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.

Trend log of the bus traffic
#3
(30.03.2020, 14:15)Daniel. Wrote: knxlib.getstats()

OK, so I got this working. I made a small resident script that tracks the busload and then writes the value to a group address. Then one can add a trend for the busload and see the bus load in % over time.

As the getstats() is not giving the load as a percentage, but rather the number of telegrams in total, I have added a paramter for the number of telegrams pr second. This is of course not an exact value, as the length of the telegrams will vary. Normally, an average telegram time is 25ms, so that should give a theoretical max of 40/s.I have used a lower value in my script.

The getstats() is also only updated every minute, so the values we get from it is only to be seen as an indication of the bus load. The trend will be able to give you a hint that there might be too high bus load, and then you will have to do a more detailed analyze of this in another tool.

As the values are somewhat uncertain when it comes to actual bus load I have not seen the value in creating seperate GA for send, receive and repeats. I have only added them all together. If one want to split it, it should be fairly easy to modify the script accordingly.

Anyways.. the code is as follows:

Code:
maxS = 15 --Highest accepted telegram rate pr second
GAtraffic = '32/1/3'  --Must be set to desired GA

-------------------------------------------------------------------------
--No changes below the line
maxM = maxS*60
stats = knxlib.getstats()
if not stats then
  return
end

sent = stats.tptx
received = stats.tprx

traffic = sent + received
prev = storage.get('Previous', 0)

if prev ~= 0 then
  bLoad = ((traffic - prev)*100)/ maxM
  if bLoad > 0 then
    grp.write(GAtraffic, bLoad)
    -- log(prev, traffic, bLoad)
  end
end

storage.set('Previous', traffic)
There are 10 kinds of people in the world; those who can read binary and those who don't  Cool
Reply


Messages In This Thread
Trend log of the bus traffic - by Trond Hoyem - 30.03.2020, 13:52
RE: Trend log of the bus traffic - by Daniel - 30.03.2020, 14:15
RE: Trend log of the bus traffic - by Trond Hoyem - 31.03.2020, 09:49
RE: Trend log of the bus traffic - by AlexLV - 06.04.2020, 14:44
RE: Trend log of the bus traffic - by admin - 07.04.2020, 06:11
RE: Trend log of the bus traffic - by AlexLV - 07.04.2020, 08:37
RE: Trend log of the bus traffic - by admin - 21.04.2022, 08:37

Forum Jump: