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.

SpaceLynk delay
#1
We are having some problems integrating an IR/RF controller with Spacelynk. The device works with the scripts we've found  at KNX Groep BV forum and already used in other projects to send IR signals (for air conditioning the delay was not noticed, but for a curtain, let's say that the client is not happy at all). We are using either:


function tcpsend(message)
 host, port = "192.168.126.56", 4998 --IP adres en poort
 socket = require('socket')
 tcp = assert(socket.tcp())
 tcp:connect(host, port);
 tcpConfusedend(message);
  while true do
    s, status, partial = tcp:receive()
    print(s or partial)
    if status == "closed" then break end
  end
 tcp:close()
end

and

-- TCP Send
function tcpbose(message)
 host, port = "192.168.0.101", 4999
  socket = require("socket")
  client = socket.tcp()
  clientConfusedettimeout(1)
  client:connect(host, port)
  clientConfusedend(message)
  client:receive()
  client:close()
end

The device in question can integrate Somfy RF courtain commands and IR as well. But we are facing a huge delay between pressing a push button and having the courtain moving (arround 10 seconds).
We are using event based scripts for that. By logs we've seen that the KNX telegram is quickly received by Spacelynk and the delay happens between the reception of the telegram and the script initialization (we´ve noticed by checking object timestamp and log events written on the first line of the script and another before the send message command). The 10 seconds happen between the reception of the telegram and the beginning of the script. (Socket connection TCP function and etc happen immediatelly).
The benchwork test had pratically only this funcion running and no KNX bus traffic apart from the blinds command telegram. The delay always happens. 
Can anyone help me out?
 
Thanks in advance.
Reply
#2
Can you provide a backup from that device?
Reply
#3
(18.03.2020, 15:32)admin Wrote: Can you provide a backup from that device?
Hi! Here it is..
Group address 0/1/1 activates the TCP function. Please check the timestamp when the telegram is sent and the timestamp for the alerts.

Thanks.

Attached Files
.gz   Project-Automatic_SpcLynk-2020.03.23-22.19.tar.gz (Size: 366.63 KB / Downloads: 11)
Reply
#4
You have some script code in common functions which gets executed when any script runs, including os.sleep(5) call. There should not be any code that's executed directly there. Remove it and your script will work without delays.
Reply
#5
(24.03.2020, 07:09)admin Wrote: You have some script code in common functions which gets executed when any script runs, including os.sleep(5) call. There should not be any code that's executed directly there. Remove it and your script will work without delays.
Thanks for the prompt reply.
So, the script with the  os.sleep is from a doorbird integration presented in the forum. Where would it be correct to run this doorbird script and not compromise performance?
Regards,
Reply
#6
Put it into a separate script and remove everything after "-- doorbird APP" from Common functions. Since there's script.disable(_SCRIPTNAME) at the end of the doorbird script it means that is should run only once and then it will automatically disable itself.

Further explanation: Common functions is a library which is loaded by every script. In your case all event scripts are delayed for at least 5 seconds because you have os.sleep(5) is Common functions. You also have a code that writes HTML to a file. Since this code is executed for every script you can quickly degrade internal SD card this way.
Reply


Forum Jump: