예제 #1
0
파일: main.py 프로젝트: davidsoloman/hal
from lib.bootstrap import Bootstrap

bootstrap = Bootstrap()
bootstrap.bootstrap()
예제 #2
0
import signal
import sys
from lib.bootstrap import Bootstrap
import RPi.GPIO as GPIO
import time
 
def signal_term_handler(signal, frame):
    print 'GPIO Cleanup...'
    GPIO.cleanup()
    sys.exit(0)
 
#Catch kill signal so we can do GPIO cleanup
signal.signal(signal.SIGTERM, signal_term_handler)

bootstrap = Bootstrap('default', ['config', 'log'])
registry = bootstrap.bootstrap()

bell_gpio_pin = None
try:
    bell_gpio_pin = registry['config'].getint('gpio.bell', None)
except ValueError:
    #if configured value is not a valid integer
    pass

if not bell_gpio_pin:
    raise Exception('Configuration not set: gpio.bell')
    
light_gpio_pin = None
try:
    light_gpio_pin = registry['config'].getint('gpio.light', None)
except ValueError:
예제 #3
0
from lib.bootstrap import Bootstrap
from lib import xbmc, mail, camera, pushover
import RPi.GPIO as GPIO
import requests
from concurrent.futures import ThreadPoolExecutor

bootstrap = Bootstrap('default', ['config', 'log'])
registry = bootstrap.bootstrap()

bell_gpio_pin = None
try:
    bell_gpio_pin = registry['config'].getint('gpio.bell', None)
except ValueError:
    #if configured value is not a valid integer
    pass

if not bell_gpio_pin:
    raise Exception('Configuration not set: gpio.bell')

xbmc_hosts = registry["config"].get('xbmc.hosts')
text_to_speech_hosts = registry["config"].get('text_to_speech.hosts')

email_client = mail.EmailClient(registry["config"].get('email.host'),
                                registry["config"].get('email.port'),
                                registry["config"].get('email.username'),
                                registry["config"].get('email.password'),
                                registry["config"].get('email.from_address'))

email_recipients = registry["config"].get('email.recipients')

camera_client = camera.CameraClient(