-
Notifications
You must be signed in to change notification settings - Fork 41
3. Home Automation
Jarvis offers a lot of home automation with yaml
file mappings.
All the home automation tasks are 100% optional
All the feed files are required to be placed in a directory namedfileio
within current working directory.
Jarvis can send on demand notifications using a contacts.yaml
file stored in fileio
directory. Uses gmail-connector for SMS and email notifications.
Setup Instructions
Note: Jarvis currently supports sending emails only when the
contacts.yaml
file is present, however phone numbers can be used directly.
phone:
Tony: 0123456789
Thor: 1234567890
email:
Eddard: [email protected]
Aegon: [email protected]
Jarvis supports MagicHome
for lights, LGWebOS
and Roku
for TVs.
This feature requires a
smart_devices.yaml
file which should be stored within thefileio
directory.
-
TV hostnames should include the brand name [
LG
/Roku
] to distinguish the modules accordingly.- This will be set by default, if yours doesn't include the brand name change it in the TV settings.
-
To wake up
Roku
TVs using MAC address, make sure theBandwidth saver
feature is turned off under,Settings/Network/Bandwidth saver >> Off
-
For first time users on
LGWebOS
TVs, there will be a prompt on the TV to accept the connection request.- Once the connection request is accepted a client key will be generated and logged.
- Please make sure to store this in
smart_devices.yaml
file to avoid repeated connection prompt.
Setup Instructions
- The source file should have an initial key to distinguish between
Lights
andTV
- The name used in the keys (for both lights and tv) will be the identifier when an action is requested.
- Lights should be a dictionary of identifier and a list of hostnames.
- TVs should be a nested dictionary of multiple parameters.
- The source file (
smart_devices.yaml
) should be as following:
Lights:
bedroom:
- 'HOSTNAMES'
hallway:
- 'HOSTNAMES'
hallway basement:
- 'HOSTNAMES'
kitchen:
- 'HOSTNAMES'
living room:
- 'HOSTNAMES'
TV:
living room tv:
hostname: 'LGWebOSTV'
client_key: 'CLIENT_KEY' # Generated automatically if unavailable
mac_address: # Mac addresses can either be a string or a list
- 'WIRED_MAC_ADDRESS'
- 'WIRELESS_MAC_ADDRESS'
bedroom tv:
hostname: 'RokuTV'
mac_address: 'MAC_ADDRESS'
Jarvis can execute any python or shell script during startup without any user interaction.
This feature requires a directory called
scripts
within thefileio
directory.
Setup Instructions
Simply place the startup script within the fileio/scripts
. Jarvis will only trigger the scripts those names that
end with .py
or .sh
or .zsh
without having an _
at the begining.
Example:
In the example below, only the scripts ngrok.py
and stack.sh
will be triggered.
fileio/
|-- scripts/
| |-- ngrok.py
| |-- stack.sh
| |-- _offline.py
Jarvis can execute offline compatible tasks at pre-defined times without any user interaction.
This feature requires an
automation.yaml
file which should be stored within thefileio
directory.
Setup Instructions
The YAML file should contain 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:
- task: set my bedroom lights to 50%
day: weekday # Runs only between Monday and Friday
06:30 AM:
- task: set my bedroom lights to 100%
day: # Runs only on Monday, Wednesday and Friday
- Monday
- wednesday
- FRIDAY
08:00 AM: # Runs only on Saturday and Sunday
- task: set my bedroom lights to 100%
day: weekend
09:00 PM: # Runs daily (can take both list of dict and dict as argument)
task: set my bedroom lights to 5%
12:00 AM: # Even performs tasks that are not supported via voice commands
- task: restart all background processes
- task: turn off all lights
day: weekday
Jarvis supports both internal and external background tasks to be scheduled.
- Jarvis can run internal tasks at certain intervals.
This feature requires a
background_tasks.yaml
file which should be stored within thefileio
directory.
Setup Instructions
- seconds: 1_800
task: turn off all lights except bedroom # Runs every 30 minutes
ignore_hours: # Ignore the schedule from 5-6 AM and 7-8 PM
- 5
- 19
- seconds: 10_800
task: remind me to drink water # Runs every 3 hours ignoring the hours specified
ignore_hours: "21-6" # Ignore the schedule between 9 PM and 6 AM
- seconds: 1_800
task: lock screen # Runs every 30 minutes
ignore_hours: # Ignore the schedule from 5-6 AM and 7-10 PM
- 5
- 19-22
Jarvis can place function(s) level restrictions for offline communicators.
- This restriction can also be modified by offline communicators.
- Once a restriction is placed, the matching commands will not be executed unless the restriction is removed explicitly.
This feature requires a
restrictions.yaml
file which should be stored within thefileio
directory.
Setup Instructions
The YAML file should contain a list of function names that looks like the below.
- car # Blocks ALL car related operations via offline communication
- garage # Blocks ALL garage related operations via offline communication
Jarvis can execute function(s) directly based on a custom condition map, via both voice and offline communicators.
- The condition mapping may contain one or more functions to be executed for a single keyword/phrase.
- These functions are executed as ordered in the mapping file and responses will be delivered as each task is done.
- For offline communicators, in case of multi-function mapping, the responses are gathered and then delivered at once.
This feature requires a
conditions.yaml
file which should be stored within thefileio
directory.
Setup Instructions
The YAML file should contain a dictionary within a dictionary that looks like the below.
lumos: # custom keyword
lights: turn on all lights # function_name: phrase passed as argument
knox:
lights: turn off all lights
television: turn off bedroom tv
fire up the chopper: # custom phrase
garage: open garage
car: start car
UserWarning
if invalid function name or phrase is entered in the mapping file.
Jarvis can execute tasks as a simulation to test the required functions and send an email with the results.
This feature requires a
simulation.yaml
file which should be stored within thefileio
directory.
Setup Instructions
The YAML file should contain a list of phrases within a dictionary that looks like the below.
meeting_event:
- get me the events from my calendar
- what meetings do I have today