Say hello to alexa
Recently, I bought an echo dot and tried to make use of it. For I am a always forgetful person. It alwats costs me a lot of time to find out where my iPhone is. So it’s quite a simple idea for me to let my alexa learn the skill to find my iPhone. Unfortunately, the current alexa skills are all about installing an app and calling the app to remind you where you iPhone is. It’s quite uncomfortable for me, because I don’t think such function is complex enough to be an app, I can make use of some native features of iPhone in order to deal with such problem.
Then I realized that there’s a feature which meets my requirement. The “play sound” function on iCloud. Through iCloud I can play the sound on my iphone as long as it’s online. It even doesn’t require any set up because it’s natively supported. I can hear the sound even when I muted my iPhone in class and forgot to unmute it afterwards. So that’s seemingly a perfect solution for me.
To accomplish such work, some tools are required. First, An iCloud wrapper. I used PyiCloud as my wrapper. It’s quite functional which has wrapped up almost all the features in iCloud. I believe it can expand the function of my applet later. Therefore, I have to use python as base language. I used Flask-Ask as the framework to build my applet. The following stuff is pretty simple. Since the detailed steps have already mentioned in the Tutorial, I don’t wish to repeat it again, you can just click the link and checkout the whole process.
Anyway, in my program I the iPhone was expected to alarm in the lauching function and I add a question to ask if it has been found. The code goes like this:
The code is just as simple as any hello world program. Actually we can do a bit more in the no_intent. Since The iPhone hasn’t been founded, we can ask to lock up the phone and leave the message to the one who pick up the phone. These processes are also natively supported by iCloud, and wrapped up by PyiCloud, So it’s pretty easy to apply.
The code only have the dependency of Python. Therefore, it’s able to be deployed on any public or private cloud. The deployment steps are even more simpler.
- open an instance on public cloud platform(AWS,Google cloud,etc.) as your applet server, and execute your program on it.
- register a domain and ask for SSL certification(Since I’m a students, these two stuffs are free of charge, you can also use ngrok which recommended in the Tutorial) and bind to your server.
The reason of using https service instead of http is that the Alexa Skill only allowed exteral server with https support or you can simply use Amazon Node.
- create a test mode alexa app which binds to your alexa account(The configuration is just the same to the one in the tutorial).
I cannot find out the way to deal with the login securely. It’s a non-offical support, therefore the apple id and passsword are required to be passed to an uncertificated server(my server), also logining to the iCloud requires 2-Factor Authentication, that’s not easy to deal with. As a result, I only build up such tool for personal use.
So, that’s it, all set. Since I named my app as “Finding My iPhone”, whenever I called “Alexa, start finding my iPhone.” My iPhone will ring immediately. Thus, I will never worry about finding it, cheers.