Trying to integrate Global Cache iTach WF2IR with LM-Ambient.
Scripting done with the help of example in openrb.com (http://openrb.com/2637-2/)
Still, no command is triggering to the Global Cache.
Also, checked the errors log in LM (no errors there) and commands testing with the iTest software by Global Cache (here, commands are triggering fine).
You are probably using Chrome which is copying spaces incorrectly. Copy script to any plain text editor like Notepad, then copy it from there to LM script editor.
01.07.2016, 09:50 (This post was last modified: 01.07.2016, 09:52 by AEK.)
(01.07.2016, 09:18)s.prathmesh Wrote: Okay. Now worked with Notepad.
But, the script not working and still not triggering command into Global Cache.
example from Russia:
code for event- based script
Code:
123456789101112
localsocket = require("socket")
localtcp = assert(socket.tcp())
tcp:connect(IP_adress, port); -- IP_adress: IP adress-- of GlobalCache-- port: port number of-- GlobalCache-- default port: 4998tcp:send(GC_Command); -- GC_Command: string to send to-- GlobalCachetcp:receive()
tcp:close()
example of command
Code:
1234567
DevIR05CmdH="sendir,1:1,1,37650,1,1,"; -- constant part of IR commandtcp:send(DevIR05CmdH ..
"341,171,21,21,21,21,21,64,21,21,21,21,21,21,21,21,21,21,21,64,21,64,21,21,21,64,21,64,21,64,21,64,21,64,21,64,21,21,21,21,21,21,21,64,21,21,21,21,21,21,21,21,21,64,21,64,21,
64,21,21,21,64,21,64,21,64,21,1520,342,85,21,3765\r");-- "\r" = "0D" (Hex) in LogicMachine.
Thanks all for the replies.
At times, Ambient gives commands on GC-WF2IR; but after continuous triggering of commands GC-WF2IR stops receiving the commands. As GC-WF2IR blinks LED alongside the port through which it sends commands, we know about its status/working.
So, after restarting GC-WF2IR/Ambient the problem solves for some time but again after continuous triggering we've to again reboot the devices.
What could be parameters we may be missing?
You have to send the socket close command to the receiving unit, otherwise each call opens a new socket, i believe global cache has max 8 socket connections.
Each connection has a timeout of 1 minute so if you don't send the socket close to the global cache it will block for x period (the socket relaese auto when the timeout is passed).
The tcp:close() only closes the server side connection.
If you are using this script http://forum.logicmachine.net/showthread...17#pid1617 then you should have error reports in Alerts tab when LM cannot connect/send commands. I haven't found a specific "close" command for GC, so maybe a better solution is to have a resident script which has a single connection that is always open. But then you have to take care of timeout disconnects from the GC itself.
Sorry I working with LM5 Reactor I/O and WF2IR.
after I using script: http://openrb.com/2637-2/ and using Put this into Common functions:"function sendircmd(cmd, ip, port)
local sock, res, err
sock = require('socket').tcp()
sockettimeout(3)
res, err = sock:connect(ip, port or 4998)
if res then
res, err = sockend(cmd .. '\r')
if res then
res, err = sock:receive()
else
alert('send failed: ' .. tostring(err))
end
else
alert('connect failed: ' .. tostring(err))
end
sock:close()
return res, err
end"
But I am still error after 8 times the same Mr. Erwin van der Zwart say.
01.12.2018, 12:17 (This post was last modified: 01.12.2018, 12:55 by Mr.D.)
Hi,
I have been running these scripts for more than a year, but now it seems like my TCP connection is no longer working.... I have done no changes to my network hardware, SpaceLynk scripts or Global Cache.
However, I can see that every time the scripts are triggered the load on the SpaceLynk goes from 0.3 to 3.xx so there is something wrong somewhere!
Any suggestions?
SOLVED:
For some reason my TCP port 4321 has stopped working so changing it to 4322 did the trick
Have no idea why this is the case....
I might have spoken to soon.
I have been running the resident script for a long time, and everything has been working as intended.
However, recently the spacelynk has stopped connecting to the Global Cache.
I have found that disabling the resident script for a couple of minutes, and then re-activating it, the connection seems to work again... it almost seems like there is an issue with timeout or spamming the global cache or an network issue?
As for network I use the Unifi Secure Gateway, Unifi Switch and Unify AC Pro... both spacelynk and GC are running on the same subnetwork.
I have the resident script running at a 30 seconds interval, I have also tried to changing this to 60 seconds, but after a couple of days it still stops working.