Hello friends,

Here is my python code to control whole home just by voice commands. and also control your computer by just your voice commands. edit my program as per your need. hope you like it.

my project on GitHub

project website


import os,pyttsx,urllib,feedparser,time,serial
import speech_recognition as sr
import email.utils,smtplib
from email.mime.text import MIMEText

def text_speech(text):
 engine = pyttsx.init()
 engine.setProperty('rate', 150)
 voice.id= 0x0000000002CC9550
 engine.setProperty('voice', voice.id)

def speech_text():
 with sr.Microphone() as source:
 r = sr.Recognizer()
 audio = r.listen(source)
 print("You said " + r.recognize(audio))
 return r.recognize(audio)
def open_movie(string):
 for word in string:
 if word in movie_list:
 s="sir, opening"+word+"movie, it's a awesome movie , enjoy it"

def open_song(string):
 song_list=["we own it"]
 for word in song_list:
 if word in string:
 temp="opening "+word+"song"
def open_software(string):
 for software_name in string:
 if software_name in software_list:
 s="sir, i am opening "+software_name+" for you"
 arg="start "+software_name+".exe"

def readmail():
 opener = urllib.FancyURLopener()
 _URL = "https://mail.google.com/gmail/feed/atom"
 f = opener.open(_URL)
 feed = f.read() 
 atom = feedparser.parse(feed)

def readnews(key):
 feed = feedparser.parse(url)
 entries = feed.entries
 for entry in entries:
 if a<6:
 if a==0:
 text_speech("there is no new news")

def continuos_loop():
 print "inside continuos loop..."
 print "looping..",result
 if result=="jarvis":
 except LookupError: 

def time_check():
 text_speech(time.strftime("%I"+" and "+"%M"+" PM"))

def send_mail():
 text_speech("tell the name of person to whom you want to send E-mail")
 temp=speech_text().split(" ")
 for word in temp:
 if "kush" in temp:
 elif "shivang" or "shivangi" in temp:
 elif "engineering" in temp:
 print "mail id =",mail_id
 to_email = mail_id #raw_input(’Recipient: ')
 servername = "smtp.gmail.com"
 username = "myemail@gmail.com"
 password = "your passsword"#getpass.getpass("%s’s password: " % username)
 msg = MIMEText(’checking mail’)
 msg.set_unixfrom(’dip patel’)
 msg[’To’] = email.utils.formataddr((’Recipient’, to_email))
 msg[’From’] = email.utils.formataddr((’Author’, 'author@example.com’))
 text_speech("sir what i write in mail")
 msg[’Subject’] = speech( text)