15
Michael Dawson December 2015 Home Automation with Node and MQTT

Node home automation with Node.js and MQTT

Embed Size (px)

Citation preview

Page 1: Node home automation with Node.js and MQTT

Michael Dawson

December 2015

Home Automation with Nodeand MQTT

Page 2: Node home automation with Node.js and MQTT

About Michael Dawson Loves the web and building software

2

Senior Software Developer @ IBM22 years development experience10 years in runtime development

Contact me:

[email protected]: @mhdawson1https://www.linkedin.com/pub/michael-dawson/2/128/605

Page 3: Node home automation with Node.js and MQTT

3

• Internet of Things (IoT) • network of physically connected devices (things)• devices provide data• devices can be controlled• https://en.wikipedia.org/wiki/Internet_of_Things

• MQTT (MQ Telemetry Transport)• lightweight publish/subscribe• small footprint• low bandwidth (minimum size is 2 bytes)• From http://mqtt.org/

• “MQTT is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol”

Introduction

Async

Page 4: Node home automation with Node.js and MQTT

4

• Topics - series of topic levels separated by ‘/’

• Messages

• QoS 0 – best effort, 1 – deliver at least once, 2 – deliver exactly once

MQTT

house/alarm/statushouse/alarm/zone

house/camera/capturehouse/camera/newpicture

house/camera/+

FFFFF110002-1433990729.jpg

house/2262/1house/2262/2home/2272

house/2262/#

Page 5: Node home automation with Node.js and MQTT

5

• Security• deviceid/userid/password• TLS/Certificates

• Clients• https://www.npmjs.com/package/mqtt• Paho - http://www.eclipse.org/paho/

• Brokers• Mosca https://www.npmjs.com/package/mosca• Mosquitto - http://mosquitto.org/

• IoT Services – ex bluemix

MQTT

Page 6: Node home automation with Node.js and MQTT

6

• Approach • Glue devices together with MQTT• Control/Smarts in Node

• Open Source• https://github.com/mhdawson/HomeAlarm• https://github.com/mhdawson/PI433WirelessTXManager• https://github.com/mhdawson/PI433WirelessRecvManager• https://github.com/mhdawson/PIWebcamServer• https://github.com/mhdawson/PI433-RX-TX-Temp-board (Hardware)

• https://github.com/mhdawson/HouseDashboard• https://github.com/mhdawson/PILocalTemp

Home Automation with MQTT and Node

Page 7: Node home automation with Node.js and MQTT

Home Automation with MQTT and Node - Alarm

7

USB

433 MHz

docker

MQTT(mosquito)

docker

HTTP(apache2)

docker/bluemix

Alarm(Node)

SCP

Browser

HTTPs

HTTPs+

Websockets

MQTT+

SSL/TLS

PI443-TX

PI443-RX

PIWebcam

TwillioSMS

Page 8: Node home automation with Node.js and MQTT

Node + MQTT =

8

Receive

Send

Page 9: Node home automation with Node.js and MQTT

Interacting with the Physical World

9

RX

TX

Page 10: Node home automation with Node.js and MQTT

Interacting with the Physical World

10

zone=house/2262/1:3:front door

zone=house/2262/2:4:patio door

zone=house/2262/3:2:motion living

zone=house/2262/4:1:motion hall

zone=house/2262/5:5:fire

Page 11: Node home automation with Node.js and MQTT

Interacting with the Physical World

11

Page 12: Node home automation with Node.js and MQTT

Notification and Reporting

12

Page 13: Node home automation with Node.js and MQTT

Notifications and Reporting - SMS

13

Page 14: Node home automation with Node.js and MQTT

Deploy your own for free

14

Node Broker Webserver

Page 15: Node home automation with Node.js and MQTT

Copyrights and Trademarks

© IBM Corporation 2015. All Rights Reserved

IBM, the IBM logo, ibm.com are trademarks or registered

trademarks of International Business Machines Corp.,

registered in many jurisdictions worldwide. Other product and

service names might be trademarks of IBM or other companies.

A current list of IBM trademarks is available on the Web at

“Copyright and trademark information” at

www.ibm.com/legal/copytrade.shtml

Node.js is an official trademark of Joyent. IBM SDK for Node.js is not formally

related to or endorsed by the official Joyent Node.js open source or

commercial project.

Java, JavaScript and all Java-based trademarks and logos are trademarks or

registered trademarks of Oracle and/or its affiliates.