/Magic-Mirror

🧙 🔮 Magic Mirror - Web interface for connected screen

Primary LanguageTypeScript

Magic Mirror

Web interface for connected screen

Web interface using Angular 2 and Angular CLI for displaying informations

Get the Code

git clone https://github.com/T3kstiil3/Magic-Mirror.git
cd Magic-Mirror
npm install

Configuration

  • Rename ApiService file (remove exemple.)
  • Replace api key and url

Launch the project

ng serve

Creating a build

ng build

Custom / Create ...

ng generate component test

Read Angular CLI documentation :) Angular CLI

Base tag handling in index.html

When building you can modify base tag (<base href="/">) 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/

Running unit tests

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.

Running end-to-end tests

ng e2e

Before running the tests make sure you are serving the app via ng serve.

End-to-end tests are run via Protractor.

Script Python

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)

Widgets

  • Date time
  • Weather
  • Xee Car
  • Bike Vlille
  • Home
  • Twitter
  • ...

Angular2

Hardware

  • Monitor

Todo

  • APP
  • Xee Services Ng2
  • VLille Services Ng2
  • Weather night icon
  • Domoticz Services Ng2
  • News widgets
  • Hardware Motion et Relay sensor