thegizzard Posted June 21, 2012 Share Posted June 21, 2012 Is there any way to trigger an action based on a URL being accessed?For example, connect a contact sensor to a specific URL.The use case I have is a camera with an "alarm" function that can hit a user specified URL. If I can get C4 to recognize a URL, I can integrate the camera as a sort of motion detector in my system.Any thoughts? Link to comment Share on other sites More sharing options...
C4RVA Posted June 21, 2012 Share Posted June 21, 2012 Post the specific URL you need to hit and a little more information and I should be able to make that fairly easily. It would be much easier to do this as an action from a driver rather than trying to do a binding like you described. Post some more info and I'll work on it this weekend. Link to comment Share on other sites More sharing options...
thegizzard Posted June 21, 2012 Author Share Posted June 21, 2012 Let me try to explain better. If this were to be implemented in a driver, it would provide a number of URLs that could be tied to actions in Composer HE.for example, let's say the name of the driver was C4OnClick. Perhaps the driver has 4 URLs. So if in my Project the C4OnClick driver was called C4OnClick1 the URLs might be:URL1: http://192.168.1.100/C4OnClick1_action1.phpURL2: http://192.168.1.100/C4OnClick1_action2.phpURL3: http://192.168.1.100/C4OnClick1_action3.phpURL4: http://192.168.1.100/C4OnClick1_action4.phpThis assumes the URLs are on my home controller running director, which could be 192.168.1.100In composer I would want to tie each of those URLs to a different action.For example,When C4OnClick1.URL1 is pressed turn on LightWhen C4OnClick1.URL2 is pressed turn off LightFollow me?If a driver like this could be written, it would be the basic building block for creating custom web based interfaces. Imagine if the driver allowed for an unlimited or user configured number of URLs. Then you would start to see some really sick skins created by a the user community.Again, in my simple use case I want the camera near my garage to trigger the garage light and display its image on my touchscreens. The camera has the option to call a URL when motion is detected, so in this example I would put http://192.168.1.100/C4OnClick1_action1.phpMake sense? Link to comment Share on other sites More sharing options...
pstuart Posted June 21, 2012 Share Posted June 21, 2012 Well,You are going about it the wrong way. First you would need to send the requests to Control4 in a manner in which a driver can receive them. Which is their psuedo SOAP XML format.A Controller would have to receive that request in some manner.So the burden is on the web server to send the commands, not the other way around. Look in the File Library above for some of the java examples for hints as to how to do this.Frankly, no need for a driver to do this, just need to interact with the controller via the proper protocol. Link to comment Share on other sites More sharing options...
dgbrown Posted June 21, 2012 Share Posted June 21, 2012 Why not pass the command in on the query string of the url ? http://mycontroller.com/command_trigger.php?command=someaction and make it generic. Expose command as a var in composer and do your programming off of that. Link to comment Share on other sites More sharing options...
C4RVA Posted June 21, 2012 Share Posted June 21, 2012 Dgbrown certainly has the right idea. I like the idea of using an http get request to pass a variable. I'm going to play with this idea this weekend. Link to comment Share on other sites More sharing options...
RyanE Posted June 21, 2012 Share Posted June 21, 2012 I've got a driver here somewhere that does that.Please hold.RyanE Link to comment Share on other sites More sharing options...
dgbrown Posted June 21, 2012 Share Posted June 21, 2012 Christmas in June Link to comment Share on other sites More sharing options...
thegizzard Posted June 21, 2012 Author Share Posted June 21, 2012 How's the saying go? Ask and ye shall receive? Link to comment Share on other sites More sharing options...
thegizzard Posted June 21, 2012 Author Share Posted June 21, 2012 Thanks in advance Ryan. Link to comment Share on other sites More sharing options...
pstuart Posted June 21, 2012 Share Posted June 21, 2012 If it works like the OP wants, that driver could be very cool....Out of curiousity, what on the controller is able to receive HTTP / port 80 requests and process them? Is it running a web server? Or is director able to receive HTTP requests via a driver?Interesting.... Link to comment Share on other sites More sharing options...
RyanE Posted June 21, 2012 Share Posted June 21, 2012 I use the Server Sockets functionality to listen on a port, then parse it as HTTP.The OP doesn't say what version they're on, so it's certainly possible this driver won't work for them, but it should work on 2.1+ systems.Keep in mind, this hasn't been security tested, and was not written with any security in mind, so I don't suggest you expose this on the Internet, but it should work fine to trigger events via URL Get.RyanE Link to comment Share on other sites More sharing options...
RyanE Posted June 21, 2012 Share Posted June 21, 2012 Oh, and it's not on port 80. Port 8080.Control4 already runs a webserver on port 80, which is used during updates.RyanE Link to comment Share on other sites More sharing options...
thegizzard Posted June 21, 2012 Author Share Posted June 21, 2012 Nice!! Link to comment Share on other sites More sharing options...
dgbrown Posted June 21, 2012 Share Posted June 21, 2012 RyanE - I pulled the driver down and will definitely give it a look when I get a few minutes over the weekend. Thanks !! Link to comment Share on other sites More sharing options...
RyanE Posted June 21, 2012 Share Posted June 21, 2012 No problem. I already had it, for a partner request, and just cleaned it up a bit.Let me know if you have any questions.RyanE Link to comment Share on other sites More sharing options...
pstuart Posted June 23, 2012 Share Posted June 23, 2012 Awesome driver! Works great. Link to comment Share on other sites More sharing options...
RyanE Posted June 23, 2012 Share Posted June 23, 2012 Glad it's working for you.RyanE Link to comment Share on other sites More sharing options...
livingworks Posted August 21, 2012 Share Posted August 21, 2012 Hi Ryan, I've been looking for something like this for ages!Need something that allow C4 to listen to a port.Would you be so kind as to upload this or send me a copy to play around with?many thanks in advance!Herb Link to comment Share on other sites More sharing options...
livingworks Posted August 21, 2012 Share Posted August 21, 2012 Sorry, just spotted the link.Got it, and it works great.Thanks Ryan! Link to comment Share on other sites More sharing options...
msgreenf Posted April 13, 2013 Share Posted April 13, 2013 The download link no longer works. Does anyone have this? Link to comment Share on other sites More sharing options...
dgbrown Posted April 14, 2013 Share Posted April 14, 2013 If the download link doesn't work the author has either overlooked this or does not want it distributed any more. I would wait to hear back from the source. Link to comment Share on other sites More sharing options...
seth_j Posted April 15, 2013 Share Posted April 15, 2013 Luadrivers.com has one now. Link to comment Share on other sites More sharing options...
RyanE Posted April 16, 2013 Share Posted April 16, 2013 Here's the driver that was previously posted:http://untestedhacks.com/2013/web-events-driver/RyanE Link to comment Share on other sites More sharing options...
Sbutter Posted April 16, 2013 Share Posted April 16, 2013 Can these be used remotely with port forwarding? Would you just replace controller ip with remote up? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.