Introduction
The Amazon Echo is a great piece of kit, which is flexible and can be expanded with the use of skills. These skills are initially difficult to get your head around, but once you've managed one, they become easy to produce.This note takes you through the steps taken to get an internet radio station to be played on an Echo.
Including developing the skill, setting up an encrypted link, and implementing a relay to a non-supported radio station or stream.
Background
Stateless and Variables
The Echo system is stateless, i.e. the servers normally do not hold the state for any conversation chain. This is achieved by passing variables back to the Echo, and they can be used in subsequent conversations, for example:"Alexa, ask flintstone film what is the name of the main character"
"The main character is Fred" (hidden note: you asked me what is the name of the main character, and I said Fred)
"Alexa, what is his wife's name" (hidden data - note: you asked me what is the name of the main character, and I said Fred)
"Fred's wife is Wilma"
Secure Communications
The Echo will only connect to servers that it can obtain trusted certificates for, which means that the connections must be 'https', and the remote server must have signed certificates from a recognised authority for the Echo to connect.If the Echo is asked to connect to a site without the appropriate certification, no response may result.
On first look, this seems to be Amazon's effort to stop you writing functions such as playing music from your own media server (i.e. having to buy Amazon's services instead). However, it does have some significant advantages, in that the Echo is not able (by protocol) to go snooping around inside your house because devices in your house are note accessible on the internet, and do not have the right certificates.
Radio Stations and Streaming Media Problem
Unfortunately, the majority of internet radio stations do not operate over 'https' with appropriately signed certificates. The built-in TuneIn app either has some code which allows it to bypass this function, or TuneIn have a number of relays and will forward http based stations over a https connection.I've not configured the echo to sniff the packets to determine which is is doing - if anyone has found out which, a comment would be great!
For me, the radio station I like to listen to is "IP Music Slow", which is based in Switzerland. Unfortunately, TuneIn no longer works with this station, and tries to play "KP4IP" any time I request my station. The TuneIn app is actually capable of playing "IP Music Slow" (if I select the station from the history in the web browser control panel, from a time when it did work), but if the speech recognition picks the wrong station, this is of very little use.
So, to stream your own station, it is necessary to build a http to https relay. This method can also be applied to a media server (i.e. attach an ice-cast server to a UPNP media server, and forward the tracks as a radio stream).
A Media Relay System
Introduction
The system I've set up uses a Raspberry PI, which is accessible on the internet via a https link, and various pieces of software to allow it to be recognised and used as a relay. Note that Amazon allow you to use a development configuration, where the certificate trust can be uploaded, and a root CA is not required, however, this note demonstrates a way of doing it 'properly'.
Component parts and steps
- Part 2: Configure a Raspberry PI
- Part 3: Obtains and Install LetsEncrypt Certificates
- Part 4: Design and Build a https relay
- Part 5: Opening network ports to allow correct operation
- Part 6: Developing a simple media player application
- Part 7: Installing a modified UPNP media server
- Part 8: Installing a pseudo-radio station and bridging the UPNP server to the https relay
- Part 9: Adding Chromecast casting push support
Great article Lot's of information to Read...Great Man Keep Posting and update to People..Thanks smm panel
ReplyDelete