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

34 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. Great driver! Answered a lot of questions for me about c4 sockets. Is there any way to have my web-site (via PHP) outside of the local network send a command without forwarding ports on my router? I’m trying to send help documents to my clients that can be popped up on a touchscreen.

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

  6. Hello Ryan,
    Have you had any more development on the Web Events Driver ?
    I have just had Control4 installed in my home and wanted to send HTTP commands from EventGhost to Control4.

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

  8. RyanE, thanks for all your Control4 work I’ve seen here and elsewhere.

    I just had my dealer install WebEvents on my HC800 running C4 2.8.0. When I use my browser to invoke WebEvents, the webpage returned is as expected (the command string I sent is shown as the “Command”). The C4 “Command Received” event is fired but, when I look at the C4 list of variables, the COMMAND variable is never created. So I created three C4 string variables “COMMAND”, “Command” and “command” but, according to the variable values shown in C4, none of those variables are updated following a “Command Received” event. So I’m stuck and wondering if you have any suggestions? I’ll understand if you don’t reply. 🙂

    Joe

  9. *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.

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

  11. Thanks for the driver. However, I am not getting any response when submitting a url. My HC800, OS 2.8 does not seem to be “listening” on TCP port 8080. I have edited to try other ports. Each with equal failure.
    I have since updated to 2.8.1 and Pro 281. Each time I edit the driver, I restart composer. Still no response. It almost seems like the driver never loads. Can you direct me to any areas to trouble shoot?

  12. A little help with programming in Composer. I have the driver working to send one command, how do I program it to send different commands? Under programming in Composer, when I select the driver and see “Command Received”, how do I set/add additional commands? Thanks

  13. I installed the driver, but it doesn’t appear in “Manage Driver” in Composer 2.8.1. I am confident it’s installed because if I try and re-install it, it will tell me it’s already instaleld and the same version.

    Thoughts for me?

  14. Axel and RyanE, how can I save to c4i after editing the port to 8001 in driverworks, it only allows me to save to c4zproj format.
    The driver opens up 8080 port on controller but gets no response and the web page keep loading
    Thanks!

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

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

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

  18. 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!

  19. 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?

  20. In the Netherlands we use Smart Meters for electricity and gas usage, using a Raspberry Pi it can report current usage and show monthly/daily usage.

    Could this driver be used to collect this data for Control4 and then build a gauge interface arround this driver or would you recommend doing it a different way?

    Smart meter has a P1 port (rj11 connection) can send data like this:
    1-3:0.2.8(40)
    0-0:1.0.0(XXXXXXXW)
    0-0:96.1.1(45303XXXXXXXXXXXXXXXXX)
    1-0:1.8.1(000018.947*kWh)
    1-0:1.8.2(000000.000*kWh)
    1-0:2.8.1(000000.714*kWh)
    1-0:2.8.2(000000.000*kWh)
    0-0:96.14.0(0001)
    1-0:1.7.0(00.860*kW)
    1-0:2.7.0(00.000*kW)
    0-0:17.0.0(999.9*kW)
    0-0:96.3.10(1)
    0-0:96.7.21(00006)
    0-0:96.7.9(00005)
    1-0:99.97.0(1)(0-0:96.7.19)(000101000001W)(2147483647*s)
    1-0:32.32.0(00000)
    1-0:32.36.0(00000)
    0-0:96.13.1()
    0-0:96.13.0()
    1-0:31.7.0(004*A)
    1-0:21.7.0(00.856*kW)
    1-0:22.7.0(00.000*kW)
    0-1:24.1.0(003)
    0-1:96.1.0(473XXXXXXXXXXXXXXXXXXXXXXXXX)
    0-1:24.2.1(140125220000W)(00008.116*m3)
    0-1:24.4.0(1)
    !04F0

    Thanks for any pointers!
    Colin

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.