Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple HTTP Call to Device from CQC
#1
Does a driver exist that will simply allow me to send a URL to a device? I don't care if I get any sort of response, I just want to have an action via a URL that will be sent to the other device's web server.

I looked over the HTTP Trigger driver and the HTTPClient class. It seems the former is a listening protocol from CQC's point of view (I want CQC to send the URL, not receive it), and the latter is just a function of sending a GET or POST within the context of a driver.

Do I have to write a driver to accomplish my goal?

Thanks.
Reply
#2
You wouldn't have to write a driver, a CML macro would serve the purpose and you could just invoke that from your action. I think I have some examples around, so let me look...
Dean Roddey
Explorans limites defectum
Reply
#3
That would be great. My mind kept going to "wget" and how I would do this elsewhere, on Linux, etc... the native CML didn't occur to me.

Thanks so much.
Reply
#4
Here you go. Import this package. It will create the macro \User\DoHTTPGet. You run it like this:

Code:
If (MacroEng::RunMacro(MEng.User.DoHTTPGet, urltoget LVar:ResCode))
   // It worked
Else
   // It failed
EndIf;

So you pass in the URL to get, which must start with http, i.e. be fully qualified and be fully pre-escaped, so any spaces or special chars have to be escaped. Put it into a browser and let it expand it if you need to and use that expanded version. You can pass query parameters of course, if you need to pass values to the target.

If it returns true, it successfully did the HTTP operation, else it failed to do it. If it works, then it will put the HTTP result code into the LVar:ResCode (or whatever you want to call it) variable, so you can test it to see if it is 200, which means that the transaction was successful from the server's point of view.


Attached Files
.cqcmacropack   DoHTTPGet.CQCMacroPack (Size: 732 bytes / Downloads: 11)
Dean Roddey
Explorans limites defectum
Reply
#5
Excellent, will try this out later. Truly appreciate the quick response; pool season goes by way too fast here and this should work quite nicely.
Reply
#6
How hard would it be to add this functionality to the existing HTTP driver. Just a single write field that has exactly the same rules as the macro..

Alternatively, a new driver much the same as the generic serial driver where you can write anything to the field and it gets sent out.

Mick
Mykel Koblenz
Illawarra Smart Home
Reply
#7
There could be a generic HTTP pass-through driver easily enough I guess.
Dean Roddey
Explorans limites defectum
Reply
#8
Worked perfectly and passed the wife test on the first try. Thanks again.

[Background if anyone cares: I purchased CQC initially to control my Yamaha RX-A3020 to Nuvo GC with MPS4-E interoperability. Since I had a dedicated 9.2 setup in the basement, I had all the speakers I needed and didn't want to add another pair of overheads; I have an unamplified zone on the Nuvo connected to an audio zone on the Yamaha and needed the automation for that to happen seamlessly over IP (power on receiver and switch input when Nuvo keypad for zone 3 power on; and the reverse).

I have a sizable investment in Z-wave (Vera2 and VeraLite with about 35 devices between them). I wanted the pool light (controlled by an Intermatic PE653, along with the heater and pump) to turn on when I enabled the zone 8 pool keypad on the Nuvo, and use luup to determine if it's day or night when the scene is triggered, so as to only light at night.

As you can control any scene or device with HTTP GET on the Vera, this piece is invaluable, especially since there doesn't appear to be any integration between Nuvo and Vera.

I plan on playing with JSON w/ XBMC next; screen notifies should be a piece of cake, but I'm sure other cool stuff will follow.]

Take care.
Reply
#9
Digging up the past. I've tried System:HTTPGet and I've tried the included macro. I've escaped the special characters and I've urlencoded the URL however it will not pass along a basic auth of format http://<user>:<pass>@<url>

Is there some other method to pass basic auth to a URL? This is to perform simple On/Off with ISY which requires auth.
Reply
#10
If you do it via CML you can pass anything you want. You need to call SetAutoAuth() on the HTTPClient object and it will do authorization based on the info it was given. Call SetAuthInfo() to set the name and password, which it will use.
Dean Roddey
Explorans limites defectum
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Sending HTTP PUT Commands gReatAutomation 2 1,665 09-17-2019, 01:11 PM
Last Post: gReatAutomation
  Device varible in email greyjeep 3 2,290 01-09-2018, 05:21 PM
Last Post: Dean Roddey
  Train HTTP Trigger Driver jkmonroe 24 14,900 10-25-2016, 11:55 AM
Last Post: karenlee
  Harmony Hub Device Control jkmonroe 6 4,881 07-03-2016, 02:36 PM
Last Post: potts.mike
  zwave device configuration jkmonroe 75 27,023 12-31-2015, 05:21 PM
Last Post: Deane Johnson
  Eventghost able to Ping device out of network EST 10 5,653 09-24-2015, 05:18 PM
Last Post: EST
  Help setting up GeoFancy & HTTP Trigger driver Sendero 10 5,908 04-20-2015, 11:08 AM
Last Post: bbrendon
  Simple Clarification Questions Deane Johnson 5 3,164 01-03-2015, 03:20 PM
Last Post: Deane Johnson
  Android based device Voice control of CQC How To Discussion Thread batwater 5 4,645 12-07-2013, 10:01 PM
Last Post: RichardU
  HTTP Trigger Driver EST 5 3,969 08-01-2013, 05:59 AM
Last Post: EST

Forum Jump:


Users browsing this thread: 1 Guest(s)