Pages

Alexa to IFTTT to D-Link in the UK Pt 1

**UPDATE - IFTTT now supports Alexa in the UK.  This is posting isn't the best way to do this anymore! ***

We've got Alexa in the UK, but a lot of the functionality is reduced compared to the US. I bought a D-Link 215 smart plug, thinking I could get Alexa to connect to my hifi via Bluetooth, and the turn the hifi on. But then I found the d-link didn't work with Alexa in the UK. No problems I thought, I'd use IFTTT, but that doesn't work with Alexa in the UK either.

Not to be defeated I've come up with a solution that (sort of) works. The 'sort of' bit is it can be a bit laggy.  So laggy in fact that I've changed it to control my Christmas tree lights instead...  Basically IFTTT can take up to 15 minutes to process a requests.  Anyway....

To follow this you'll need an Amazon developer account, and AWS account (no costs - we're using Lambda which is free for our level of use) and an IFTTT account (free again)

The general approach is:
  • Create a new Alexa Skill that calls an IFTTT maker function.
  • Make the IFTTT maker function turn the d-link off.
The bit that is laggy is IFTTT calling the D-link service, but D-link don't provide a publish API so this is the only option we have at the moment.

I'll go through this back to front, first explaining how to create the IFTTT functions, and then how to call them from Alexa (which I'll cover in part 2)

Creating the IFTTT function

I'll start by saying I really, really hate the IFTTT user interface, but its worth dealing with, as you end up with two really simple web calls like this:

Turn on:

https://maker.ifttt.com/trigger/turn_on/with/key/<your secret IFTTT key>

Turn off:

https://maker.ifttt.com/trigger/turn_off/with key/<your secret IFTTT key>

So, assuming you can face the horrible IFTTT user interface (this bit only take a couple of minutes)

1) Go to:

https://ifttt.com/maker

and create an account if you haven't got one.

2) Next you need to find your key. I challenge you to find it with out going direct to the link below! Who designed this UX!

Anyway, the direct link to find it is:

https://internal-api.ifttt.com/maker

then where is says 'connect as': click on you username.

Seriously! What were they thinking! So you should be on a page that says:

Your key is: xxxxxxx

3) So now you've got that, lets create the services.

Go here:

https://ifttt.com/maker

Click 'My Applets' at the top.

Click 'New Applet'.

4) You should get a screen that says:

if✚thisthenthat


So you need to guess that you are supposed to click the massive blue 'this'

You can now search for your trigger. Search for 'Maker'

5) Then next bit is easy so I won't example in detail - create a trigger called 'turn_on'.

6) At the end you are back to massive text:

ifthen✚that

Click the massive 'that'.  You should get to a screen where you can search.

7) Search for 'D-link' and follow the process to add an event to turn it off. That bit should be obvious.

8) So now you'll have an event like this:

https://maker.ifttt.com/trigger/turn_on/with/key/<your secret IFTTT key>

9) Repeat this to create a turn off event.

OK, your done with IFTTT. Wasn't that a truly dreadful user interface?!  Or is it just me?

See http://www.mwebb.me.uk/2016/12/alexa-to-ifttt-to-d-link-in-uk-pt-2_10.html for the next part



No comments:

Post a comment