openhab grafana and influxdb
TRANSCRIPT
IOT&HOME AUTOMATION WARSAW
PROJECT
DATE CLIENT2017.07.24
OPENHAB INFLUX UND GRAFANABACNET DATASOURCE
DISCLAIMERTECH STUFF IS SUBJECT OF CHANGE OVER TIME AND MIGHT NOT BE 100% RELEVANT NOW. CHECK BEFORE USE. VIEWS ARE MY OWN.
GARTNER HYPE CYCLE 2016
HOW ABOUT SMART HOMES?
“Adoption of newer connected home solutions is still at the early adopter phase,
according to a recent survey by Gartner, Inc. The survey, of nearly 10,000 online
respondents in the U.S., the U.K. and Australia during the second half of 2016,
found that only about 10 percent of households currently have connected home
solutions.”–Gartner
source http://www.gartner.com/newsroom/id/3629117
WHERE WORLD IS GOING
Global Google Trends 2011-2017
source https://trends.google.com/trends/explore?date=2011-06-23%202017-07-23&q=smart%20home
WHERE POLAND IS GOING
Local Google Trends 2011-2017
source https://trends.google.com/trends/explore?date=2011-06-23%202017-07-23&geo=PL&q=inteligentny
%20dom
SMART HOME, IOT AND HOME AUTOMATIONIS LIKE TEENAGERS SEX, (GLOBALLY) EVERYONE WANTS IT, EVERYONE TALKS ABOUT IT, VERY LITTLE ACTUALLY DO IT
SO LETS TALK ABOUT IT
FOUNDED IN 2010source openhab.org
story https://www.slideshare.net/egutierrezru/javamagazine20131112-dl
HOME AUTOMATION BUS
source https://docs.oracle.com/cd/E17904_01/doc.1111/e15020/introduction.htm#OSBCA122
Enteprise Service Bus
OPENHAB 1.X ARCHITECTURE IS RELEVANT AND 2.X USES SAME CONCEPTWHAT IS DIFFERENT THEN?
BINDING INTERNALS
NEW THING CONCEPT
What is present with OH 1.x
Item Registry
Binding Provider
Remarks
One thing (device) may have multiple channels
Things have a state
Item is linked to an channel
One bridge wires one or more things
Bridge is optional
Thing state diagram
Main improvements in 2.xUser perspective
Lower entry level
Discovery of things
Developer perspective
Cleaner separation of concerns
A bit more declarative approach (XML definitions)
(Slightly bigger framework complication)
BACNETBUILDING AUTOMATION AND CONTROL NETWORK
“BACnet was designed to allow communication of building automation and
control systems for applications such as heating, ventilating, and air-conditioning control (HVAC), lighting control, access
control, and fire detection systems and their associated equipment. The BACnet protocol
provides mechanisms for computerised building automation devices to exchange information, regardless of the particular
building service they perform.”source https://en.wikipedia.org/wiki/BACnet
Remarks
Started in 1987
ANSI standard since 1995
ISO standard since 2003
Most popular in HVAC area
OSI layers
Physical
Data link
network
Application
Shortcut Map
source BACnet specification
BACnet Application Layer
source https://sunilsavanur.wordpress.com/2012/08/12/
BACnet object typesAnalog Input/Output/Value
Binary Input/Output/Value
Multi-state Input/Output/Value
Averaging
Command
File
…… 60 standard object types
source http://www.bacnet.org/
BACnet services
File Access
Object Access
Read/Write property
Remote device management
Virtual terminal
.. etc
source http://www.bacnet.org/
BACnet IP frame(IP header)
source http://www.bacnet.org/
BACnet frame(Virtual Network)
source http://www.bacnet.org/
BACnet IP frame(Network Protocol)
source http://www.bacnet.org/
BACnet APDU typesUnconfirmed PDU
Confirmed PDU
Simple-ACK PDU
Complex-ACK PDU
Segment-ACK PDU
Reject PDU
Error PDU
Abort PDU
source http://www.bacnet.org/
DEPLOYMENT
THE UNIT
Thing
THE UNIT
Thing
Bridge THE UNIT
Thing
Bridge
extra one wire sensors
THE UNIT
Measurements
Copy of dashboard data
Preview of copy of this dashboard available online:https://snapshot.raintank.io/dashboard/snapshot/NCCJk3J79xsWtaRXlbI8Kj6u2Wnp3fas?refresh=30s&orgId=2
GrafanaData visualisation tool
Supports multiple data sources
InfluxDB
Graphite
Elasticsearch
Can draw a bar, pie charts as well as expose single values
InfluxDB
Timeseries database
SQL-a-like query language
WHAT I DID
I GOOGLED FOR JAVA LIB IN SPRING 2016
C library
Fork of 1st result
Legacy
I LOOKED AT MVNREPOSITORY.COM
NO EXAMPLES NO TESTS NO SUPPORT, POOR DOCUMENTATION
WITH PROPER QUERY GOOGLE GOT IT
With some love I made it deployable
BUT IT DIDNT WORK
BACNET4J IS/WAS THREAD SENSITIVE
I BOUGHT BAC SPECIFICATION
I BOUGHT BAC SPECIFICATION
I WRAPPED BACNET4J LOGIC
Raw bacnet main() used during tests https://gist.github.com/splatch/3216feba4bcad3cfd741644552f93870
HOW IT WORKS
Items (OH 1.x syntax)Number Air_Flow "Temperatura nawiewu [%.1f] °C" <temperature> (Ventilation) { bacnet="device=2251,type=analogInput,id=0,refreshInterval=10000" }
Number Air_Recirculation "Wymiennik [%.1f]%" <fan> (Ventilation) { bacnet="device=2251,type=analogOutput,id=1" }
Number Air_Suply_Fan "Wentylator nawiew. [%.1f]%" <fan> (Ventilation) { bacnet="device=2251,type=analogOutput,id=2,refreshInterval=1000" }
Number Air_Exhaust_Fan "Wentylator wywiew. [%.1f]%" <fan> (Ventilation) { bacnet="device=2251,type=analogOutput,id=3,refreshInterval=1000" }
Persistence configurationStrategies {
everyMinute : "0 * * * * ?"
default=everyUpdate, restoreOnStartup
}
Items {
* : strategy = everyUpdate, everyMinute, restoreOnStartup
}
Sitemap (basic ui)Frame label=“Rekuperator" { Text item=Air_Flow
Setpoint item=Air_Setpoint step=0.2 minValue=15 maxValue=30
Text item=Air_Recirculation icon="bypass"
Selection item=Air_Season icon="sun" mappings=[ "1.0" = "Lato", "2.0" = "Zima", "3.0" = "Auto"]
Text item=Air_Suply_Fan
Text item=Air_Exhaust_Fan
Selection item=Air_Mode mappings=[ "1.0" = "Tryb 1", "2.0" = "Tryb 2", "3.0" = "Tryb 3", "4.0" = "Program"]
}
Basic UI on mobile
OH2 discovery result
THE END
HOW TO FIND METwitter: ldywicki https://community.openhab.org