Jarvis icon indicating copy to clipboard operation
Jarvis copied to clipboard

Fully Functional Voice Based Natural Language UI

ForTheBadge made-with-python ForTheBadge built-with-swag

Python

Platform Supported

Generic badge Generic badge

Language Stats

Language count Code coverage

Repo Stats

GitHub Repo stars GitHub Repo forks GitHub Repo watchers

GitHub GitHub repo size GitHub code size LOC

GitHub Repo issues GitHub Repo issues GitHub Repo pr GitHub Repo pr

Code Stats

Modules Python Threads Listener Speaker Bash AppleScript Make

Deployments

pages-build-deployment pypi

Pypi-format Pypi-status sourcerank

Activity

GitHub Repo created GitHub commit activity GitHub last commit

Development and Maintenance

Active Development Actively Maintained

Maintained Maintainer

Reach Out

Ask Me | Anything

Jarvis

IronMan's Jarvis with python

Prep

  • MacOS
    Tested on macOS High Sierra, Mojave, Catalina, Big Sur, and Monterey
    • System PreferencesSecurity & PrivacyPrivacy
    • Click + sign and add the preferred IDE and Terminal in the following sections in left pane.
      • Microphone - Required to listen and respond.
      • Accessibility - Required to use key combinations for brightness and volume controls.
      • Camera - [Optional] Required only during face recognition/detection.
      • Automation - Required to control System Events and other apps like Outlook and Calendar.
      • Files and Folders [OR] Full Disk Access - Required for all FileIO operations.
  • Windows
    Tested on Windows 10
    • SettingsPrivacy
      • Microphone - Required to listen and respond.
      • Camera - [Optional] Required only during face recognition/detection.
      • Unlike macOS, Windows pops a confirmation window to Allow or Deny access to files and folders.
    • Install Anaconda or Miniconda, and VisualStudio C++ BuildTools

Setup

  • Clone this repository or download it from pypi
  • Run the following commands in a command-line/terminal:
    1. python3 -m venv venv - Creates a virtual env named venv
    2. source venv/bin/activate - Activates the virtual env venv
    3. which python - Validate which python is being used. Should be the one within the virtual env venv
    4. chmod +x lib/install.sh - Makes installation file as executable.
    5. bash lib/installs.sh - Installs the required modules based on the operating system.
    6. python jarvis.py - BOOM, you're all set, go ahead and interact with Jarvis.
      1. PyCharm or similar IDE preferred to initiate Jarvis (Step vi.) to keep stdout clear.

ENV Variables

Environment variables are loaded from a .env file and validated using pydantic

More on Environment variables
  • TITLE - Title which Jarvis should address the user by. Defaults to sir
  • NAME - Name which Jarvis should address the user by. Defaults to Vignesh
  • SENSITIVITY - Hot word detection sensitivity. Range: 0-1
  • WAKE_WORDS - List of wake words to initiate Jarvis' listener. Defaults to ['jarvis']
  • LIMITED - Runs only the main version of Jarvis skipping all other background processes. Enforced based on the number of CPU cores. It can also be enabled with env-var.

:warning: Windows10 and macOS (version 10.14 and newer) have limitations on the wake words as they rely on ML libraries for wake word detection.

Offline communicator

  • OFFLINE_PORT - Port number to initiate offline communicator. Defaults to 4483
  • OFFLINE_PASS - Secure phrase to authenticate offline requests. Defaults to OfflineComm

Features

  • GIT_USER - GitHub Username
  • GIT_PASS - GitHub Token
  • WEATHER_API - API Key from openweathermap
  • NEWS_API - API Key from newsapi
  • MAPS_API - API Key for maps from Google
  • GMAIL_USER - Gmail account username to send and read emails.
  • GMAIL_PASS - Gmail account password to send and read emails.
  • ALT_GMAIL_USER - Alternate gmail account username to send an SMS. (GMAIL_USER can be re-used)
  • ALT_GMAIL_PASS - Alternate gmail account password to send an SMS. (GMAIL_PASS can be re-used)
  • RECIPIENT - Email address to which the emails from jarvis have to be received.
  • ROBINHOOD_USER - Robinhood account username.
  • ROBINHOOD_PASS - Robinhood account password.
  • ROBINHOOD_QR - Robinhood login QR code
  • BIRTHDAY - Birth date in the format DD-MM - Example: 24-April
  • ICLOUD_USER - iCloud account username/email.
  • ICLOUD_PASS - iCloud account password.
  • ICLOUD_RECOVERY - Recovery phone number to activate lost mode on a target device - Example: +11234567890
  • PHONE_NUMBER - To send SMS from Jarvis - Example: +11234567890
  • ROOT_PASSWORD - System password for your mac to get the system vitals.
  • WOLFRAM_API_KEY - API Key from wolfram alpha.
  • ICS_URL - Shared calendar URL to get meetings information from. Should end with .ics
  • EVENT_APP - To read events from outlook or calendar. Defaults to calendar
    :bulb:   When calender is used, the name of the calendar within the Calendar.app should be Jarvis
  • SPEECH_SYNTHESIS_TIMEOUT - Timeout to connect to the docker container that processes text to speech requests.
    • To enable independent speech-synthesis run:
docker run \
    -it \
    -p 5002:5002 \
    -e "HOME=${HOME}" \
    -v "$HOME:${HOME}" \
    -v /usr/share/ca-certificates:/usr/share/ca-certificates \
    -v /etc/ssl/certs:/etc/ssl/certs \
    -w "${PWD}" \
    --user "$(id -u):$(id -g)" \
    rhasspy/larynx

:bulb:   Text to speech is optionally run on a docker container for better voices but the response might be slower. If you don't have docker installed or simply don't want to use it, set the SPEECH_SYNTHESIS_TIMEOUT env var to 0. This is also done automatically if failed to launch a docker container upon startup.

Background scans [Defaults to 1 hour]

  • SYNC_MEETINGS - Interval in seconds to generate meetings information using ics URL.

  • SYNC_EVENTS - Interval in seconds to generate events information using calendar or outlook application.

  • TASKS - Runs certain tasks at certain intervals.

[
  {"seconds": 10_800, "task": "remind me to drink water"},  # Runs every 3 hours
  {"seconds": 21_600, "task": "turn off all lights"}  # Runs every 6 hours
]
  • CRONTAB - Runs scheduled tasks using cron expressions without using actual crontab.
[
  "0 0 * * 1-5/2 find /var/log -delete",
  "0 5 * * 1 tar -zcf /var/backups/home.tgz /home/"
]

VPNServer integration

  • VPN_USERNAME - Username to create vpn-server. Defaults to profile username or openvpn
  • VPN_PASSWORD - Password to authenticate vpn-server. Defaults to profile password or aws_vpn_2021

TV controls - Applies only for LGWebOS

  • TV_CLIENT_KEY - TV's Client key. Auto-generated when used for the first time.
  • TV_MAC - TV's mac address. Can be single [str] or multiple [list] mac addresses (to include both wired and wireless macs).

Car Controls - Applies only for JLR vehicles using InControl API.

  • CAR_EMAIL - Email address to log in to InControl API.
  • CAR_PASS - Password to authenticate InControl API.
  • CAR_PIN - InControl PIN.

Telegram Bot integration

  • BOT_TOKEN - Telegram BOT token.
  • BOT_CHAT_IDS - UserID/ChatID for a particular user.
  • BOT_USERS - Usernames that should have access to Jarvis.

Smart Devices

A source file smart_devices.yaml is used to store smart devices' hostnames. Jarvis supports MagicHome lights and LGWebOS TVs.

Setup Instructions

Note: Jarvis currently supports only one hostname for TV but multiple for lights.

  • The name used in the keys will be the identifier of those light bulbs.
  • The source file (smart_devices.yaml) should be as following:
bedroom:
  - 'HOSTNAMES'
hallway:
  - 'HOSTNAMES'
hallway_basement:
  - 'HOSTNAMES'
kitchen:
  - 'HOSTNAMES'
living_room:
  - 'HOSTNAMES'
tv: 'LGWEBOSTV'

Automation Setup [Optional]

Executes offline compatible tasks at pre-defined times without any user interaction. Uses an automation.yaml file as source which should be stored within the directory fileio

Setup Instructions

The YAML file should be a dictionary within a dictionary that looks like the below.

OPTIONAL: The key, day can be a list of days, or a str of a specific day or simply a str saying weekday or weekend when the particular automation should be executed.

Not having the key day will run the automation daily. Date format should match exactly as described below.

06:00 AM:
  day: weekday  # Runs only between Monday and Friday
  task: set my bedroom lights to 50%
06:30 AM:
  day:  # Runs only on Monday, Wednesday and Friday
  - Monday
  - wednesday
  - FRIDAY
  task: set my bedroom lights to 100%
08:00 AM:  # Runs only on Saturday and Sunday
  day: weekend
  task: set my bedroom lights to 100%
09:00 PM:  # Runs daily
  task: set my bedroom lights to 5%

Coding Standards

Docstring format: Google
Styling conventions: PEP 8
Clean code with pre-commit hooks: flake8 and isort

Linting

PreCommit will ensure linting, and the doc creation are run on every commit.

Requirement
pip install --no-cache --upgrade sphinx pre-commit recommonmark

Usage
pre-commit run --all-files

Feature(s) Implementation

Please refer wiki for API usage, access controls, env variables, features' overview and demo videos.

Pypi Package

pypi-module

https://pypi.org/project/jarvis-ironman/

Runbook

made-with-sphinx-doc

https://thevickypedia.github.io/Jarvis/

License & copyright

© Vignesh Sivanandha Rao

Licensed under the MIT License