├── .DS_Store ├── keys ├── MagicMirrorThing-private.pem.key ├── MagicMirrorThing-certificate.pem.crt ├── .DS_Store └── root-CA.crt ├── public ├── .DS_Store ├── weatherfont │ ├── .DS_Store │ ├── meteocons-webfont.eot │ ├── meteocons-webfont.ttf │ ├── meteocons-webfont.woff │ ├── stylesheet.css │ ├── License.txt │ └── meteocons-webfont.svg ├── bootstrap │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ ├── js │ │ ├── npm.js │ │ └── bootstrap.min.js │ └── css │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap-theme.css │ │ └── bootstrap-theme.css.map └── stylesheets │ └── style.css ├── views ├── error.html └── index.html ├── package.json ├── README.md ├── .gitignore ├── routes └── index.js ├── config.js ├── bin └── www ├── app.js └── magicMirror.js /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mexitek/MagicMirrorNodeApp/HEAD/.DS_Store -------------------------------------------------------------------------------- /keys/MagicMirrorThing-private.pem.key: -------------------------------------------------------------------------------- 1 | // Your private key file should be this one -------------------------------------------------------------------------------- /keys/MagicMirrorThing-certificate.pem.crt: -------------------------------------------------------------------------------- 1 | // Your certificate file should be this one -------------------------------------------------------------------------------- /keys/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mexitek/MagicMirrorNodeApp/HEAD/keys/.DS_Store -------------------------------------------------------------------------------- /public/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mexitek/MagicMirrorNodeApp/HEAD/public/.DS_Store -------------------------------------------------------------------------------- /public/weatherfont/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mexitek/MagicMirrorNodeApp/HEAD/public/weatherfont/.DS_Store -------------------------------------------------------------------------------- /public/weatherfont/meteocons-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mexitek/MagicMirrorNodeApp/HEAD/public/weatherfont/meteocons-webfont.eot -------------------------------------------------------------------------------- /public/weatherfont/meteocons-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mexitek/MagicMirrorNodeApp/HEAD/public/weatherfont/meteocons-webfont.ttf -------------------------------------------------------------------------------- /public/weatherfont/meteocons-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mexitek/MagicMirrorNodeApp/HEAD/public/weatherfont/meteocons-webfont.woff -------------------------------------------------------------------------------- /public/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mexitek/MagicMirrorNodeApp/HEAD/public/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /public/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mexitek/MagicMirrorNodeApp/HEAD/public/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /public/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mexitek/MagicMirrorNodeApp/HEAD/public/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /public/bootstrap/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mexitek/MagicMirrorNodeApp/HEAD/public/bootstrap/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /views/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 |<%= error.stack %>10 | 11 | -------------------------------------------------------------------------------- /public/weatherfont/stylesheet.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'MeteoconsRegular'; 3 | src: url('/weatherfont/meteocons-webfont.eot'); 4 | src: url('/weatherfont/meteocons-webfont.eot?#iefix') format('embedded-opentype'), 5 | url('/weatherfont/meteocons-webfont.woff') format('woff'), 6 | url('/weatherfont/meteocons-webfont.ttf') format('truetype'), 7 | url('/weatherfont/meteocons-webfont.svg#MeteoconsRegular') format('svg'); 8 | font-weight: normal; 9 | font-style: normal; 10 | 11 | } -------------------------------------------------------------------------------- /public/bootstrap/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "magicmirror", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www" 7 | }, 8 | "dependencies": { 9 | "aws-iot-device-sdk": "^1.0.6", 10 | "body-parser": "~1.13.2", 11 | "cookie-parser": "~1.3.5", 12 | "debug": "~2.2.0", 13 | "ejs": "^2.3.4", 14 | "express": "~4.13.1", 15 | "moment": "^2.10.6", 16 | "morgan": "~1.6.1", 17 | "serve-favicon": "~2.3.0", 18 | "socket.io": "^1.3.7", 19 | "yql": "^1.0.2", 20 | "yqlp": "^0.2.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MagicMirror 2 | This is a ExpressJS app that launches an all black website. The website is meant to run behind a one-way mirror, hence creating the "Magic Mirror" effect. https://www.youtube.com/watch?v=bvWccv8719M 3 | 4 | ## Assumptions 5 | This repo is not a tutorial 6 | * You know how NodeJS and ExpressJS apps work. 7 | * You know how AWS IoT gateway works. 8 | 9 | ## Things to configure 10 | * Paste your AWS IoT certificate and private key in the `keys/` directory. If you change the name of the key files, you must also change them in the `config.js` file. 11 | * Edit `config.js` with your AWS IoT region and host. -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- 27 | node_modules 28 | 29 | # Debug log from npm 30 | npm-debug.log 31 | -------------------------------------------------------------------------------- /public/weatherfont/License.txt: -------------------------------------------------------------------------------- 1 | Thank you for usign Meteocons! 2 | 3 | If you would like to be among the first ones to hear about all the news, follow @bluxart and @pyconic on Twitter. 4 | 5 | LICENSE: 6 | ------------------- 7 | 8 | Meteocons are free for use in both personal and commercial projects. 9 | 10 | No attribution or backlinks are required, but any form of spreading the word is always appreciated! 11 | 12 | You must not resell any icons or distribute them in any other way. 13 | 14 | The Icons as such are the property of the author. 15 | 16 | Intellectual property rights are not transferred with the download of the icons. 17 | 18 | Alessio Atzeni 19 | 20 | Dont'miss my last project "Pyconic" http://www.pyconic.com 21 | 768 Royalty-free vector icons, raster and font formats. When Pyconic launch 400 PNG Free Icons at 32px for your trouble. :) 22 | 23 | CONTACT: 24 | ------------------- 25 | Web: http://www.alessioatzeni.com 26 | Email: info@alessioatzeni.com 27 | Twitter: http://twitter.com/bluxart 28 | Twitter: http://twitter.com/pyconic 29 | 30 | -------------------------------------------------------------------------------- /public/stylesheets/style.css: -------------------------------------------------------------------------------- 1 | @import url(https://fonts.googleapis.com/css?family=Ubuntu:400,400italic,500,500italic,700,700italic,300italic,300); 2 | 3 | @font-face { 4 | font-family: 'MeteoconsRegular'; 5 | src: url('/weatherfont/meteocons-webfont.eot'); 6 | src: url('/weatherfont/meteocons-webfont.eot?#iefix') format('embedded-opentype'), 7 | url('/weatherfont/meteocons-webfont.woff') format('woff'), 8 | url('/weatherfont/meteocons-webfont.ttf') format('truetype'), 9 | url('/weatherfont/meteocons-webfont.svg#MeteoconsRegular') format('svg'); 10 | font-weight: normal; 11 | font-style: normal; 12 | 13 | } 14 | 15 | .weather-icon:before { 16 | font-family: 'MeteoconsRegular'; 17 | content: attr(data-icon); 18 | font-size: 50px; 19 | padding: 0px; 20 | margin: 0px; 21 | font-weight: normal; 22 | } 23 | 24 | body { 25 | background-color: #000; 26 | color: #EEE; 27 | padding: 0px 50px; 28 | font-family: "Ubuntu"; 29 | font-weight: 300; 30 | font-size: 18px 31 | } 32 | 33 | h1 { 34 | font-weight: 400; 35 | } 36 | 37 | a { 38 | color: #00B7FF; 39 | } 40 | 41 | .mirror-widget { 42 | padding:10px; 43 | text-align: right; 44 | } 45 | 46 | .content-area { 47 | text-align: left; 48 | } 49 | 50 | .weather-degrees { 51 | font-size: 40px; 52 | } 53 | .weather-text { 54 | font-size: 18px; 55 | color: #DDD; 56 | } 57 | .weather-location { 58 | margin-bottom: 45px; 59 | } 60 | 61 | .image-holder { 62 | float:left; 63 | padding:0 15px 15px 0; 64 | } -------------------------------------------------------------------------------- /routes/index.js: -------------------------------------------------------------------------------- 1 | var YQL = require('yql'); 2 | var express = require('express'); 3 | var fs = require('fs'); 4 | var router = express.Router(); 5 | var config = require("../config"); 6 | var magicMirror = require('../magicMirror'); 7 | var moment = require("moment"); 8 | 9 | 10 | // Prep YQL Query for Weather 11 | var yqlCities = "text=\""+config.weather.join("\" OR text=\"")+"\""; 12 | var yqlString = 'select * from weather.forecast where woeid in (select woeid from geo.places where '+yqlCities+')'; 13 | var query = new YQL(yqlString); 14 | /** 15 | * Variables later used in our markup 16 | */ 17 | var rowContent = []; 18 | 19 | /** 20 | * Actual Magic Mirror homepage 21 | */ 22 | router.get('/', function(req, res, next) { 23 | query.exec(function(err, data) { 24 | for(var i=0; data && i