Node home automation with Node.js and MQTT

Post on 11-Apr-2017

968 views 5 download

Transcript of Node home automation with Node.js and MQTT

Michael Dawson

December 2015

Home Automation with Nodeand MQTT

About Michael Dawson Loves the web and building software

2

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

Contact me:

Michael_dawson@ca.ibm.comTwitter: @mhdawson1https://www.linkedin.com/pub/michael-dawson/2/128/605

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

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/#

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

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

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

Node + MQTT =

8

Receive

Send

Interacting with the Physical World

9

RX

TX

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

Interacting with the Physical World

11

Notification and Reporting

12

Notifications and Reporting - SMS

13

Deploy your own for free

14

Node Broker Webserver

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.