Smart Homes made smarter with Javascript

53
SMART HOMES MADE S MARTER WITH JAVASC RIPT DevTeach Mtl July 2016 Joel Lord - Spiria

Transcript of Smart Homes made smarter with Javascript

Page 1: Smart Homes made smarter with Javascript

SMART HOMES MADE SMARTER WITH JAVASCRIPT

DevTeach MtlJuly 2016

Joel Lord - Spiria

Page 2: Smart Homes made smarter with Javascript

05/01/2023 3

ABOUT ME Javascript Junkie Tinkerer Technology Enthusiast

@joel__lord

Page 3: Smart Homes made smarter with Javascript

05/01/2023 4

ABOUT MEI <3 Gadgets

@joel__lord

Page 4: Smart Homes made smarter with Javascript

05/01/2023 5

THE HOME AUTOMATION MARKET There are many options out there !

@joel__lord

Page 5: Smart Homes made smarter with Javascript

05/01/2023 6

THE HOME AUTOMATION MARKET There are many options out there ! Nest

@joel__lord

Page 6: Smart Homes made smarter with Javascript

05/01/2023 7

THE HOME AUTOMATION MARKET There are many options out there ! Nest GE

@joel__lord

Page 7: Smart Homes made smarter with Javascript

05/01/2023 8

THE HOME AUTOMATION MARKET There are many options out there ! Nest GE Philips

@joel__lord

Page 8: Smart Homes made smarter with Javascript

05/01/2023 9

THE HOME AUTOMATION MARKET There are many options out there ! Nest GE Philips Insteon

@joel__lord

Page 9: Smart Homes made smarter with Javascript

05/01/2023 10

THE HOME AUTOMATION MARKET There are many options out there ! Nest GE Philips Insteon Samsung SmartThings

@joel__lord

Page 10: Smart Homes made smarter with Javascript

05/01/2023 11

THE HOME AUTOMATION MARKET There are many options out there ! Nest GE Philips Insteon Samsung SmartThings Belkin Wemo

@joel__lord

Page 11: Smart Homes made smarter with Javascript

05/01/2023 12

THE HOME AUTOMATION MARKET There are many options out there ! Nest GE Philips Insteon Samsung SmartThings Belkin Wemo iRobot

@joel__lord

Page 12: Smart Homes made smarter with Javascript

05/01/2023 13

THE HOME AUTOMATION MARKET There are many options out there ! Nest GE Philips Insteon Samsung SmartThings Belkin Wemo iRobot Schlage

@joel__lord

Page 13: Smart Homes made smarter with Javascript

05/01/2023 14

THE HOME AUTOMATION MARKET There are many options out there ! Nest GE Philips Insteon Samsung SmartThings Belkin Wemo iRobot Schlage Lutron

@joel__lord

Page 14: Smart Homes made smarter with Javascript

05/01/2023 15

THE HOME AUTOMATION MARKET There are many options out there ! Nest GE Philips Insteon Samsung SmartThings Belkin Wemo iRobot Schlage Lutron Zigbee

@joel__lord

Page 15: Smart Homes made smarter with Javascript

05/01/2023 16

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

Page 16: Smart Homes made smarter with Javascript

05/01/2023 17

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

Page 17: Smart Homes made smarter with Javascript

05/01/2023 18

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

Page 18: Smart Homes made smarter with Javascript

05/01/2023 19

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

Page 19: Smart Homes made smarter with Javascript

05/01/2023 20

WINK ECOSYSTEM Connect various devices from various providers within a single application

@joel__lord

Page 20: Smart Homes made smarter with Javascript

05/01/2023 21

WINK ECOSYSTEM Connect various devices from various providers within a single application

But even better… They have an API

@joel__lord

Page 21: Smart Homes made smarter with Javascript

05/01/2023 22

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

@joel__lord

Page 22: Smart Homes made smarter with Javascript

05/01/2023 23

WINK ECOSYSTEM@joel__lord

Page 23: Smart Homes made smarter with Javascript

05/01/2023 24

WINK ECOSYSTEM@joel__lord

Page 24: Smart Homes made smarter with Javascript

05/01/2023 25

WINK ECOSYSTEM@joel__lord

Page 25: Smart Homes made smarter with Javascript

05/01/2023 26

WINK DEMO@joel__lord

Page 26: Smart Homes made smarter with Javascript

05/01/2023 27

WINK DEMO@joel__lord

Pretty limited

Page 27: Smart Homes made smarter with Javascript

05/01/2023 28

WINK DEMO@joel__lord

Pretty limited Robots are the Wink equivalent to macros

Page 28: Smart Homes made smarter with Javascript

05/01/2023 29

WINK DEMO@joel__lord

Page 29: Smart Homes made smarter with Javascript

05/01/2023 30

WINK DEMO@joel__lord

Page 30: Smart Homes made smarter with Javascript

05/01/2023 31

WINK DEMO@joel__lord

Page 31: Smart Homes made smarter with Javascript

05/01/2023 32

WINK DEMO@joel__lord

Page 32: Smart Homes made smarter with Javascript

05/01/2023 33

WINK DEMO@joel__lord

Page 33: Smart Homes made smarter with Javascript

05/01/2023 34

WINK DEMO@joel__lord

Page 34: Smart Homes made smarter with Javascript

05/01/2023 35

WINK DEMO@joel__lord

Page 35: Smart Homes made smarter with Javascript

05/01/2023 36

LET’S MAKE IT SMARTER@joel__lord

Integration with Amazon Echo

Page 36: Smart Homes made smarter with Javascript

05/01/2023 37

LET’S MAKE IT SMARTER@joel__lord

Integration with Amazon Echo Integration with IFTTT Either using the Maker Channel Or using a third party

Page 37: Smart Homes made smarter with Javascript

05/01/2023 38

INTRODUCING IFTTT@joel__lord

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

Page 38: Smart Homes made smarter with Javascript

05/01/2023 39

IFTTT DEMO@joel__lord

http://cl.ly/300R1310191F

Page 39: Smart Homes made smarter with Javascript

05/01/2023 40

AND EVEN MORE SMART !@joel__lord

Let’s make it even smarter We need more control over our things

Page 40: Smart Homes made smarter with Javascript

05/01/2023 41

AND EVEN MORE SMART !@joel__lord

We need : Variables Functions More third party integrations

Page 41: Smart Homes made smarter with Javascript

05/01/2023 42

INTRODUCING WINKJS@joel__lord

REST API Uses OAUTH More or less standard API objects

Page 42: Smart Homes made smarter with Javascript

05/01/2023 43

INTRODUCING WINKJS@joel__lord

Door Lock object { last_reading: { locked: true }, desired_state: { }}

Page 43: Smart Homes made smarter with Javascript

05/01/2023 44

INTRODUCING WINKJS@joel__lord

Thermostat object { last_reading: { temperature: "18.5", units: "C" }, desired_state: { }}

Page 44: Smart Homes made smarter with Javascript

05/01/2023 45

INTRODUCING WINKJS@joel__lord

Light Bulb object { last_reading: { brightness: 0.5, powered: true }, desired_state: { }}

Page 45: Smart Homes made smarter with Javascript

05/01/2023 46

INTRODUCING WINKJS@joel__lord

Page 46: Smart Homes made smarter with Javascript

05/01/2023 47

INTRODUCING WINKJS@joel__lord

Page 47: Smart Homes made smarter with Javascript

05/01/2023 48

INTRODUCING WINKJS@joel__lord

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(); });

Page 48: Smart Homes made smarter with Javascript

05/01/2023 49

INTRODUCING WINKJS@joel__lord

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(); } });

Page 49: Smart Homes made smarter with Javascript

05/01/2023 50

HOW ABOUT SECURITY?@joel__lord

You have to be intentional

Page 50: Smart Homes made smarter with Javascript

05/01/2023 51

HOW ABOUT SECURITY?@joel__lord

You have to be intentional Keep in mind that you are exposing your home lights to hackers

Page 51: Smart Homes made smarter with Javascript

05/01/2023 52

HOW ABOUT SECURITY?@joel__lord

You have to be intentional Keep in mind that you are exposing your home lights to hackers Or worse… your front door lock.

Page 52: Smart Homes made smarter with Javascript

05/01/2023 53

HOW ABOUT SECURITY?@joel__lord

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

Page 53: Smart Homes made smarter with Javascript

05/01/2023 54

THANK YOU@joel__lord

Questions?

Follow me on Twitter for the full slides @joel__lord

^- Yup, two underscores