Smart Home Live: Intelligent Detection of Fire or a Break-In with MQTT and OpenHAB

49
Smart Home Live: Intelligent Detection of Fire or a Break-In with MQTT and OpenHAB

Transcript of Smart Home Live: Intelligent Detection of Fire or a Break-In with MQTT and OpenHAB

Smart Home Live: Intelligent Detection of Fire or a Break-In with MQTT and OpenHAB

Support their clients to successfully transform their

business in a digitized and connected world

expertise in MQTT the protocol that drives the internet of things

Consulting for insurance companies and other industries

Consulting and Creating of Building Block for the Internet of Things

About us

SMART HOME LIVE

"

MOTIVATION

1

•  Showcase objectives •  Fire dangers

"

OVERVIEW

2

•  1st live demo - maintenance features •  Basic architecture

"

SETUP

3

•  Architectural details •  2nd live demo – break-in

detection

"

CONCLUSION

4

•  Lessons learned •  Outlook

Evaluate available technologies like MQTT, Eclipse SmartHome

We are not building a product!

Iterate and explore key features for an intelligent smart home

Showcase objectives

Fires are life threatening dangerous

"400 deaths

!

"4000 injured !

"200.000

!

€ 1 billion

!

3 breaths can be sufficient to die

1 breath can have lifelong consequences

“Where there's fire there's smoke”

of fires start at night where

human‘s sense of smell is asleep

70 %

Fire! Time to leave!

4 min 2 min

SMOKE DETECTORS are mandatory

In Germany 2018

In France 2015

In USA 2010

h#p://www.fusac.fr/countdown3smoke3detectors/!h#p://www.rauchmelderpflicht.eu/download/Uebersicht_Rauchmelderpflicht.pdf!

Simple solution Advanced solution

vs.

Some ideas for improvements

01 Maintenance 02 03 Connectivity Improved security

Showtime !

Inside of the House Outside of the House

Basic Architecture

Architectural Details - Outside of the house

Subscribe

Publish

temperature sensor

MQTT-Broker

laptop

mobile device

publish: “21°C“publish: “21°C“

publish: “21°C“

subscribe

subscribe

1 subscribe totopic: “temperature“ 2 publish to

topic: “temperature“

Why MQTT ?

Bandwidth Efficient

Push Capability Works great behind a Firewall

Quality of Service Levels

Quality of Service

Topics – Topic Tree

myhome!

livingroom!

bedroom!

smoke3detector!

temperature!

smoke3detector!

temperature!

/! /!

otherhome!

Topics

myhome!

livingroom!

bedroom!

smoke3detector!

temperature!

smoke3detector!

temperature!

/! /!

otherhome!

Topics

myhome!

livingroom!

bedroom!

smoke3detector!

temperature!

smoke3detector!

temperature!

/! /!

otherhome!

Topics

myhome!

livingroom!

bedroom!

smoke3detector!

temperature!

smoke3detector!

temperature!

/! /!

otherhome!

Topics

myhome!

livingroom!

bedroom!

smoke3detector!

temperature!

smoke3detector!

temperature!

/! /!

otherhome!

Topics

myhome!

livingroom!

bedroom!

smoke3detector!

temperature!

smoke3detector!

temperature!

/! /!

otherhome!

• Open!Source!•  “Reference!ImplementaEon”!• Many!languages:!Java,!Javascript,!Lua,!C,!C++,!Go,!Python!!• AcEve!Community!

Eclipse Paho

Now some code!!

MQTT Publish

MqttClient mqttClient = new MqttClient

("tcp://localhost:1883", “publisher");

mqttClient.connect();

mqttClient.publish(“test","test123".getBytes(),0, true);

MQTT Subscribe

MqttCallback mqttCallback = new MqttCallback() { @Override

public void messageArrived(String topic, MqttMessage mqttMessage) {

System.out.println(topic +" "+ new String(mqttMessage.getPayload())); }

}; MqttClient mqttClient = new MqttClient("tcp://localhost:1883", “subscriber"); mqttClient.setCallback(mqttCallback); mqttClient.connect(); mqttClient.subscribe(“test",2);

MQTT broker

HiveMQ – at a glance

High Performance MQTT Broker ! ! Open Plugin System

Highly Scalable ! ! Supports Bridge Protocol

Clustering ! ! Native Websockets Support

MQTT Architecture

Publish •  Testalarm

Subscribe •  Alarm •  Status •  Battery Status

Publish •  Alarm •  Status •  Battery Status

Subscribe •  Testalarm

Webdashboard

Emergency Service

any API

SMS (Twilio)

Integration of other Services

SQL/NOSQL!

Mobile!Devices!

MQTT!

P!L!U!G!I!N!

JDBC/other

HTTP

MQTT!over!Websockets!

MQTT!

Architectural Details - Inside the house

Smart Home Devices

Communication •  868 MHz •  BidCoS®-Protocol

(„Bidirectional Communication Standard“)

•  Supports „AES signed commands“

Devices •  Brand: HomeMatic •  Sold by eq-3 (ELV) •  Readily available •  Many different devices

Hardware

Software

Inside the House

Homegear

(v1.6.0)!

(v0.5.732)!

Raspberry Pi (Modell B) CPU: ARM1176JZF-S (700 MHz) RAM: 512 MB Power: 5 V, 700 mA (3,5 W)

Busware CCD •  CC1101 transceiver •  ILI9341 based 2.8" TFT

Touch Display •  culfw firmware

Extras •  Transparent case

(busware) •  WiFi-Stick •  Antenna

Hardware

Software

Inside the House

Homegear

(v1.6.0)!

(v0.5.2436)!

Raspberry Pi 2 (Modell B) CPU: ARM Cortex-A7

(4 x 900 MHz) RAM: 1024 MB Power: 5 V, 800 mA (4 W)

Busware CCD •  CC1101 transceiver •  ILI9341 based 2.8" TFT

Touch Display •  culfw firmware

Extras •  Transparent case

(busware) •  WiFi-Stick •  Antenna

OpenHAB by Example

“openHAB is a software for integrating different home automation systems and technologies into one single

solution”

Core%Components%

Items% Protocol%Bindings% Automa6on%Logic%

Core Components were moved to eclipse:

OpenHAB by Example

Core%Components%

Items% Protocol%Bindings% Automa6on%Logic%

Alert!

Ba#e

ry!Status!

Homem

aEc!

MQTT!

Raise

!Alarm

!

Prop

agate!

Alarm!

Again some code!!

Item definitions

/* Item format

TYPE ITEMNAME LABEL ICON (GROUPS) {BINDINGS}

*/

/* Group definitions */

Group:Switch:OR(ON,OFF) FireAlertDevices "Brandmelder"

/* Example item with binding */

Switch SmokeDetector1_Fire "Feueralarm Schlafzimmer" <fire> \ (FireAlertDevices,Schlafzimmer) \ {homematic="id=JEQ0736552, channel=1, parameter=STATE"}

Rule definitions

rule "Send MQTT messages on alerts" when

Item FireAlertDevices changed then

if (FireAlertDevices.state == ON) { // we find the alerting sd and only send an alert for the "first responder" var alertingSd = FireAlertDevices?.members.findFirst(sd|sd.state == ON) var String mqttItemName = "MQTT_" + alertingSd.name logDebug("MQTT", "Notifying mqtt item '{}'", mqttItemName)

postUpdate(mqttItemName, "ON") } else { logWarn("FireAlertDevices", "Ignored state change to " + FireAlertDevices.state) }

end

Integration with other components

It!might!get!loud!!

STEPS TO PRODUCTION

Hardening / Security Cloud TLS, Authentication, Authorization, High Availability

01

Encrypt Inhouse Communication 02

Sophisticated Hardware 03

Platform Improvements 04

Lessons Learned

! POSSIBLE TO BUILD A SOLUTION WITHOUT MUCH CODING

! THE SMART HOME WORLD IS CHANGING RAPIDLY

!INTERESTING OPEN SOURCE SMART HOME TECHNOLOGIES OUT THERE

!FOCUS ON ADDED VALUE AND INTEGRATE CERTIFIED SECURITY SOLUTIONS

THANK YOU

!