making smart homes smarter with javascript
TRANSCRIPT
Smart Homes Made Smarter
With JSJoel LordGuidebook app:
NEPHP2016
www.spiria.com
Smart Homes Made Smarter With Javascript
Presented ByJOEL LORD
North East PHP 2016, Charlottetown, PE
August 5th, 2016
#NEPHP@joel__lord
JOEL LORDAbout me, eh?
• Javascript Junkie• Tinkerer• Technology enthusiast
#NEPHP@joel__lord
#NEPHP@joel__lord
JOEL LORDAbout me, eh?
• Javascript Junkie• Tinkerer• Technology enthusiast
#NEPHP@joel__lord
AGENDA Wink EcosystemMacros (or Robots)IFTTTIntroducing WinkJSDemosQ&A
#NEPHP@joel__lord
I <3 GADGETSAbout me, eh?
State of the MarketHOME AUTOMATION
#NEPHP@joel__lord
The Home automation market
• There are many options out there !
@joel__lord
#NEPHP@joel__lord
The Home automation market
• There are many options out there !• Nest
@joel__lord
#NEPHP@joel__lord
The Home automation market
• There are many options out there !• Nest• GE
@joel__lord
#NEPHP@joel__lord
The Home automation market
• There are many options out there !• Nest• GE• Philips
@joel__lord
#NEPHP@joel__lord
The Home automation market
• There are many options out there !• Nest• GE• Philips• Insteon
@joel__lord
#NEPHP@joel__lord
The Home automation market
• There are many options out there !• Nest• GE• Philips• Insteon• Samsung SmartThings
@joel__lord
#NEPHP@joel__lord
The Home automation market
• There are many options out there !• Nest• GE• Philips• Insteon• Samsung SmartThings• Belkin Wemo
@joel__lord
#NEPHP@joel__lord
The Home automation market
• There are many options out there !• Nest• GE• Philips• Insteon• Samsung SmartThings• Belkin Wemo• iRobot
@joel__lord
#NEPHP@joel__lord
The Home automation market
• There are many options out there !• Nest• GE• Philips• Insteon• Samsung SmartThings• Belkin Wemo• iRobot• Schlage
@joel__lord
#NEPHP@joel__lord
The Home automation market
• There are many options out there !• Nest• GE• Philips• Insteon• Samsung SmartThings• Belkin Wemo• iRobot• Schlage• Lutron
@joel__lord
#NEPHP@joel__lord
The Home automation market
• There are many options out there !• Nest• GE• Philips• Insteon• Samsung SmartThings• Belkin Wemo• iRobot• Schlage• Lutron• Zigbee
@joel__lord
#NEPHP@joel__lord
The Home automation market
• There are many options out there !• Nest• GE• Philips• Insteon• Samsung SmartThings• Belkin Wemo• iRobot• Schlage• Lutron• Zigbee• Z-wave
@joel__lord
#NEPHP@joel__lord
The Home automation market
• There are many options out there !• Nest• GE• Philips• Insteon• Samsung SmartThings• Belkin Wemo• iRobot• Schlage• Lutron• Zigbee• Z-wave• X10
@joel__lord
#NEPHP@joel__lord
The Home automation market
• There are many options out there !• Nest• GE• Philips• Insteon• Samsung SmartThings• Belking Wemo• iRobot• Schlage• Lutron• Zigbee• Z-wave• X10
@joel__lord
#NEPHP@joel__lord
The home automation market
• Each device has it’s own app• Soon, your phone is a mess and you can’t control your
devices
@joel__lord
#NEPHP@joel__lord
Wink ecosystem
• Connect various devices from various providers within a single application
• 05/01/2023
• 24
@joel__lord
#NEPHP@joel__lord
Wink ecosystem
• Connect various devices from various providers within a single application
• But even better…
• 05/01/2023
• 25
@joel__lord
#NEPHP@joel__lord
Wink ecosystem
• Connect various devices from various providers within a single application
• But even better… They have an API
• 05/01/2023
• 26
@joel__lord
#NEPHP@joel__lord
Wink ecosystem
• Connect various devices from various providers within a single application
• But even better… They have an API• It’s not what you do with it that counts, it’s what you can
do
• 05/01/2023
• 27
@joel__lord
#NEPHP@joel__lord
Wink ecosystem
• 05/01/2023
@joel__lord
• 28
#NEPHP@joel__lord
Wink ecosystem
• 05/01/2023
@joel__lord
• 29
#NEPHP@joel__lord
Wink ecosystem
• 05/01/2023
@joel__lord
• 30
#NEPHP@joel__lord
Wink demo
• 05/01/2023
• 31
@joel__lord
#NEPHP@joel__lord
Wink demo
• 05/01/2023
@joel__lord
• 32
• Pretty limited
#NEPHP@joel__lord
Wink demo
• 05/01/2023
@joel__lord
• 33
• Pretty limited• Robots are the Wink equivalent to macros
Wink RobotsMAKE IT SMARTER
#NEPHP@joel__lord
Wink demo
• 05/01/2023
@joel__lord
• 35
#NEPHP@joel__lord
Wink demo
• 05/01/2023
@joel__lord
• 36
#NEPHP@joel__lord
Wink demo
• 05/01/2023
@joel__lord
• 37
#NEPHP@joel__lord
Wink demo
• 05/01/2023
@joel__lord
• 38
#NEPHP@joel__lord
Wink demo
• 05/01/2023
@joel__lord
• 39
#NEPHP@joel__lord
Wink demo
• 05/01/2023
@joel__lord
• 40
#NEPHP@joel__lord
Wink demo
• 05/01/2023
@joel__lord
• 41
IFTTT IntegrationMAKE IT SMARTER
#NEPHP@joel__lord
Let’s make it smarter
• 05/01/2023
@joel__lord
• 43
• Integration with Amazon Echo• Integration with IFTTT
– Either using the Maker Channel– Or using a third party
#NEPHP@joel__lord
Introducing IFTTT
• 05/01/2023
@joel__lord
• 44
• IFTTT is a free web-based service that allows users to create chains of simple conditional statements, called "recipes", which are triggered based on changes to other web services such as Gmail, Facebook, Instagram, and Pinterest. IFTTT is an abbreviation of "If This Then That"
•-Wikipedia
#NEPHP@joel__lord
IFTTT demo
• 05/01/2023
@joel__lord
• 45
• http://cl.ly/300R1310191F
#NEPHP@joel__lord
And even more smart !
• 05/01/2023
@joel__lord
• 46
• Let’s make it even smarter• We need more control over our things
#NEPHP@joel__lord
And even more smart !
• 05/01/2023
@joel__lord
• 47
• We need :– Variables– Functions– More third party integrations
Introducing WinkJsMAKE IT SMARTER
#NEPHP@joel__lord
Introducing Winkjs
• 05/01/2023
@joel__lord
• 49
• REST API• Uses OAUTH• More or less standard API objects
#NEPHP@joel__lord
Introducing winkjs
• 05/01/2023
@joel__lord
• 50
• Door Lock object
{ last_reading: { locked: true }, desired_state: { }}
#NEPHP@joel__lord
Introducing winkjs
• 05/01/2023
@joel__lord
• 51
• Thermostat object
{ last_reading: { temperature: "18.5", units: "C" }, desired_state: { }}
#NEPHP@joel__lord
Introducing winkjs
• 05/01/2023
@joel__lord
• 52
• Light Bulb object
{ last_reading: { brightness: 0.5, powered: true }, desired_state: { }}
#NEPHP@joel__lord
Introducing winkjs
• 05/01/2023
@joel__lord
• 53
#NEPHP@joel__lord
Introducing winkjs
• 05/01/2023
@joel__lord
• 54
#NEPHP@joel__lord
Introducing winkjs
• 05/01/2023
@joel__lord
• 55
• A simple Hello World
var Wink = require("wink"); var apiCredentials = require("./credentials");
var wink = new Wink(apiCredentials);
wink.on("ready", function() { var light = wink.getDeviceByName("Light1"); light.off(); });
#NEPHP@joel__lord
Introducing winkjs
• 05/01/2023
@joel__lord
• 56
• A Twitter integration
//Web server var express = require("express"); var app = express(); var server = require("http").createServer(app); var twit = require("twit"); var keyword = "#devteach"; var Wink = require("../lib"); var apiCredentials = require("./credentials"); var twitterCredentials = require("./twitterCredentials");
var wink = new Wink(apiCredentials); //Web socket var port = 3333; //Start server server.listen(port, function () { console.log("Server started on port " + port); }); //Twitter Stream listener var t = new twit(twitterCredentials); var stream = t.stream("statuses/filter", {track: keyword}); var lights = []; var winkReady = false; wink.on("ready", function(devices) { console.log("ready"); winkReady = true; lights.push(wink.getDeviceByName("WinkPresentationLight1")); lights.push(wink.getDeviceByName("WinkPresentationLight2")); }); stream.on("tweet", function (tweet) { console.log("Got tweet"); if (winkReady) { var lightIndex = Math.round(Math.random()); console.log("Toggling light #" + lightIndex); lights[lightIndex].toggle(); } });
IT’S CODING TIME!LET’S GET SERIOUS
IT’S CODING TIME!LET’S GET SERIOUS
#NEPHP@joel__lord
How about Security?
• 05/01/2023
@joel__lord
• 59
• You have to be intentional
#NEPHP@joel__lord
How about Security?
• 05/01/2023
@joel__lord
• 60
• You have to be intentional• Keep in mind that you are exposing your home lights to
hackers
#NEPHP@joel__lord
How about Security?
• 05/01/2023
@joel__lord
• 61
• You have to be intentional• Keep in mind that you are exposing your home lights to
hackers• Or worse… your front door lock.
#NEPHP@joel__lord
How about Security?
• 05/01/2023
@joel__lord
• 62
• Killing a Jeep on the highway: https://www.wired.com/2015/07/hackers-remotely-kill-jeep-highway/
• Hacking smart door bells: http://thehackernews.com/2016/01/doorbell-hacking-wifi-pasword.html
DOCUMENT CONFIDENTIEL, TOUT DROIT RÉSERVÉ
PRESENTED BY
The End !
Questions ?
JOEL LORDAugust 2016
TWITTER: @JOEL__LORDGITHUB: HTTP://GITHUB.COM/JOELLORD
http://bit.ly/2au33dH