LM Ambient with GC-WF2IR - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: LM Ambient with GC-WF2IR (/showthread.php?tid=335) Pages:
1
2
|
LM Ambient with GC-WF2IR - s.prathmesh - 01.07.2016 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). RE: LM Ambient with GC-WF2IR - admin - 01.07.2016 This example comes from our partners, we haven't tested it locally. I've modified it to provide error reporting which can be seen in Alerts tab. Put this into Common functions: Code: function sendircmd(cmd, ip, port) This goes into event script, make sure to modify cmd and ip: Code: cmd = 'sendir,1:1,1,37650,1,1,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' RE: LM Ambient with GC-WF2IR - s.prathmesh - 01.07.2016 Not able to save the script because of the error " Lua syntax error at line 2: '=' expected near '�' " Line 2 is " local sock, res, err " RE: LM Ambient with GC-WF2IR - admin - 01.07.2016 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. RE: LM Ambient with GC-WF2IR - s.prathmesh - 01.07.2016 Okay. Now worked with Notepad. But, the script not working and still not triggering command into Global Cache. RE: LM Ambient with GC-WF2IR - AEK - 01.07.2016 (01.07.2016, 09:18)s.prathmesh Wrote: Okay. Now worked with Notepad. example from Russia: code for event- based script Code: local socket = require("socket") example of command Code: DevIR05CmdH="sendir,1:1,1,37650,1,1,"; -- constant part of IR command RE: LM Ambient with GC-WF2IR - admin - 01.07.2016 Ok, it looks like GlobalCache does not work without extra receive on the socket. Examples above should work now. RE: LM Ambient with GC-WF2IR - Erwin van der Zwart - 01.07.2016 Hi, Your first script should work but i think you just missed the carrier return \r on the end of your cmd send string Must be: cmd = 'sendir,1:1,1,37650,1,1,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' BR, Erwin RE: LM Ambient with GC-WF2IR - admin - 01.07.2016 It's added during send: Code: res, err = sock:send(cmd .. '\r') RE: LM Ambient with GC-WF2IR - s.prathmesh - 11.07.2016 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? RE: LM Ambient with GC-WF2IR - Erwin van der Zwart - 11.07.2016 Hi, 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. BR, Erwin van der Zwart RE: LM Ambient with GC-WF2IR - admin - 12.07.2016 If you are using this script http://forum.logicmachine.net/showthread.php?tid=335&pid=1617#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. RE: LM Ambient with GC-WF2IR - Anh Nguyen - 22.11.2017 Hi every body! 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. Help me Thank you RE: LM Ambient with GC-WF2IR - admin - 22.11.2017 1. Create resident script to keep TCP connection open and handle reconnect, change IP as needed: Code: if not udpserver then 2. Add to common functions: Code: function irsend(cmd) 3. Call from event scripts: Code: irsend('sendir,1:1,1,37650,1,1,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') RE: LM Ambient with GC-WF2IR - Anh Nguyen - 24.11.2017 Hi Admin ES Thank you so much RE: LM Ambient with GC-WF2IR - Mr.D - 01.12.2018 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.... RE: LM Ambient with GC-WF2IR - Mr.D - 17.12.2018 Hi, 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. Any suggestion? RE: LM Ambient with GC-WF2IR - admin - 17.12.2018 Try this: Code: cmd = udpserver:receive() There's no need to set large sleep for this script, it should work correctly with 0 sleep time. RE: LM Ambient with GC-WF2IR - Mr.D - 17.12.2018 (17.12.2018, 12:22)admin Wrote: Try this: I just add this part to end of the existing script? And I should set the interval sleep to 0? RE: LM Ambient with GC-WF2IR - admin - 17.12.2018 Basically you need to add collectgarbage('collect') after tcpsend(cmd). You can set sleep time to 0. |