Web interface using Angular 2 and Angular CLI for displaying informations
git clone https://github.com/T3kstiil3/Magic-Mirror.git
cd Magic-Mirror
npm install
ng serve
ng build
ng generate component test
Read Angular CLI documentation :) Angular CLI
When building you can modify base tag (<base href="https://github.com/AurelienLoyer/Magic-Mirror/blob/master/">
) in your index.html with --base-href your-url
option.
# Sets base tag href to /myUrl/ in your index.html
ng build --base-href /myUrl/
ng build --bh /myUrl/
ng test
Tests will execute after a build is executed via Karma, and it will automatically watch your files for changes. You can run tests a single time via --watch=false
.
ng e2e
Before running the tests make sure you are serving the app via ng serve
.
End-to-end tests are run via Protractor.
import RPi.GPIO as GPIO #import
import time
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.IN) #Read output from PIR motion sensor
screen = False #Screen ON on start by default
timeON = 300 #Screen On 5 minutes
time.sleep(timeON)
def toggleScreen():
GPIO.setup(7, GPIO.IN)
time.sleep(0.5)
GPIO.setup(7, GPIO.OUT)
return;
while True:
i=GPIO.input(11)
if i==0: #When output from motion sensor is LOW
print "No intruders",i
time.sleep(1)
if screen == True:
toggleScreen()
screen = False
elif i==1: #When output from motion sensor is HIGH
print "Intruder detected",i
toggleScreen()
screen = True
time.sleep(timeON)