Creation repo sue RPi3
This commit is contained in:
35
SiriControl/modules/garage.py
Normal file
35
SiriControl/modules/garage.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import json
|
||||
import requests
|
||||
import sys
|
||||
|
||||
#https://howchoo.com/g/zdi2zgq2mjb/how-to-use-siri-to-control-anything-from-iftt-to-custom-programs-and-devices
|
||||
|
||||
moduleName = 'garage'
|
||||
commandWords = ['garage', 'door']
|
||||
GARAGE_HOST = 'http://192.168.1.183'
|
||||
|
||||
|
||||
def execute(command):
|
||||
try:
|
||||
action = command.split(' ')[0]
|
||||
except IndexError:
|
||||
print('No command passed.')
|
||||
return
|
||||
|
||||
if not action in ['open', 'close']:
|
||||
print('Invalid action.')
|
||||
return
|
||||
|
||||
response = requests.get('{0}/status'.format(GARAGE_HOST))
|
||||
status = json.loads(response.text)
|
||||
|
||||
if action == 'open' and status.get('open'):
|
||||
print('Door already open.')
|
||||
return
|
||||
|
||||
if action == 'close' and status.get('close'):
|
||||
print('Door already closed.')
|
||||
return
|
||||
|
||||
requests.get('{0}/relay'.format(GARAGE_HOST))
|
||||
|
||||
BIN
SiriControl/modules/garage.pyc
Normal file
BIN
SiriControl/modules/garage.pyc
Normal file
Binary file not shown.
13
SiriControl/modules/life.py
Normal file
13
SiriControl/modules/life.py
Normal file
@@ -0,0 +1,13 @@
|
||||
#You can import any modules required here
|
||||
|
||||
#This is name of the module - it can be anything you want
|
||||
moduleName = "life"
|
||||
|
||||
#These are the words you must say for this module to be executed
|
||||
commandWords = ["meaning","life"]
|
||||
|
||||
#This is the main function which will be execute when the above command words are said
|
||||
def execute(command):
|
||||
print("\n")
|
||||
print("------------------The meaning of life is 42-------------------")
|
||||
print("\n")
|
||||
BIN
SiriControl/modules/life.pyc
Normal file
BIN
SiriControl/modules/life.pyc
Normal file
Binary file not shown.
18
SiriControl/modules/photo.py
Normal file
18
SiriControl/modules/photo.py
Normal file
@@ -0,0 +1,18 @@
|
||||
#You can import any required modules here
|
||||
|
||||
#This can be anything you want
|
||||
moduleName = "photo"
|
||||
|
||||
#All of the words must be heard in order for this module to be executed
|
||||
commandWords = ["prendre","photo"]
|
||||
|
||||
def execute(command):
|
||||
#Write anything you want to be executed when the commandWords are heard
|
||||
#The 'command' parameter is the command you speak
|
||||
#scrot
|
||||
import subprocess
|
||||
subprocess.call("scrot")
|
||||
#subprocess.call("/home/pi/Documents/SiriControl/modules/snapshot.sh")
|
||||
# scrot '%Y-%m-%d_$wx$h_scrot.png' -e 'mv $f ~/images/shots/'
|
||||
# "/home/pi/Pictures/scrot.png"
|
||||
return
|
||||
BIN
SiriControl/modules/photo.pyc
Normal file
BIN
SiriControl/modules/photo.pyc
Normal file
Binary file not shown.
5
SiriControl/modules/snapshot.sh
Executable file
5
SiriControl/modules/snapshot.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
#scrot '/home/pi/Pictures/myscreen.jpg'
|
||||
#scrot 'scrot.png' -e 'mv $f ~/Pictures'
|
||||
scrot 'scrot.png' | mv ~/Pictures
|
||||
12
SiriControl/modules/templateModule.py
Normal file
12
SiriControl/modules/templateModule.py
Normal file
@@ -0,0 +1,12 @@
|
||||
#You can import any required modules here
|
||||
|
||||
#This can be anything you want
|
||||
moduleName = "templateModule"
|
||||
|
||||
#All of the words must be heard in order for this module to be executed
|
||||
commandWords = ["xyz"]
|
||||
|
||||
def execute(command):
|
||||
#Write anything you want to be executed when the commandWords are heard
|
||||
#The 'command' parameter is the command you speak
|
||||
return
|
||||
BIN
SiriControl/modules/templateModule.pyc
Normal file
BIN
SiriControl/modules/templateModule.pyc
Normal file
Binary file not shown.
Reference in New Issue
Block a user