IFTTT with LAUNCH CENTER PRO

Posted on
Thu May 26, 2016 6:43 am
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: IFTTT with LAUNCH CENTER PRO

My use case is that I have several legacy Zigbee devices from when I used SmartThings, and haven't found buyers for them.

Then there's Automatic, which I have on my Mini Cooper. With that, presence gets LOTS more reliable.
iOS Location, which has an IFTTT channel. Ditto.
It would be great if my Harmony Hub could confirm to Indigo that it has set an activity correctly, or that it has changed an activity without Indigo causing it.

So yeah, most of what I want to do is have IFTTT talk to Indigo. Plus, with two way comm, it's much easier to convince potential users that Indigo is for them!

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Thu May 26, 2016 7:07 am
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: IFTTT with LAUNCH CENTER PRO

So I need to put this
Code: Select all
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
   curl_setopt($ch, CURLOPT_HEADER, 0);
   curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
   curl_setopt($ch, CURLOPT_USERPWD, "USERNAME" . ":" . "PASSWORD");

At the front of whatever script I'm having the Maker channel send to Indigo? Would the next line have the curl command, so that the whole thing looks like
Code: Select all
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
   curl_setopt($ch, CURLOPT_HEADER, 0);
   curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
   curl_setopt($ch, CURLOPT_USERPWD, "USERNAME" . ":" . "PASSWORD");
curl  X PUT -d isOn=0 http://192.168.0.6:8176/devices/Torchiere
?
I'm sure this is an eye-rollingly basic question, but I have zero experience with JSON and nearly none with curl!

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Thu May 26, 2016 7:50 am
george99 offline
Posts: 224
Joined: May 27, 2015

Re: IFTTT with LAUNCH CENTER PRO

I used the following:
Code: Select all
curl_setopt($ch, CURLOPT_URL, "http://192,168,0,111:8176/variables/Master/?_method=put&value=1");


Obviously you would make the URL do what you needed.

Posted on
Thu May 26, 2016 8:26 am
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: IFTTT with LAUNCH CENTER PRO

Sigh.

IFTTT says: Action skipped URL must begin with http or https.

That's when I try to run
Code: Select all
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD, "uname" . ":" . "pwd");
curl_setopt($ch, CURLOPT_URL, "X PUT -d isOn=0 http://192.168.0.6:8176/devices/Torchiere"


So it looks like I need to authenticate in the URL. Right?

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Thu May 26, 2016 8:45 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: IFTTT with LAUNCH CENTER PRO

Different Computers wrote:
gives me an error including "access denied" BUT also includes something that makes me think it's interpreting special characters from the password (which I obviously can't share) as part of a curl or bash command. Or possibly expanded the password characters into another bash command!


I'm not sure what's included that makes you think that, but as a test you can temporarily change your password to something with no special characters and see if that solves the issue. I don't know what limitations curl has around special characters - it's possible it doesn't handle unicode characters that well.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu May 26, 2016 9:46 am
george99 offline
Posts: 224
Joined: May 27, 2015

Re: IFTTT with LAUNCH CENTER PRO

Just to be clear, MAKER/IFTTT is sending the request to my personal apcahe/php server. NOT to the indigo server.
My apache server then sends the request to indigo.
Using my own server, I have a bit more flexibility.
I'm not even sure if maker can do the authentication on indigo directly.

Posted on
Thu May 26, 2016 9:57 am
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: IFTTT with LAUNCH CENTER PRO

Based on the RESTful docs for Indigo referenced above, I think it is possible.

I just need a line starting with http that does both the digest authentication and the Indigo command.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Fri May 27, 2016 8:38 pm
george99 offline
Posts: 224
Joined: May 27, 2015

Re: IFTTT with LAUNCH CENTER PRO

Ok, so apparently Maker can also receive. So now Indigo is FULLY integrated with IFTTT. So now I can send or receive anything to and from IFTTT from Indigo.

I'm not sure why you are having trouble with the authentication. Working for me.

Posted on
Fri May 27, 2016 10:25 pm
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: IFTTT with LAUNCH CENTER PRO

Could you post an anonymized sample of how you're sending TO Indigo, including all the ifttt menu options?

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Mon May 30, 2016 3:24 pm
george99 offline
Posts: 224
Joined: May 27, 2015

Re: IFTTT with LAUNCH CENTER PRO

Here you go. This handles multiple things in indigo depending on the variables you send with maker.

Code: Select all
<?php
   // create a new cURL resource
   $ch = curl_init();
   
   // set URL and other appropriate options
   curl_setopt($ch, CURLOPT_URL, "http://myindigoserver.com:8176/variables/Master.json");
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
   curl_setopt($ch, CURLOPT_HEADER, 0);
   curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
   curl_setopt($ch, CURLOPT_USERPWD, "myusername" . ":" . "mypassword");
   
   
   // grab Results
   $data = curl_exec($ch);

   // close cURL
   curl_close($ch);


   // Parese results
   $json = json_decode($data, true);
   #print_r($json);

   // This is the specific value needed for brightness in this script.   
   $bright = $json['value'];
      
      
   // Removes spaces from vars in URL.
   $device = str_replace (' ', '%20', $device);
   $indigoaction = str_replace (' ', '%20', $indigoaction);
   
   $ch = curl_init();
   
   if   ($brightness > 0)   { // This is used to set global light brightness.
      curl_setopt($ch, CURLOPT_URL, "http://myindigoserver.com:8176/variables/Master/?_method=put&value=" . $brightness);
   }elseif ($dim == 1){ // This is used when a request comes in to set lights to a specific brightness other than full.
      curl_setopt($ch, CURLOPT_URL, "http://myindigoserver.com:8176/devices/" . $device . "/?_method=put&brightness=" . $bright);
   }elseif ($indigoaction != "")   {
      curl_setopt($ch, CURLOPT_URL, "http://myindigoserver.com:8176/actions/" . $indigoaction . "/?_method=execute");
   }else{ // This is used to toggle devices on/off.
      curl_setopt($ch, CURLOPT_URL, "http://myindigoserver.com:8176/devices/" . $device . "/?_method=put&toggle=1");
   }   
   curl_setopt($ch, CURLOPT_HEADER, 0);
   curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
   curl_setopt($ch, CURLOPT_USERPWD, "myusername" . ":" . "mypassword");
   
   curl_exec($ch);
   curl_close($ch);

?>
   


Posted on
Tue May 31, 2016 11:40 am
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: IFTTT with LAUNCH CENTER PRO

Thanks very much, but I don't understand how to use this. The Maker channel tells me any sent command needs to start with http or https.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Tue May 31, 2016 12:18 pm
george99 offline
Posts: 224
Joined: May 27, 2015

Re: IFTTT with LAUNCH CENTER PRO

The script I posted is located on an Apache/php server. Maker calls this script and then this script logs in to indigo and passes the information from maker over to indigo to trigger the action.


Sent from my iPhone using Tapatalk

Posted on
Tue May 31, 2016 1:07 pm
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: IFTTT with LAUNCH CENTER PRO

Ah, got it.

I'll have to think hard about whether I want to spin up another apache server.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Tue May 31, 2016 1:10 pm
george99 offline
Posts: 224
Joined: May 27, 2015

Re: IFTTT with LAUNCH CENTER PRO

Well, you could put it on the same MAC that indigo is running on.
I plan on doing that. I just haven't gotten around to installing apache yet.

Posted on
Tue May 31, 2016 1:53 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: IFTTT with LAUNCH CENTER PRO

Apache is installed on Mac OS X by default.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Who is online

Users browsing this forum: No registered users and 2 guests