What is Alexa?
Before I go any further – let me backtrack for those who’ve been in – well, a cave or something – what the hell is Alexa? Ok, you’ve seen SIRI and OK GOOGLE etc. and probably talked to one or the other. Well, this is better. A LOT better. This is the fore-runner of the companion you’ll be talking to when you get old!
So the Amazon Echo is a tall, round black box with a speaker that plugs into the wall, hooks into your WIFI and you talk to it and it talks back. The Dot is the same thing, third the price – without the big speaker. It has a small speaker and you can plug another speaker into it or hook to a Bluetooth speaker. For my money, the Dot is the best buy.
So far so good. But why would you spend £45 on that?
The Dot unit has a microphone “array” – all you need to know is that when it is blasting music – it can still hear you! If you happen to have an Amazon Prime account or a full Spotify account – you can say things like “Alexa, play some Pink Floyd”. Now that might not seem like much – but trust me – this is going to be a party trick for MONTHS. No you can’t play your own stuff – well, that’s probably not strictly true – depends how clever you are.
Ok, so we have a talking, listening music centre? Is that it? HELL NO!!! Alexa can handle everything including “what is the meaning of life”. But also – “Alexa – add beans to my shopping list” – and variations (you can get the list of on the somewhat lacklustre APP) – alarm clock, timer – the list goes on.
But where it gets really exciting and frustrating at the same time is when you realise you can attach it to NODE-RED and have it control your house – securely. Where’s the frustrating bit? The HTTPS: bit… it won’t work without it (don’t even DREAM of mentioning certain sites that only work in America or those who are still talking about deprecated code). Well, the good news is that today we tackled this and cracked it and we have this now working in Node-Red without any special libraries and when you see it you’ll immediately realise the fantastic potential – heating, lighting, security, kettle boiling and other important items – all within grasp. Take a Raspberry Pi and a speaker amp and a microphone array and a power supply and a case and spend £60+ or just buy the DOT at £45 !!! The alternatives simply are not worth it as far as I can see.
No – not easy at first – which is why Aidan and I plan to sit down to document the lot. In reality – it should be possible to reduce the whole procedure to half an hour and the cost to a few quid a year. Right now I have everything in front of me and it is merely down to some trivial coding to get my various heating systems, lighting systems and the rest on voice control. My next job after writing this preliminary blog – is to order another DOT.
But I can do this for free?
There are countless stories of alternatives out there. I’ll just ignore any hardware solutions that don’t use special microphones – and when I asked SEED about the apparent fact that their solution plus microphone board come to MORE than the Amazon product – I didn’t get as much as a reply. As for free SSL? Show me a free SSL that does not require constant renewal, that works with subdomains (xxxx.xxxx.com), which has been proven to work with Amazon’s system (please DO) and which doesn’t rely specifically on one machine like a Pi – until then – a REALLY cheap SSL seems a reasonable way forward and despite the sweat at the very thought of it, obtaining and using the certificates was actually quite easy.
Is code needed?
I’ve seen solutions requiring java and other languages – I wanted to do everything in Node-Red – i.e. generally visually – and this is what we have done. No compiling, no special requirements – just Node-Red and some nodes and functions. There is absolutely no requirement to be using a Raspberry Pi here.
We spent a lot of time yesterday getting to grips with terms like “intent” – I don’t know why people keep coming up with new terms… and initially we were looking at various “intents” but I’m half-convinced you only need one or two and the rest can be done in Node-Red. I won’t go into the image below – it won’t look like this when we’re done – but if you ignore that “status report” you pretty much have the basics – I can turn a light on an off already via MQTT (but the actual mechanism is irrelevant – I just happy to use MQTT for everything – all my little ESP8266 boards run MQTT ultra-reliably.
So the basic idea is simple enough – in order not to confuse your home control with other stuff, you can hand control over to your stuff using what I would call a keyword… so “Alexa – ask XXX” or “Alexa – tell XXX” – which seem to do the same thing… where XXX is your chosen word or phrase. I’m going to call my controller “Charlie” because “controller” sounds too geeky and if you use “house” then when video Skyping your friends with the same keyword you’ll chance to mess up their heating
So (and you can add irrelevant words like please and thanks and to etc…. but I won’t) – I’m thinking – “Alexa ask Charlie location device action” – for example “kitchen heating up”, “bathroom lights off”, “office heating status” etc…. others may do things a different way but that works for me with the minimum number of words.
When implemented – I’ll be back! But to be clear – this is working NOW, completely reliably and there is no chance the idea above is not going to work. However today the BT man is coming over to fix our rotten broadband and I’m sure he’ll want to turn it on and off.
About the only down side up to now – is the ATROCIOUS Amazon music library which is as much use as an Ashtray on a motorbike. No AC/DC – WHAT!!!!?!?!?!?!?!? Clearly if not on a budget – Spotify must be worth the investment.
Alexa – play “I’m not in love”
Update Monday: We’ve spent the entire day on this – and that flow up there is out of the window – it turns out that all is not perfect in the standard way to handle Alexa – for example you would thing that by defining a range of words that are acceptable, no other words could creep in there – but in fact if you read the Amazon docs – they can. So for “light” you could end up with “flight” – so for all that range checking you STILL need to do your own checks.
We’ve taken a different approach. I’ll soon present some Node-Red code… that will do this. “Alexa tell the computer to turn the kitchen lights on” – the relevant bits of this are “turn the kitchen lights on” – and by the time you remove irrelevant words you are down to “kitchen lights on” – out block for Node-Red will do exactly that, return a cleaned up array of up to 15 words. What you do with them is entirely up to you. No chance of getting words wrong and have Alexa sit and time out. This is all working now – but it is also very late at night. The beauty of doing your own thing is that you can do things Alexa might balk at..
“Alexa tell the computer to turn the kitchen lights off and heating down”
So you end up with “kitchen lights off heating down”
Look through a series of acceptable locations, if none, bomb out otherwise look at a series of units – got it…. next parameter is what you want to do. Next parameter is location – but if not found – use the last one – then a device – then status. In one instruction you might be able to control 3 or 4 items!
I can’t wait to get started – no matter what we add – more messing with the Amazon site!