hamilc
Posts: 158
Joined: Fri May 16, 2014 9:59 pm

understanding Alexa and Google assistant

Sat Jan 26, 2019 11:28 pm

I am trying to understand how these devices work from a high level to start with. For example I can understand that Alexa hears my voice and send a command to a device.

What is the protocol of the transmission? In the simplest case, I assume it is wi fi. Is a text command sent via tcp/ip to some port that is interpreted by the device? As you can see, I do not know the simplest part of this interface.

If I knew what was sent, I could easily write a program to interpret the command.

Could I set up a TCP/IP socket and listen for a command?

What is the code in a Sonoff module?

Is there a book on this subject I could read? Help.

btidey
Posts: 1614
Joined: Sun Feb 17, 2013 6:51 pm

Re: understanding Alexa and Google assistant

Sun Jan 27, 2019 1:10 pm

There are many books on Alexa but most focus on using the service rather than understanding how it works. The Dummy books are quite good.

There is no simple answer to your question on protocols, commands etc. as it varies according to what you are doing.

Essentially there is a potentially a long pipeline of events and actions.

1) Device (Dot, Echo ...) listens for wake word (Alexa). When this occurs device then sends the audio through to the Amazon Alexa service.

2) Amazon Alexa service analyses the audio, forms it into words and then tries to interpret what you are requesting.

3) The request could need a local response back to the device like an answer to a question, setting an alarm, or playing music. If so then the Amazon service just replies directly back to the device.

4) If the request needs an added skill (triggered by the command used) then Alexa forms a packet of data (containing the words recognised in the request) and sends them on to the skill service configured when that skill is created. This is typically another cloud service somewhere and can be on the Amazon lamda service which can be used to host skills (see Alexa skill development info for good guides).

5) The skill service decides what to do based on the request words it receives.

6) In some cases (like requesting train times) this might just be a reply back to Alexa with text which then gets vocalised and sent back to your device.

7) In other cases, like home automation control, the skill service has to action the request using whatever techniques / protocols that particular home automation device needs. This is why there is no simple answer to your question. For example, some skills (particularly those developed by individual users) might talk direct to your device using port forwards and sending either a web request or using tcp/udp messaging. In other cases (probably more common for commercial devices) the home automation already has its own cloud service to allow control via a phone App. So then the skill service sends the action command to the home automation service in a similar way to how that phone App would. The home automation service then performs the action using again any number of different methods. Some automation devices might poll their home automation service to see if there are any outstanding commands.

Most Sonoff modules use the ESP8266 wifi processor module. One can update the firmware in these to do all sorts of useful things. Check out www.esp8266.com

hamilc
Posts: 158
Joined: Fri May 16, 2014 9:59 pm

Re: understanding Alexa and Google assistant

Mon Feb 04, 2019 6:29 pm

Is there example code for the Pi that makes the Pi respond to Alexa commands just like a light bulb would?
I would like to try this.

clarkbeck
Posts: 1
Joined: Fri Feb 01, 2019 11:27 am
Contact: Website Google+

Re: understanding Alexa and Google assistant

Tue Feb 05, 2019 7:30 am

Voice is hailed as the new computing paradigm, but that won’t be the case until we can talk to our computers as naturally as we would a friend. AI needs to feel human – or at the very least, understand us as humans – if we’re going to opt to chat to it instead of tapping a touchscreen or pushing a button.
clarkbeck

btidey
Posts: 1614
Joined: Sun Feb 17, 2013 6:51 pm

Re: understanding Alexa and Google assistant

Tue Feb 05, 2019 8:46 am

Google search for control raspberry with Alexa. You will find lots of tutorials and projects on sites like instructables.

Return to “Automation, sensing and robotics”