Jump to content
C4 Forums | Control4

Action on URL ?


Recommended Posts

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


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

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.php

URL2: http://192.168.1.100/C4OnClick1_action2.php

URL3: http://192.168.1.100/C4OnClick1_action3.php

URL4: http://192.168.1.100/C4OnClick1_action4.php

This assumes the URLs are on my home controller running director, which could be 192.168.1.100

In composer I would want to tie each of those URLs to a different action.

For example,

When C4OnClick1.URL1 is pressed turn on Light

When C4OnClick1.URL2 is pressed turn off Light

Follow 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.php

Make sense?

Link to comment
Share on other sites

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

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

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

  • 1 month later...
  • 7 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.