-
Notifications
You must be signed in to change notification settings - Fork 41
2. Environment Variables
Environment variables are loaded from a .env
file and validated using pydantic
Almost all environment variables are feature specific
By default,Jarvis
will look for a.env
file in the current working directory.
All environment variables are case insensitive.
Custom files for environment configuration
Environment variables can be sourced using any plaintext
/ JSON
/ YAML
file. The file path should be set to the environment variable env_file
before initiating Jarvis.
File extensions allowed: (.json
, .yaml
, .yml
, .txt
, .text
, .env
)
Sample Usage - IDE
import os
os.environ['env_file'] = "/path/to/env/file"
import jarvis
if __name__ == '__main__':
jarvis.start()
Sample Usage - Terminal
export env_file = "/path/to/env/file"
jarvis run
-
PORCUPINE_KEY - AccessKey obtained from Picovoice Console (mandatory for
ARM
architecture) -
ROOT_PASSWORD - System password to run
sudo
commands onLinux
machines. -
NAME - Name which Jarvis should address the user by. Defaults to
Vignesh
-
TITLE - Title which Jarvis should address the user by. Defaults to
sir
-
BIRTHDAY - Birth date in the format DD-MM - Example:
24-April
-
VOLUME - Default volume for the Jarivs' voice. - Defaults to
50
-
LIMITED - Boolean flag to run only the main version of
Jarvis
skipping background processes. Defaults toFalse
(enforced based on the number of CPU cores) - WEBSITE - List of websites to enable CORS (Jarvis API)
-
PLOT_MIC - Boolean value to show microphone usage in realtime. Defaults to
True
- CAMERA_INDEX - Camera index that has to be used. Run camera.py to get the index value of each camera.
- SPEAKER_INDEX - Speaker index that has to be used. Run peripherals.py to get the index value of each speaker.
- MICROPHONE_INDEX - Microphone index that has to be used. Run peripherals.py to get the index value of each microphone.
-
WAKE_WORDS - List of wake words to initiate Jarvis. Defaults to
['jarvis']
(Defaults to['alexa']
in legacy macOS)
⚠️ Jarvis has limitations on the wake words as it relies on ML libraries for wake word detection. -
VOICE_NAME - Name of the voice supported by the OperatingSystem. Defaults to the author's favorite.
-
SPEECH_RATE - Speed/rate at which the text should be spoken. Defaults to the value from
pyttsx3
module. Typically200
To add more voices
macOS:
- System Preferences → Accessibility → Spoken Content → System voice → Manage Voices...
Windows:
- Settings → Time & Language → Speech → Manage voices → Add voices
-
SENSITIVITY - Hot word detection sensitivity. Allowed range: [0-1] Defaults to
0.5
-
LISTENER_TIMEOUT - Timeout in seconds until which the listener should wait for speech. Defaults to
3
-
LISTENER_PHRASE_LIMIT - Timeout in seconds until which the listener will remain active. Defaults to
None
-
RECOGNIZER_CONFIDENCE - Confidence level to check before prompting for a confirmation. Defaults to
0
(no confirmation) -
RECOGNIZER_SETTINGS - A JSON object with customized speech recognition settings.
Custom settings for speech recognition
These are customized according to the author's voice pitch. Please use recognizer.py to figure out the suitable values on a trial and error basis.
Sample settings (formatted as JSON object)
RECOGNIZER_SETTINGS
:'{"energy_threshold": 1100, "dynamic_energy_threshold": false, "pause_threshold": 2, "phrase_threshold": 0.1, "non_speaking_duration": 2}'
Description
-
energy_threshold
: Minimum audio energy to consider for recording. Greater the value, louder the voice should be. -
dynamic_energy_threshold
: Change considerable audio energy threshold dynamically. -
pause_threshold
: Seconds of non-speaking audio before a phrase is considered complete. -
phrase_threshold
: Minimum seconds of speaking audio before it can be considered a phrase - values below this are ignored. This helps to filter out clicks and pops. -
non_speaking_duration
: Seconds of non-speaking audio to keep on both sides of the recording.
-
Logs are stored in
*.log
files in thelogs
directory.
Log files are cleaned up based on thelog_retention
time (in days) in env vars.
Log files are named after the process itself.
-
DEBUG - Boolean flag to enable debug level for logging. Defaults to
False
-
LOG_RETENTION - Number of days to store the logs. Defaults to
10
-
DISTANCE_UNIT - Unit in which speed/distance should be measured. Defaults to
miles
-
TEMPERATURE_UNIT - Unit in which temperature should be measured. Defaults to
fahrenheit
- GIT_USER - GitHub Username
- GIT_PASS - GitHub Token
- NEWS_APIKEY - API Key from newsapi
- MAPS_APIKEY - API Key for maps from Google
-
OLLAMA - Boolean flag to enable/disable GPT integration. Defaults to
True
-
OLLAMA_MODEL - GPT model to use. Defaults to
llama3
- OLLAMA_TIMEOUT - Number of seconds to wait for a response from GPT model.
-
OLLAMA_REUSE_THRESHOLD - This is the threshold for sequence matching repeated requests. Defaults to
None
Setting the
OLLAMA_REUSE_THRESHOLD
(range:0.1
to0.9
) will try to avoid hitting Ollama API more frequently for repeated identical requests.
This threshold is theratio
of acceptable result forSequenceMatching
between a new request and historically identical request.
-
NOTIFY_REMINDERS - One or more reminder options from (
phone
,email
,telegram
,ntfy
,all
) Defaults toall
- GMAIL_USER - Gmail account username to send SMS and emails.
- GMAIL_PASS - Gmail account password to send SMS and emails.
-
OPEN_GMAIL_USER - Alternate gmail account username to send SMS. (Defaults to
GMAIL_USER
) -
OPEN_GMAIL_PASS - Alternate gmail account password to send SMS. (Defaults to
GMAIL_PASS
) - RECIPIENT - Email address to which the emails from jarvis have to be received.
-
PHONE_NUMBER - Phone number to send SMS from Jarvis - Example:
1234567890
NTFY notifications with secured subscriptions
- NTFY_URL - NTFY URL to send notifications.
- NTFY_USERNAME - NTFY username for Access Control List.
- NTFY_PASSWORD - NTFY password to authenticate Access Control List.
- NTFY_TOPIC - NTFY topic for notifications subscription.
- TELEGRAM_ID - Telegram ID to send reminder notifications to.
- 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
-
ICS_URL - Shared calendar URL to get meetings information from. Should end with
.ics
-
MUTE_FOR_MEETINGS - Boolean value to disable the listener during meetings. Defaults to
False
-
EVENT_APP - To read events from
outlook
orcalendar
application inmacOS
. Defaults toNone
💡 Whencalender
is used, the name of the calendar within theCalendar.app
should be Jarvis
-
SYNC_MEETINGS - Interval in seconds to generate
meetings
information using anics
URL. -
SYNC_EVENTS - Interval in seconds to generate
events
information usingcalendar
oroutlook
application.
-
WEATHER_APIKEY - API Key from openweathermap
-
WEATHER_ENDPOINT - API endpoint from openweathermap
-
WEATHER_ALERT - Time (in 12h
%I:%M %p
format) when the weather alert should be fired - Example:09:00 AM
- WEATHER_ALERT_MIN - Degrees below which alert has to be fired.
- WEATHER_ALERT_MAX - Degrees above which alert has to be fired.
Alerts in SMS and Email if temperature is higher than
WEATHER_ALERT_MAX
or lower thanWEATHER_ALERT_MIN
or severe weather warnings.
This feature can also be enabled fromautomation.yaml
by using the keywordweather
in phrase for thetask
-
CRONTAB - Runs external tasks using cron expressions. Needs to be stored as env var.
Sample value
[ "0 0 * * 1-5/2 find /var/log -delete", "0 5 * * 1 tar -zcf /var/backups/home.tgz /home/" ]
- WIFI_SSID - SSID of the wireless connection.
- WIFI_PASSWORD - Password for the wireless connection.
- CONNECTION_RETRY - Frequency in seconds to check for an active internet connection. Defaults to 10 seconds.
VPNServer integration
- VPN_USERNAME - Username to create vpn-server. Defaults to profile username.
- VPN_PASSWORD - Password to authenticate vpn-server. Defaults to profile password.
- VPN_KEY_PAIR - Name of the PEM file and key pair to spin up the ec2 instance.
- VPN_HOSTED_ZONE - Domain name for the hosted zone.
- VPN_SUBDOMAIN - Alias record name to access VPN server.
- VPN_INFO_FILE - JSON file for VPN information to be stored.
- VPN_SECURITY_GROUP - Name of the security group to be created in AWS.
- CAR_USERNAME - Email address to log in to InControl API.
- CAR_PASSWORD - Password to authenticate InControl API.
- CAR_PIN - InControl PIN.
Thermostat Controls - Applies only for Honeywell devices with Total Connect Comfort.
- TCC_USERNAME - Total connect comfort username.
- TCC_PASSWORD - Total connect comfort password.
- TCC_DEVICE_NAME - Device name to control.
Telegram Bot integration
- BOT_TOKEN - Telegram BOT token.
- BOT_CHAT_IDS - List of userID/chatID to authorize.
- BOT_USERS - List of usernames to authorize.
Specific to telegram-webhook
-
BOT_WEBHOOK - Webhook URL. Tries to get
public_url
if usingngrok
- BOT_WEBHOOK_IP - Webhook IP address. (Not necessary, unless there is an alias record in front of the reverse proxy)
-
BOT_ENDPOINT - Endpoint to use for telegram bot interaction. Defaults to
/telegram-webhook
- BOT_SECRET - Secret to be set in the webhook to make sure the messages are only coming from the webhook set by the user.
-
BOT_CERTIFICATE - File path for the public certificate in
PEM
format. (Not required if webhook behind an SSL signed by a well known CA)
-
SPEECH_SYNTHESIS_TIMEOUT - Timeout to connect to the docker container that processes text to speech requests.
-
SPEECH_SYNTHESIS_VOICE - Voice for the speech synthesis model. Defaults to author's favorite.
-
SPEECH_SYNTHESIS_QUALITY - Quality of speech synthesis conversion. Defaults to
medium
. -
SPEECH_SYNTHESIS_HOST - Address to host the speech synthesis API within a Docker container.
-
SPEECH_SYNTHESIS_PORT - Port number to expose for the API.
To enable independent speech-synthesis
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)" \ thevickypedia/speech-synthesis
💡 Speech Synthesis can run on a docker container for better voices but, response might be negligibly 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.
-
OFFLINE_HOST - Address to host the office communicator. Defaults to
127.0.0.1
-
OFFLINE_PORT - Port number to initiate offline communicator. Defaults to
4483
-
OFFLINE_PASS - Secure phrase to authenticate offline requests. Defaults to
OfflineComm
-
WORKERS - Number of uvicorn workers (processes) to spin up. Defaults to
1
- ROBINHOOD_USER - Robinhood account username.
- ROBINHOOD_PASS - Robinhood account password.
- ROBINHOOD_QR - Robinhood login QR code
-
ROBINHOOD_ENDPOINT_AUTH - Authentication token to access the robinhood portfolio which is generated every hour. (only available when
author_mode
is enabled) - SURVEILLANCE_ENDPOINT_AUTH - Token to access webcam live feed via Jarvis API.
-
SURVEILLANCE_SESSION_TIMEOUT - Session time out for
/surveillance
. Defaults to 300 seconds. -
STOCK_MONITOR_API - API key(s) to skip OTP validation for
/stock-monitor
endpoint.Entry should be a dictionary of with email as
key
andtoken
as value. Eg:'{"[email protected]": "@lfaROm$o"}'
-
AUTHOR_MODE - Enables Robinhood portfolio scan (every hour) and open-source stock monitoring (every 15 minutes). Defaults to
False
-
STARTUP_OPTIONS - One or more startup options from (
all
,car
,thermostat
) Defaults toall