Web Events Driver

I’ve had a few requests for this driver lately, sorry I haven’t posted it before now.

This driver accepts connections on the main (master) controller on port 8080, and sets a variable with the sent command, and fires an event.

i.e. if you do a URL Get to the following address:

http://CONTROLLER_IP_ADDRESS:8080/MYCOMMAND

The Control4 ‘COMMAND’ variable will contain MYCOMMAND, and the ‘Command Received’ event will be fired.

In Control4 programming, you can program against the command name received in the COMMAND variable.

The driver can be found here:

webevents.zip

17 thoughts on “Web Events Driver

  1. Just like to say thanks for the free driver. I now have a c4 prowl notification when motion is detected in my birdhouse (raspberry pi with motion running). Thanks Ryan

  2. This doesn’t work on mine, I am on version 1.7 currently. Do I need to reset the controller? I have a HC-300.

  3. I am getting weird behaviour, on a HC300 test director I have no issues adding on 2.5.1 on a main HC800 I get “Add Item Error, unable to add”

    Have you seen that before?

    • Usually this indicates you have a version of ComposerPro that’s different than the system you’re running, and/or you have some project corruption.

  4. Any security issues by allowing this port to be internet facing? Should i change my root password on my controller? I’m using tasker to track when im home or not and would like to be able to fire events after i leave my home.

  5. Pingback: HomeKit for Control4 | Control 4 Driver Programming

  6. *yes*, there are probably security issues with this driver.

    I don’t *know* of any security issues, but I wouldn’t do it.

    It’s an incredibly simple driver, and I haven’t put any time into ensuring it is in any way secure.

    I wouldn’t personally put it on an internet facing port.

  7. Thanks for this driver, i was using it fine for a while then one day crashed my HC250 meaning it would simply keep rebooting (worked fine after removing the driver)
    Now i’ve narrowed it down to whenever i access the IPADDRESS:8080, it shows me the small webpage, then crashes director.
    I edited the driver to use a different port (8001) which seems to work. Something that is appearing in the debug is GET URL: [favicon.ico], after the command, is this required?

    • favicon.ico is your browser (Chrome or Firefox, etc.) asking for the ‘favorite’ icon from the website. It’s what you’d see in your browser’s tab for that site.

      You can just ignore that. The driver doesn’t take it into account.

      I’m not sure why you would be getting a reboot loop when accessing the driver using port 8080, glad to hear it’s working on 8001.

  8. Could this be updated to respond with a value? The home bridge HTTP plugin allows for a “status URL” and a “brightness URL”. Status URL expects 0 or 1 for off/on. Brlightness URL expects an integer value indicating brightness level. Would be really cool if we could configure a command to reply with the state of a particular light/dimmer/fan so that the HomeKit UI is properly updated.

  9. I went ahead and made the updates, if anybody is interested.

    1) I updated the driver to have a property for the web port. Since several of the C4 api calls are asynchronous, if multiple commands come into the driver quickly (like for setting scenes), then the driver gets confused and only processes the last command received. Thus, if you’re going to use this with HomeKit, it makes the most sense to have a one-to-one driver mapping between the HTTP driver and the devices you want to control. So we need to be able to have a property to set the HTTP port, since each driver needs a unique port.

    2) I updated the driver to have a RESPONSE variable that can be set to indicate the status of a C4 device. For lights, you can set it to 0 (off) or 1 (on) and for dimmers you can set it from 0 (off) to 100 (full on). This allows home bridge to keep the status of the devices in HomeKit in sync with the actual status of the C4 devices.

  10. Hi Ryan!

    My Controller ip is 192.168.1.10

    I downloaded your Web Event Driver, but it doesn’t work perfectly.

    It only works if i don’t use commands!

    I.e. http://192.168.1.10:8080/test -> Request is:
    Connection Successful
    Command: None

    Why does the command not work?
    I use Composer 2.8.2!

    Hope you can help me.

    Greets from Austria
    Wolfgang

  11. Thanks a lot for this driver! I have a “door station” device with a door bell button on it. It’s an IP device, so I was able to program it to hit a URL when that button is pressed, and then use one of the Control4’s relay to ring my actual physical doorbell. Very cool!

  12. I love the simplicity of this driver!
    One question: the “COMMAND” control4 variable – is this something I need to create as a variable name, or is there a globally significant Control4 “COMMAND” variable I can access from Composer?

Leave a Reply

Your email address will not be published. Required fields are marked *