Smart Homes made smarter with Javascript

Preview:

Citation preview

SMART HOMES MADE SMARTER WITH JAVASCRIPT

DevTeach MtlJuly 2016

Joel Lord - Spiria

05/01/2023 3

ABOUT ME Javascript Junkie Tinkerer Technology Enthusiast

@joel__lord

05/01/2023 4

ABOUT MEI <3 Gadgets

@joel__lord

05/01/2023 5

THE HOME AUTOMATION MARKET There are many options out there !

@joel__lord

05/01/2023 6

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

@joel__lord

05/01/2023 7

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

@joel__lord

05/01/2023 8

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

@joel__lord

05/01/2023 9

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

@joel__lord

05/01/2023 10

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

@joel__lord

05/01/2023 11

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

@joel__lord

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

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

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

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

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

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

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

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

05/01/2023 20

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

@joel__lord

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

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

05/01/2023 23

WINK ECOSYSTEM@joel__lord

05/01/2023 24

WINK ECOSYSTEM@joel__lord

05/01/2023 25

WINK ECOSYSTEM@joel__lord

05/01/2023 26

WINK DEMO@joel__lord

05/01/2023 27

WINK DEMO@joel__lord

Pretty limited

05/01/2023 28

WINK DEMO@joel__lord

Pretty limited Robots are the Wink equivalent to macros

05/01/2023 29

WINK DEMO@joel__lord

05/01/2023 30

WINK DEMO@joel__lord

05/01/2023 31

WINK DEMO@joel__lord

05/01/2023 32

WINK DEMO@joel__lord

05/01/2023 33

WINK DEMO@joel__lord

05/01/2023 34

WINK DEMO@joel__lord

05/01/2023 35

WINK DEMO@joel__lord

05/01/2023 36

LET’S MAKE IT SMARTER@joel__lord

Integration with Amazon Echo

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

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

05/01/2023 39

IFTTT DEMO@joel__lord

http://cl.ly/300R1310191F

05/01/2023 40

AND EVEN MORE SMART !@joel__lord

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

05/01/2023 41

AND EVEN MORE SMART !@joel__lord

We need : Variables Functions More third party integrations

05/01/2023 42

INTRODUCING WINKJS@joel__lord

REST API Uses OAUTH More or less standard API objects

05/01/2023 43

INTRODUCING WINKJS@joel__lord

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

05/01/2023 44

INTRODUCING WINKJS@joel__lord

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

05/01/2023 45

INTRODUCING WINKJS@joel__lord

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

05/01/2023 46

INTRODUCING WINKJS@joel__lord

05/01/2023 47

INTRODUCING WINKJS@joel__lord

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

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

05/01/2023 50

HOW ABOUT SECURITY?@joel__lord

You have to be intentional

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

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.

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

05/01/2023 54

THANK YOU@joel__lord

Questions?

Follow me on Twitter for the full slides @joel__lord

^- Yup, two underscores

Recommended