Siricontrol: Add Siri Voice Control To Any Project
About the project
SiriControl is an open source python framework, which developers can extend to add Siri voice control to any project.
Platforms: Apple, Raspberry Pi
Estimated time: 1 hour
License: GNU General Public License, version 3 or later (GPL3+)
Items used in this project
SiriControl is an open source python framework designed with developers in mind. It provides a simple way of using Siri commands, by dynamically loading modules created by the user. This means that you can add voice controlled capability to any Raspberry Pi project, with Siri. Whether it is turning on an LED to controlling your TV with infrared, the possibilities are endless!
How it Works
With Siri, you can create Notes by using the command word 'Note', which can be synced to a Gmail account. SiriControl works by fetching Notes from this account. It dynamically loads modules, created by the user, meaning that you can set it up to control anything you want, when the specific command words are heard.
This ingenious hack helps you to easily add Siri controlled capability to any project.
Step 1: Configuring Your Gmail Account
1) A Gmail account is required for SiriControl. For security reasons, I suggest creating a new Gmail account as you will have to enter your username and password in a python script. This won’t matter as you won’t be using this for personal everyday use – just for speaking commands.
2) Then, access for less secure apps needs to be turned on, which can be done here. This is because Google identifies the connection between the python script and mail servers as less secure.
3) As the script uses the IMAP protocol to fetch new Notes, IMAP needs to be enabled, under the Gmail settings.
Step 2: Preparing Your IOS Device
1) Now, navigate to the following, in your Settings and add your newly created Gmail account:
Settings > Notes > Accounts > Add Account
2) Turn on Notes for that account.
3) Ensure that the default account for creating Notes with Siri is your new Gmail account. That’s it! Now, just tell Siri to create a Note like this:
“Note this is awesome”
The new note should appear under the Notes label in your Gmail account. If not, please follow the above steps again.
Step 3: Setting Up SiriControl
1) Firstly, clone or download the scripts from here.
2) Then, open up siricontrol.py and add your username and password of your new Gmail account. This should be self-explanatory.
3) Now, run the script and say to Siri:
“Note the meaning of life”
The answer should be printed out, because of the ‘life’ module in the modules folder. The setup is now complete.
Step 4: Creating Your Own Modules
The above module is the default life module, which comes with SiriControl. This can be found under the modules folder. Also, a template module is included for reference.
moduleName – This is the name of the module which can be anything you want.
commandWords – This array will have the words which need to be said in order to call the execute() function.
execute(command) – This function is called when all the words in the commandWords array are said. The ‘command’ parameter is the command said by the user, to Siri.
Keep in mind that all modules that you create must be placed under the modules folder or else they won't be found.
Step 5: Next Steps
Thats it! Now, you can control whatever you want and add fantastic voice control to any project, by creating your own modules.
Anything is possible, with the power of Siri behind it! It opens up many options such as IoT and home automation, as you can command Siri, from anywhere in the world, as long as you have an internet connection.
Although it is a one way connection, you can program to send an email back to you etc. - the possibilities are endless!
If you thought SiriControl was awesome, please like and share my blog post. Also, for more cool stuff, please visit my website.
Enjoy commanding Siri!
Member of the Homo Sapien species.
Leave your feedback...