Jump to content
C4 Forums | Control4

Chowmain - Generic TCP Command Driver


alanchow

Recommended Posts

1 hour ago, jfh said:

I want to issue a telnet command to a device that does not require login.  Can I use this driver to do it?  If so, how?

If its a singular command upon sending it as a TCP command will be fine.  Just end it with \r\n

Link to comment
Share on other sites

  • 1 month later...

On 7/14/2020 at 6:47 PM, zaphod said:

Ok, first feature request on the incoming http get.  Would it be possible to pass parameters?  It would be great to be able to pass numeric , text or boolean values into C4, as in:

http://192.168.1.12:52690/OfficeOn?level=92
http://192.168.1.12:52690/SetVolume?level=32
http://192.168.1.12:52690/TeslaChargeStatus?status=charging

Obviously you would want to then be able to use these values in C4, presumably as a variable.

 

I have just started using this driver and seems very impressive.  Did anything come of this feature request? Would certainly reduce the amount of programming I need to do.  If not, I am thinking of multiple commands inside a short period to reduce the programming load.

Link to comment
Share on other sites

There is a way to do this if you have the Homebridge driver by @Joshua Pressnell.  Homebridge creates a web API of a sort on port 8070. So the command http://192.168.1.12:8070/38/level/22 will set the level to 22 on device 38 for my controller which is at 192.168.1.12.  Here is the JSON info for this device from the Homebridge driver Lua screen:

{
  "accessory":"Control4",
  "name":"Office Pots",
  "service":"Dimmer",
  "base_url":"http://192.168.1.12:8070/38",
  "has_level_control":"yes",
  "switchHandling":"realtime",
  "brightnessHandling":"realtime",
  "refresh_interval":900000,
  "manufacturer":"Control4",
  "model":"ldz-101-w"
},

Also http://192.168.1.12:8070/38/on or http://192.168.1.12:8070/38/off will turn the dimmer on and off.

The main purpose of the Homebridge driver also allows you to control C4 devices from Apple Homekit, including Siri.

Link to comment
Share on other sites

  • 2 weeks later...

Has anyone got any experience with modbus TCP? I am wanting to change register 2703 on unit 100 at IP address 192.168.0.27 to, say, 200.  This is a Victron setup which allows communication via modbus TCP (which I had never heard of until a few weeks ago).  The register is writeable...

I would assume that this driver would allow me to do this? Does anyone know what I would enter into this driver and would I need more information?

I have not got very far investigating via google!

Link to comment
Share on other sites

11 hours ago, South Africa C4 user said:

Has anyone got any experience with modbus TCP? I am wanting to change register 2703 on unit 100 at IP address 192.168.0.27 to, say, 200.  This is a Victron setup which allows communication via modbus TCP (which I had never heard of until a few weeks ago).  The register is writeable...

I would assume that this driver would allow me to do this? Does anyone know what I would enter into this driver and would I need more information?

I have not got very far investigating via google!

Try these http://www.yatundev.eu/drivers/modbus-rtu-driver-control4 

Link to comment
Share on other sites

  • 4 weeks later...
  • 4 weeks later...
On 11/3/2020 at 1:46 AM, jlemonakis said:

Forwarding question from another topic that was asked previously in this thread. Is there any way to send POST commands using bearer tokens like OAUTH etc? 

@alanchow Any advice on how to do this? It would be great to know how this could be accomplished.

Link to comment
Share on other sites

On 11/29/2020 at 2:10 PM, alanchow said:

Sorry this driver does not support custom headers

Ok thanks. Can you please consider this a feature request as it would be quite helpful, even if one had to manually update tokens on a periodic basis.

Link to comment
Share on other sites

1 hour ago, zaphod said:

Ok thanks. Can you please consider this a feature request as it would be quite helpful, even if one had to manually update tokens on a periodic basis.

Don't think you want to do that.  Most OAuth2 based systems require token exchanges and token refreshes periodically.  Most of the ones i have seen range from hourly to at max once a month.  Most of them are weekly.

Honestly if it gets to that stage a real driver should be written.

Link to comment
Share on other sites

The specific instance that I am thinking is the Oauth token for a Tesla.  This resets every 45 days. 

I currently use the Generic IP driver to hit an Apache server running on a Raspberry Pi. That then sends the commands off to the Tesla servers to do things like start the car charging, turn on climate, or get charge status. So the Pi gets a new token every 45 days.  If I could send tokens from the generic IP driver then I wouldn't need the intermediate Apache server on the Pi.

Link to comment
Share on other sites

  • 4 weeks later...

The Envy from madvrlabs serves as a TCP server, using port number 44077.

 

You can send Envy commands via ASCII text (UTF8) in the following format:

SomeCommand Some Parameters ⏎
Parameters are separated by a space character. If a parameter has spaces inside, you can use "" to mark

the start and end of a parameter. Valid ⏎ (return) characters are 0x0D, 0x0A or 0x0D 0x0A

What do I have exactly to enter under "command" in the Device specific command section to e.g. to send the command "standby"?

Only "Standby" does not work.

Link to comment
Share on other sites

  • 2 months later...
2 hours ago, Bmwbball88 said:

is it supported to use HTTP params for inbound GET?

IE

ip:57329/GoodNight&secretkey=2348723948

 

then in the programming we can check to make sure the secret key is correct?

No we do not capture any URL parameters.  It is purely used to fire basic events if it hits a pre-defined URL endpoint.

Link to comment
Share on other sites

  • 4 months later...

I love this driver and use it for several things at my home  (Moip switching, Event ghost) but can't seem to get it working for Blue Iris.  I need to send a command to BI to switch camera group on the console.

http://blueirisip:81/admin?user=user&pw=password&console=[camera group] works from any web browser but i can not replicate from the driver.

Blue Iris does not support the http://user:password@blueirisip:81/admin?console=[camera group] format.

I've tried almost every possible combination.  Anyone have any ideas?

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...

How do I duplicate the command:

curl -d '' "http://192.168.1.161:8060/keypress/PowerOn"

in the Generic TCP driver?  I have tried using both the HTTP POST command and the generic TCP command in the following ways:
Send HTTP POST to http://192.168.1.174:8060 with data: keypress/home
Send generic TCP command: keypress/PowerOn to host 192.168.1.174 on port 8060

But neither of those appear to work.  But this HTTP command does work in a BASH prompt, and the iOS app iCurlHTTP.

FYI - I am having some trouble with a Roku TV driver right now so I am trying to use this http command to turn on/off a TV.

Link to comment
Share on other sites

12 hours ago, zaphod said:

FYI - I am having some trouble with a Roku TV driver right now so I am trying to use this http command to turn on/off a TV.

Are you using Control4's Roku TV driver, or a 3rd-party one?

You could add Control4's Roku TV driver, and use it to send the PowerOn command.  The 'On' command of the TV proxy will send PowerOn.

RyanE

Link to comment
Share on other sites

  • 3 months later...

Hi Alan,

 

Not sure if this is the place to ask this, but I think I need a little help. I'm trying to trigger a server that feeds three projectors. The only commands I need to send are:

preset_1

preset_2

off

I did this as a Generic TCP command in Programming. wrote the command as ascii:

off/r/n

The guys looking after the server say their server received:

6f 66 66 2f 72 2f 6e

which is a literal translation. But what they actually need is:

6f 66 66 0d

So I'm now sending that as hex, but now they are getting nothing. Can you help?

 

Many thanks in advance,

Rex

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.