Jump to content

Amazon Echo added IFTTT


Scottmichaelj

Recommended Posts

Cool... This is 'Alexa, trigger xxxx'. Nice. With the Maker channel on IFTTT almost anything becomes possible.

 

When (if) token auth to Portal comes it will, allow 'Alexa, trigger xxx' to call the ISY Portal with a REST call to execute programs..... Via the Maker channel. Sweet!

 

Sent from my Nexus 9 using Tapatalk

Link to comment

I happen to know of, but not sure I can talk much about, an upcoming feature for the ISY Portal to make interaction from the Maker channel much easier... and more secure that storing your ISY credential in the URL on IFTTT :)

 

And, you don't need the networking module for inbound REST calls from the Maker channel (or anywhere else).

Link to comment

I've linked my Echo to IFTTT and created a 'If Alexa Trigger Cabinet Lights' to call a Maker channel url. This URL is to my .PHP script that I use as a proxy to ISY.  Anyway - the URL simply calls a program, which is 'If light is off then turn scene on, else turn scene off'.

 

On saying 'Alexa, Trigger cabinet lights' it takes about 4-5 seconds - and they toggle...

 

:)

 

Seems the delay is with Alexa sending the request though...  watching the log on my Apache server the php=>ISY is happening very quickly, as always.

 

A good day...

 

Edit: Subsequent runs complete very quickly....  after recognizing the command Alexa says 'Sending it' and before she finishes the lights have toggled state...  Nice!

Link to comment

I've linked my Echo to IFTTT and created a 'If Alexa Trigger Cabinet Lights' to call a Maker channel url. This URL is to my .PHP script that I use as a proxy to ISY.  Anyway - the URL simply calls a program, which is 'If light is off then turn scene on, else turn scene off'.

 

On saying 'Alexa, Trigger cabinet lights' it takes about 4-5 seconds - and they toggle...

 

:)

 

Seems the delay is with Alexa sending the request though...  watching the log on my Apache server the php=>ISY is happening very quickly, as always.

 

A good day...

 

Edit: Subsequent runs complete very quickly....  after recognizing the command Alexa says 'Sending it' and before she finishes the lights have toggled state...  Nice!

What is the url scheme for running programs? I need both RUN and THEN. Thanks.

 

EDIT: I thought it would be something like: http: //external-ip.com/ username:password@ISY-IP /rest/programs/program-number/run

Link to comment

The general format is:

https://$ISYuser:$ISYpassword@$ISYurl/rest/programs/$ISY_Node/$run_option

Where $run_option is one of:  runIf, runThen, runElse.

 

I have programs that toggle lights - so I use runIf to run the toggle. The programs themselves are 'disabled'.

 

I have a .php script where my Maker URL is more like:

https://api.domain.com/ifttt/$APIKEY/rest/programs/$ISY_Node/$run_option

If the $APIKEY is correct and /rest/programs/ follows - the URL get's sent to ISY with authentication (minus the /ifttt/$APIKEY). No need to store the password on IFTTT...

The SSL certificate needs to be trusted by IFTTT. This means you need a paid certificate - not a self-signed one.

Link to comment

Here is the .php script I'm using on my internal Apache host (with a paid SSL certificate)... (not real IPs or credentials of course!) This 'translates' unauthenticated requests (from the Maker channel) into authenticated API requests to ISY...  but limiting the actions that can be taken, and protection by having a complex randomly named directory...

<?php
$ISYuser = "admin";
$ISYpassword = "password";
$ISYurl = "192.168.1.2";

$protocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0');

$request = "";
if(isset($_GET['request'])){
        $request = $_GET['request'];
        if (substr(strtolower($request),0,14) === "rest/programs/") {
                $url = "http://$ISYuser:$ISYpassword@$ISYurl/$request";
                $content = file_get_contents($url);
                echo $content;
                echo "<br>";
        } else {
                header($protocol . ' 401 Unauthorized');
                $GLOBALS['http_response_code'] = 401;
                exit;
        }
} else {
        header($protocol . ' 401 Unauthorized');
        $GLOBALS['http_response_code'] = 401;
        exit;
}
?>

There is a .htaccess that goes with it:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)$ index.php?request=$1 [QSA,NC,L]

The whole thing is in a subdirectory on my Apache host - with a long, strong random name....

 

The actions are restricted to only programs - so the worst that can happen if the private URL is compromised is programs triggered. No loss of credentials, no disarming my house alarm etc...

Link to comment

The general format is:

https://$ISYuser:$ISYpassword@$ISYurl/rest/programs/$ISY_Node/$run_option

Where $run_option is one of:  runIf, runThen, runElse.

 

I have programs that toggle lights - so I use runIf to run the toggle. The programs themselves are 'disabled'.

 

I have a .php script where my Maker URL is more like:

https://api.domain.com/ifttt/$APIKEY/rest/programs/$ISY_Node/$run_option

If the $APIKEY is correct and /rest/programs/ follows - the URL get's sent to ISY with authentication (minus the /ifttt/$APIKEY). No need to store the password on IFTTT...

The SSL certificate needs to be trusted by IFTTT. This means you need a paid certificate - not a self-signed one.

 

Yeah I am getting stopped because I dont have a SSL certificate. I been meaning to get one but haven't looked into it. Any suggestions?

Link to comment

I got my certificate thru this site: http://www.garrisonhost.com/ssl-certificates/alphassl.html

 

I use a wildcard - this is the cheapest wildcard site I've found. I use the wildcard on my proxy - so I can host multiple sites under different names on one certificate. If you're just looking for a cert for ISY - their regular cert should work fine. 

Link to comment

Odd - all I'm getting for my 'Alexa, trigger cabinet lights' is 'Sorry, something went wrong' - and the IFTTT trigger is not sent.

In my Alexa history, it shows the command being recognized correctly.

 

I went to the Alexa channel on IFTTT and it shows no history this morning. 

 

There appear to be growing pains - Alexa is not currently playing nice.

Link to comment

Odd - all I'm getting for my 'Alexa, trigger cabinet lights' is 'Sorry, something went wrong' - and the IFTTT trigger is not sent.

In my Alexa history, it shows the command being recognized correctly.

 

I went to the Alexa channel on IFTTT and it shows no history this morning. 

 

There appear to be growing pains - Alexa is not currently playing nice.

Sorry can't test, I am still looking into SSL certs, how they work and how to install on my ISY. I might just wait on this and see if SSL will be required if I use the portal.

Link to comment

On the cert question, check out:

 

https://letsencrypt.org/

 

Won't be live for another couple weeks but will be offering completely free real trusted certificates.

I've been watching this project with interest for a while now. Hopefully, UDI will integrate the client for this service right in the ISY. So getting a real, valid certificate is as few clicks as possible for ISY users.
Link to comment

I got my certificate thru this site: http://www.garrisonhost.com/ssl-certificates/alphassl.html

 

I use a wildcard - this is the cheapest wildcard site I've found. I use the wildcard on my proxy - so I can host multiple sites under different names on one certificate. If you're just looking for a cert for ISY - their regular cert should work fine.

 

I just purchased a standard certificate from this company and was wondering what I should use for web server type when generating the certificate since it will be hosted on the ISY?

 

Thanks,

Chuck

Link to comment

I just purchased a standard certificate from this company and was wondering what I should use for web server type when generating the certificate since it will be hosted on the ISY?

 

Thanks,

Chuck

I cannot remember what I selected, but I used OpenSSL on a Ubuntu host to generate the private key then the csr - and then when I retrieved the signed public key I married it with the private key. Using OpenSSL I can then convert it to whatever format I need for various applications.
Link to comment

I cannot remember what I selected, but I used OpenSSL on a Ubuntu host to generate the private key then the csr - and then when I retrieved the signed public key I married it with the private key. Using OpenSSL I can then convert it to whatever format I need for various applications.

Few questions:

 

I was able to generate the new key and pasted it into my ISY using the receive cert button and I can now log into my ISY via HTTPS remotely without any errors or security warnings and I see the lock in the browser windows so I assume I'm good there?

 

However when the Maker app on IFTTT tries to run the script I see this error in the logs. Any ideas what may be going on?

 

Action skipped1 minute ago

Unable to make web request: Error: unable to verify the first certificate

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...