DLM Posted July 4, 2014 Share Posted July 4, 2014 Hi guys!First time coding for Control4 and already have adapted a driver to a COMFORT II ULTRA alarm from Cytech, which uses a RS-232 connection to the Control4. But I have an issue with Log In because every time I make the connection for the first time, I need to execute the command in ComposerPro:C4:SendToSerial(1,tohex("03") .. "LI1234" .. tohex("0D"))I added the following in the beginning my code but I suppose it's not working:CMDS = { SIGNON1 = tohex("03") .. "LI1234" .. tohex("0D"),}Any thoughts or suggestions? Link to comment Share on other sites More sharing options...
RyanE Posted July 7, 2014 Share Posted July 7, 2014 Just putting a command in a Lua table (CMDS) does not ensure that the command will be executed at any particular point to the serial port. You probably want code in your OnBindingChanged for your serial binding ID (probably 1), where it sends the login command: function OnBindingChanged(idBinding, bIsBound) if (idBinding == 1) and (bIsBound == true) then C4:SendToSerial(1,tohex("03") .. "LI1234" .. tohex("0D")) endend That's of course just from my brain, so it may be incorrect, but that's where I'd start. RyanE Link to comment Share on other sites More sharing options...
DLM Posted July 14, 2014 Author Share Posted July 14, 2014 That worked just good RyanE, and for that I thank you Now I'm trying to convert this driver from RS-232 to an ethernet connection and I'm having some trouble doing it. Just one more connection before "close" this topic:Considering I'm using an ethernet connection what should I use from the two solutions:- make the login executing the command in ComposerPro C4:SendToSerial(1,tohex("03") .. "LI1234" .. tohex("0D"))*- use OnBindingChanged function*Adapted to SendToNetwork or similiar Link to comment Share on other sites More sharing options...
RyanE Posted July 14, 2014 Share Posted July 14, 2014 You shouldn't ever require the installer to type in a command in ComposerPro to cause your driver to start working. If you were to do that, what happens when the device and Control4 controller get rebooted? The device would be uncontrollable until the installer typed the login command in with ComposerPro. Your driver should handle it, just like it does for serial. RyanE Link to comment Share on other sites More sharing options...
DLM Posted July 15, 2014 Author Share Posted July 15, 2014 If you were to do that, what happens when the device and Control4 controller get rebooted? For when there is a power failure I did this:for Reboot in string.gmatch(strData, "V?FE071") do C4:SendToSerial(1,tohex("03") .. "LI1234" .. tohex("0D"))endBut that's not the point because I totally agreed with when you say one shouldn't ever require the installer to type in a command in ComposerPro to cause a driver to start working.My question above was made because I read on "DriverWorks SDK 2.5.3 API Reference Guide".pdf about OnBindingChanged: RemarksProtocol drivers do not get OnBindingChanged notifications for AV and Room bindingsbeingbound, only *control*-type bindings (Serial, IR, etc.). It is intended to be usedspecifically for when serial bindings are made, so the driver knows it can sendinitialization, etc. to the now-connected device. So from what I'm reading, this will not work with a Network Connection-type binding, is that correct? Link to comment Share on other sites More sharing options...
jsparkman Posted July 15, 2014 Share Posted July 15, 2014 This isn't really the proper location for the thread, but reference OnConnectionStatusChanged and OnDriverInit. You must account for the controller rebooting, not just the device. Link to comment Share on other sites More sharing options...
CFUG Posted July 15, 2014 Share Posted July 15, 2014 ^Why not? isn't this the "helping hands" forum? Lurkers are also welcomed. Link to comment Share on other sites More sharing options...
DLM Posted July 20, 2014 Author Share Posted July 20, 2014 Well... RyanE solution about OnBindingChanged worked really well on the serial driver.But now I'm working with the same driver with an Ethernet connection, and I'm having trouble solving this problem when the energy fails, what functions should I include to correct this problems? Link to comment Share on other sites More sharing options...
DLM Posted July 21, 2014 Author Share Posted July 21, 2014 Sorry for the double post but I might found the right function, but I'm not getting right because login command via ComposerPro is still required.I coded the followingfunction OnNetworkBindingChanged(idBinding, bIsBound) if (idBinding == 6001) and (bIsBound == true) then C4:SendToNetwork(6001, 1001, tohex("03") .. "LI1234" .. tohex("0D")) endendSome notes that may help you to help me.6001 - Id of the network binding1001 - Port number of the UCM Ethernet moduleLogin command required: C4:SendToNetwork(6001, 1001, tohex("03") .. "LI1234" .. tohex("0D")) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.