Getting Apilio to action Alexa commands where there is no native support in IFTTT or Apilio

No manufacturer of a smart device is likely to ignore the advantage of having Alexa support, but an increasing number do not provide an IFTTT interface or any other means that you can access them programmatically. To give an example, Nest thermostats have pulled their IFTTT support, but you can still issue commands such as “Alexa, set the temperature in the hallway to 22”. Wouldn’t it be nice to be able to do this from Apilio? So here is how you can do exactly that, for any action that Alexa can undertake.

The trick is to make use of a (currently free) service called Voice Monkey (https://voicemonkey.io/). Sign up for a free account, which links to your Alexa account. Now you can create any number of so-called ‘monkeys’, which are triggers that can be sent to your Alexa. You program Alexa to do anything you like when it receives the trigger, which you can even set to include any command that you would normally speak.

As an example, let me show how you can switch your Nest thermostat between heat mode and eco mode. The Alexa commands that you would speak for this are “Alexa set the [thermostat name] to heat mode” and “Alexa, set the [thermostat name] to eco mode”. To to do this:

  • Create two monkeys on the Voice Monkey site called ‘Nest to Heat’ and ‘Nest to Eco’.
  • In a few seconds, your Alexa will recognise two new devices (the monkeys are actually implemented as doorbell buttons).
  • In Alexa, create a routine called ‘Nest to Heat’. For the ‘When this happens’ look under ‘Smart Home’ and select the ‘Nest to Heat’ monkey. Add a customised action, with the command string “set the [thermostat name] to heat mode”. Select one of your Alexa devices to implement the action (more on this later).
  • Repeat similar steps to create a ‘Nest to Eco’ routine.

You can now test your monkeys on the Voice Monkey site (click the ‘manage monkey’ then use the ‘Trigger Test’ button).

If you have got this far, you will have discovered that the process works, but the Alexa device you have chosen will, unfortunately, speak to you to tell you that it has implemented the command. This is a side effect of the customised action—if you use commands that don’t involve a response (such as setting the colour of a light) that isn’t an issue, but the more powerful customised action does have this drawback. However, we can get around this.

To get around the nuisance of Alexa talking to you when you issue a customised action, do the following:

  • Edit your previous Alexa routines, so that before they perform the customised action, they set the device volume to 0
  • Create a third monkey called ‘Reset Volume’
  • Create another Alexa routine called ‘Reset Volume’ that is triggered by the ‘Reset Volume’ monkey, and is set to put the Alexa back to your standard volume (4 or 5 works for me)

The whole process therefore becomes one of activating the ‘Nest to Heat’ (or ‘Nest to Eco’) monkey, then waiting a few seconds (5-10 seconds seems to work) for the command to implement before activating the ‘Reset Volume’ monkey. This does mean that your selected Alexa will be silent for a few seconds—if this is a really big deal then you can always buy a dedicated Echo Flex that you use for this (all of £10, so it will hardly break the bank).

So how do you make these calls from Apilio? That, at least, is easy as there is a direct webhook interface for Voice Monkey. See https://voicemonkey.io/docs, but basically you just make a webhook call from Apilio with the appropriate parameters set up. The good thing about doing this via Apilio is that you can easily set up a logicblock that includes two webhook calls, the first to set ‘Nest to Heat’ (or ‘Nest to Eco’), followed by the ‘Reset Volume’ call that is delayed by 5-10 seconds.

Hope this is useful for you all :smiley:

3 Likes

Another awesome post @robin thanks!

Hi @robin , thanks a lot for this contribution.
I recently also started to integrate Apilio with Alexa, but I used https://mkzense.com because I had troubles to get it working with Voicemonkey. Probably I just did something wrong.

My use case was to say Alexa a warning if someone lets the patio door open too long (we had a young cat that was not allowed to escape).

1 Like

VoiceMonkey is the best thing I’ve ever found after Apilio :smiley:

@robin, I don’t understand this: “the Alexa device you have chosen will, unfortunately, speak to you to tell you that it has implemented the command.” My Alexa devices say nothing when a monkey is executed.

I am using VoiceMoney for a few use cases:

  • Say a phrase through a specific Alexa device (btw you can customise the phrase in the URL itself so you just need one monkey for each Alexa device, e.g. https://api.voicemonkey.io/trigger?access_token=xxxxx&secret_token=xxxxx&monkey=monkey-alexa-kitchen&announcement=Hello%20world).
    I use this whenever my motion detector inside the physical mailbox detects motion (“a letter has arrived!”), when the garage door is still open at 10 pm (“it is too late and the garage door is still open”), when someone rings my smart bell so I don’t miss it (“ding dong someone’s at the door!”), etc.
  • Turn on my Roborock robotic vacuum cleaner (it has integration with Alexa) when I leave home.
  • Lock my Yale Linus Smart Lock automatically when I leave home

@pebneter I found Mkzense more limited when I tried it… can you make Alexa say a specific phrase too? And if so, can you customise the phrase in the webhook itself?

1 Like

Yes, but defined in the routine that is triggered. I guess it’s not configurable via the trigger.

It depends on the command. If Alexa pipes up (as it does when configuring the Nest) then it is necessary to silence it. But if you do something such as switch a light on or off then Alexa does this without speaking. I think that customised actions are more likely to get Alexa speaking back to you, which is why the Nest command I use does that (I think!)

1 Like

@pebneter @teknofilo
Yes, Voice Monkey can do this. Check out the documentation Documentation - Voice Monkey. You pass a parameter ‘announcement’ with the string to say, and open the ‘Voice Monkey Skill’ as the last step of the action. In Apilio you could have the announcement parameter be a string variable, so you could update this as required and use the same monkey to say different things. For example, @pebneter could have various levels of severity in the message to shut his patio door to keep the cat in :smiley:

Agreed. It only actions commands, whereas Voice Monkey can do this and get Alexa to say things, post images and play video. Also, Mkzense has (I believe) only 3 buttons for free with more incurring a subscription, whereas Voice Monkey has up to 300 monkeys for free (at present)