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.

blink light
#1
I have flood sensor witch sends me an alarm in case of flood. When the alarm state is triggered i need to make a light blink constantly until the alarm stops. 


I created an event-based script triggered by the state of the sensor and inside I created a while loop inside:

Code:
while grp.getvalue("stato sensore") do
  grp.write("luce", true)
  os.sleep(1)
  grp.write("luce", false)
  os.sleep(1)
end


Now it works but it easily overloads the CPU pretty easily. Is there a better way to do this?
Reply
#2
See if the script triggers something else. One telegram per second should not cause high CPU load.
Set event script execution mode to "Last instance only".
Reply
#3
(18.03.2025, 10:02)admin Wrote: See if the script triggers something else. One telegram per second should not cause high CPU load.
Set event script execution mode to "Last instance only".

Well, it does because the light is WLED led strip so it is not directly KNX but through API it became KNX. It actually works like this:

light group address >  triggers an event-based script > calls a function from the library i created

is that too much? Does using metatables heavily impact the CPU? I attached the TAG- activated event-script 

Code:
ga = event.dst
dt = grp.find(ga).datatype
ga_stato = get_st_add(ga)
value = event.getvalue()

wled = wled_ctrl:init({ip = "10.11.24.106", debug_mode = false})



if dt==1001 then
  wled:accensione(value, ga_stato)
elseif dt == 5001 then
  wled:luminosita(value, ga_stato)
elseif dt == 232600 then
  wled:colore(value, ga_stato)
elseif dt == 6 then
  wled:effetto(value, ga_stato)
elseif dt == 7 then
  wled:color_temp(value, ga_stato)
elseif dt == 8 then
  wled:palette(value, ga_stato)
else
  log("rec")
  log(wled:stato())
end
 
Reply
#4
Install System load app on LM and check which process is causing high CPU load. Sometimes I/O load can be high without actual high CPU load.
Reply
#5
(18.03.2025, 11:05)admin Wrote: Install System load app on LM and check which process is causing high CPU load. Sometimes I/O load can be high without actual high CPU load.

Ok I found the problem, kind of stupid: since I have 15 WLED strips and I using a generated general command to switch them all off and back on, I was sendind 15 telegrams each second.

I solved using the API to directly switch on and off all the strips. I now have a way lower CPU usage.

Thanks
Reply


Forum Jump: