Jump to content
C4 Forums | Control4

Way to control Control4 via API etc.


Guswyl

Recommended Posts


The Homebridge C4 driver also gives you an API where you can turn lights and other devices via simple HTTP calls. But this can only control some devices.  The Generic TCP driver now also can accept HTTP commands as well as send them.

You can always create "virtual" lights and then turning on or off the virtual lights could control AV devices, etc.

Link to comment
Share on other sites

17 hours ago, zaphod said:

The Homebridge C4 driver also gives you an API where you can turn lights and other devices via simple HTTP calls. But this can only control some devices.  The Generic TCP driver now also can accept HTTP commands as well as send them.

You can always create "virtual" lights and then turning on or off the virtual lights could control AV devices, etc.

Wonder if I could do that to control my shades...genius lol. 

Link to comment
Share on other sites

  • 3 months later...
4 hours ago, zaphod said:

There seems to now be an API for C4 in OS3.  Here is one way to get at it:  https://github.com/lawtancool/pyControl4

It's basically the API that the mobile apps use, you can trigger anything the mobile apps can do.

However there is no real time feedback of changes to the system. For example if someone turns a light on you won't be told via the API. It seems that the feedback the apps get is by a different system.

I was a day into writing a desktop app to control my system until I hit the problem of either having to poll every couple of seconds while the app was in the foreground or not getting the status updated.

If anyone knows how to receive the events feed I'd love to know.

Link to comment
Share on other sites

11 hours ago, zaphod said:

PyControl4 seems to have code for controlling lights.  Can you control media as well?

PyControl4 is just a lightweight wrapper for the Web API, you can use any language to make the http requests.

Basically you authenticate using your my.control4.com account, then get a token, you then use this to get a token for the director. Then you can send any command you want to the director.

Easiest way to work out what happens is to run a proxy like burp or zap, setup your phone to proxy requests through it, then just run the app and see all the requests on the proxy.

As I said the downside is that you don't see the status changes coming back, with a sniffer you can see they come through the os notification mechanism which is going to be really hard (maybe impossible) to emulate.There is a websocket interface on the controller (using socket.io format) which does send these, but you need to authenticate to it with the root password, which is easy on 3.1.0, but with the changes for this in later versions its going to be quite a bit of work to get around.

Link to comment
Share on other sites

4 hours ago, niallel said:

 

As I said the downside is that you don't see the status changes coming back, with a sniffer you can see they come through the os notification mechanism which is going to be really hard (maybe impossible) to emulate.There is a websocket interface on the controller (using socket.io format) which does send these, but you need to authenticate to it with the root password, which is easy on 3.1.0, but with the changes for this in later versions its going to be quite a bit of work to get around.

 Not sure what you mean. Pycontrol4 was written as an integration for Home Assistant. Entity state is most certainly being updated in real time. I change dimmer level with keypad or c4 app, that shows up in Home assistant. Or perhaps I’m missing your point. 

Link to comment
Share on other sites

4 hours ago, niallel said:

PyControl4 is just a lightweight wrapper for the Web API, you can use any language to make the http requests.

Has C4 ever released any documentation on this API or is it the typical case of having to reverse engineer the whole thing by sniffing the phone app.

Link to comment
Share on other sites

On 2/13/2021 at 3:01 PM, wnpublic said:

 Not sure what you mean. Pycontrol4 was written as an integration for Home Assistant. Entity state is most certainly being updated in real time. I change dimmer level with keypad or c4 app, that shows up in Home assistant. Or perhaps I’m missing your point. 

I think if you take a look you will see that even though the same person wrote pycontrol4 and homeassistant-control4 they are different.

https://github.com/lawtancool/homeassistant-control4 requires you to use a driver loaded on control4 for the communication.

Link to comment
Share on other sites

On 2/13/2021 at 3:38 PM, zaphod said:

Has C4 ever released any documentation on this API or is it the typical case of having to reverse engineer the whole thing by sniffing the phone app.

I think it's just reverse engineering. It would be nice if they released an officially supported API.

Link to comment
Share on other sites

1 hour ago, niallel said:

I think if you take a look you will see that even though the same person wrote pycontrol4 and homeassistant-control4 they are different.

https://github.com/lawtancool/homeassistant-control4 requires you to use a driver loaded on control4 for the communication.

Hmmm, I just tried it without the driver and it updated the status on home assistant. 

After looking I was referring to the wrong homeassistant driver, the right one is hass-control4. This does use pycontrol4, the reason it updates the status on home assistant is that home assistance polls the devices every CONF_SCAN_INTERVAL.

So C4 doesn't send the update via an API, you need to poll to find out when changes happen. So it's going to put an additional load on the director.
If there is another way of it sending the info (apart from listening to the SOAP on port 5020) it would be good to know.

Link to comment
Share on other sites

I think it happens using an app notification service. I can't remember which one now, but I did a packet capture to my phone and there was data from an IP address that I wasn't able to identify (no reverse dns for it, and but I didn't dig further as to looking who owned the address).
Secondly, it definitely comes from the internet, not from the controller. I verified this by blocking inbound internet to the phone just before I switched a light on - there is no status update in the app.

Link to comment
Share on other sites

We also have a web based tool which allows cloud based control of C4.  You can use it to embed 1 way or full 2 way control into a custom web page.  2way control can give you the navigator list manager, or you can embed specific commands or status as custom buttons.

Video:  

 

 

Docs:  https://splash-tiles.com/help/reference.php

SplashTiles and the corresponding C4 driver are all free.  If you use it a lot, we do recommend you upgrade to the "lite" package which is $25/yr.

Link to comment
Share on other sites

  • 9 months later...

We have to integrate one Control4 EA3 with Dali4 Net lighting system to control from Control4 touch screen. When we discussed with the lighting engineers, they just need a document from Control4 that shows how to integrate with control4 system with any standard popular protocol for integration, for example: MQTT, REST API, WebSocket, Modbus...etc

So, kindly share API documentation or a tutorial on how can they integrate (lighting) with your devices or any document that describes how can they integrate with the control4
system through any popular standard protocol for IoT device

 

Link to comment
Share on other sites

1 hour ago, MerginWise said:

So, kindly share API documentation or a tutorial on how can they integrate (lighting) with your devices or any document that describes how can they integrate with the control4
system through any popular standard protocol for IoT device

You do realize that this is a user forum, not a forum run by Control4?  Many of the things you are asking for do not officially exist.  What has been developed, like MQTT, WebSocket has been developed by third parties and don't count on it not being broken in the future.

Link to comment
Share on other sites

6 hours ago, MerginWise said:

We have to integrate one Control4 EA3 with Dali4 Net lighting system to control from Control4 touch screen. When we discussed with the lighting engineers, they just need a document from Control4 that shows how to integrate with control4 system with any standard popular protocol for integration, for example: MQTT, REST API, WebSocket, Modbus...etc

So, kindly share API documentation or a tutorial on how can they integrate (lighting) with your devices or any document that describes how can they integrate with the control4
system through any popular standard protocol for IoT device

 

Unfortunately, it isn't that easy, and there is no straightforward tutorial. Control4 will still require a custom driver to translate between those protocols and control4. Websockets and such is just a way to communicate (like using paper, or speaking). But you need a driver to translate the language/words.

There's no step by step to writing the driver. It could be worthwhile recommending the manufacturer contacts chowmain software for a quote to write that driver.

Also, If they want the control4 API, this info is fairly accessible online, however, unless they have an experienced control4 developer on staff, it will likely be cheaper (and they'll have far better results) to get it professionally developed (before I started working for chowmain, I wrote my own lighting driver. And so I can tell you that it takes months. We're considering releasing our own comparable driver now and we're not going to even use that code as even a year of experience produces far better code).

Link to comment
Share on other sites

34 minutes ago, MerginWise said:

Hi sir, 

Is there any compatible driver of Dali 4 net  (Lighting Driver) is available Please refer to me

 

Who is this "sir" you keep referring to? This is a forum that is entirely independent from Control4 and run by users and dealers. 

If you need to work with Control 4 in getting a driver developed, reach out to them directly instead of posting here. 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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