Friday, August 30, 2019

Smart Home Edge Device Setup and Configuration

In the previous blog I listed down few edge devices and software packages and its specifications/features. In this blog I will explain the configuration steps before the sensors /thermostats /actuators will all communicate with OpenHab edge hub. 


Before I go into the details of how the devices are configured I would like to give you a system diagram with devices /components overlay.




Step 1. 



Installing Openhab

I used the instructions available on the site https://www.openhab.org/download/

  1. Add the repository key
  2. wget -qO - 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | sudo apt-key add -
  3. Add the HTTPS transport for APT
  4. sudo apt-get install apt-transport-https
  5. Add the repository
  6. echo 'deb https://dl.bintray.com/openhab/apt-repo2 stable main' | sudo tee /etc/apt/sources.list.d/openhab2.list
  7. Update the package lists and install the openHAB distribution package
  8. sudo apt-get update && sudo apt-get install openhab2
  9. (Optional) Install the add-ons for offline use
  10. 🛈 You don't need the add-ons package if your machine has Internet access, openHAB will download add-ons online as necessary.
    sudo apt-get install openhab2-addons
  11. Navigate with a web browser to http://<ip-address>:8080
  12. Continue by following the First-time setup chapter of the New User Tutorial



Step 2. 



Z Wave Installation

To enable RaspberryPI to receive z wave messages from the door sensor we need plug the z-wave adaptor and install open z-wave control panel
To install the driver for receiving the z-wave and the control panel to manage the devices that listen to z-wave can be found here
https://lickthesalt.com/2016/04/11/compiling-open-zwave-control-panel-on-a-raspberry-pi-3/

Initialise  door sensor z-wave virtual device to receive messages from door sensor 
To configure a new device to listen to z-wave communication follow steps below . The process will initialise Z wave in open-zwave-controller.
  1. Stop HA - sudo service hass-daemon stop
  2. Confirm HA has stopped - sudo service hass-daemon status -1
  3. Start OZWCP
  4. cd open-zwave-control-panel
  5. sudo ./ozwcp -p 8888
  6. Open OZWCP your ip:8888
  7. Enter /dev/ttyACM0 into device field and click initialize button
  8. DONT NOT TICK THE USB CHECK BOX
  9. Check the driver path before you run the initiate
  10. You need to make sure that to reset the door sensor by pressing the reset button after having removed the batteries. Put the batteries on After resetting.
  11. Press the activation button three times in 1.5 seconds and take the sensor close to the controller
  12. Once the devices gets activates and added to the controller, kill the open-zwave-controller application
  13. Start Openhab application and add z-wave binding

Step 3. 



MQTT broker installation


MQTT messages are created using openhab binders for MQTT. This allows just to convert the messages from Z-wave devices into MQTT messages.

You can install the Mosquito Raspberry PI package using this link http://www.instructables.com/id/Installing-MQTT-BrokerMosquitto-on-Raspberry-Pi/

To setup MQTT messages using openhab, please use the link below.





Step 4



Openhab z-wave binder installation. 

Openhab does not necessarily bundle zwave binding that works with the HS1DS-Z HEIMAN door sensor. You can use kafar console to update the zwave binding. Below step helps you do just that.
  1. Install z-wave binding via paper ui
  2. Go to karaf console and uninstall the binding via console
  3. Search for the zwave binding. In my case it had id 198
  4. Uninstall the binding using this id
  5. Install newest snapshot got to '/usr/share/openhab2/addons' (if you installed with apt-get)
  6. cd /usr/share/openhab2/addons
  7. run command sudo wget https://openhab.ci.cloudbees.com/job/openHAB2-Bundles/lastSuccessfulBuild/artifact/bindings/org.openhab.binding.zwave/target/org.openhab.binding.zwave-2.0.0-SNAPSHOT.jar
  8. restart openhab sudo /bin/systemctl restart openhab2.service


Step 5



Openhab Energine binder 

Follow similar steps like above to install the Energine e-TRV binders.
The binder can be found at this site 

Step 6. 



Fire up openhab and using the paper UI ,  discover and configure the zwave adapter, door sensors and e-trv's. 





Next Steps

Once the installation and configuration are complete, you will be able to receive MQTT message from openhab in regular intervals set via mosquito configuration. 




In my next set of  blogs, I will discuss about how the messages are configured and how the whole architecture differs from  WOO reference architecture. 

Thursday, August 29, 2019

Smart Home Edge Devices

In my previous blog, I tried to explain my struggle to eventually decide the course of action to implement a smart home. After the initial enthusiast approach to my design of IOT systems, I realised there is loads to learn in terms of IOT middleware and message design. I realised the goal is to learn about knowledge representation and information extraction. 
In this blog I will detail the IOT device setup and configuration and how the edge architecture is put together. 

I won’t go in detail about all the IOT devices that I have configured for my smart home implementation. Below is the list of edge devices for the purposes of explaining the architecture.  


Smart Door Sensor


Product Features

Product Identifier: Brand Name:
Product Version: Z-Wave Certification #:
Battery Quantity
Battery Type
Color
Firmware Updatable
IP (Ingress Protection) Rated
Outdoor Use
Sensors
HS1DS-Z HEIMAN
HW: 255 FW: 1.25 ZC10-16055091
2
AAA
Gray
Not Updatable
No
No
Open/Closed (Binary)

Door Sensor Z-wave Product Information

Supports Z-Wave Beaming Technology?  No
Supports Z-Wave Network Security?   Yes
Supports Z-Wave AES-128 Security S0? No
Supports Security S2? No

Door sensor Z - wave specification

Z-Wave Frequency:        
Europe

Z-Wave Product ID:        
 0x0168 360

 Z-Wave Product Type:     
 0x0168 360

 Z-Wave Hardware Platform: 
 ZM5202

 Z-Wave Development Kit Version:  
 6.51.06

 Z-Wave Library Type: 
 Routing Slave

Z-Wave Device Type / Role Type
 Notification Sensor / Reporting Sleeping Slave


Thermostates


Energenie Mi|Home Thermostat and eTRV Pack

https://www.homecontrolshop.com/products/energenie-mihome-thermostat-etrv-pack?variant=13309605347351&currency=GBP&utm_source=google&network=u&utm_campaign=misc&gclid=Cj0KCQjw753rBRCVARIsANe3o47r4iCkC7pWo8jzdyqF678Qg7i2DSWqRXaj2yfI8D_PmVq0tXaOJ_kaAk5qEALw_wcB

Manuals can be downloaded from

https://www.homecontrolshop.com/products/energenie-mihome-thermostat-etrv-pack?variant=13309605347351¤cy=GBP&utm_source=google&network=u&utm_campaign=misc&gclid=Cj0KCQjw753rBRCVARIsANe3o47r4iCkC7pWo8jzdyqF678Qg7i2DSWqRXaj2yfI8D_PmVq0tXaOJ_kaAk5qEALw_wcB#tabs-6

 

Energenie Mi|Home Smart Radiator Valve


+ Radio remote control: FSK, 434.3MHz, 2 way
 
+ Protocol: OpenThings
 
+ Radio range: Approx. 25m in open air
 
+ Set temperature range: 0°C to 30°C
 
+ Reported temperature range: -10°C to 30°C
 
+ Temperature range for storage: -20°C to +60°C
 
+ Temperature range working: +5°C to +40°C
 
+ Maximum circulation temp: 90°C
 
+ Comfort temperature (boost): 21°C
 
+ Application group: Central Generation
 
+ Zone type: Maintained or Intermittent
 
+ Batteries: Two 1.5V AA alkaline LR6
 
+ Battery life in use: Up to 1½ years
 
+ Size without base-ring (HxWxD): 103 x 45 x 45 mm
 
+ Size with base-ring (HxWxD): 120 x 45 x 45 mm
 
+ Weight with batteries: Ca. 230g
 
+ Protection class: IP20
 
 

Energenie Mi|Home Gateway




Ports & interfaces

+ Connectivity technology: Wired

+ Ethernet LAN Y

+ WiFi: N

Design

+ Colour of product: White

+ LED indicators: Y

Power

+ Input voltage: 5

+ Input current: 0.15

Please note: There is a limit of 28 devices paired to one gateway. However, multiple gateways can work on one account further extending the amount of devices to can be used.



Everspring SA413 Z-Wave Plus Universal USB Adapter Stick For Multiple Device



The Everspring SA413 is a Z-Wave Plus USB adapter which will turn your PC or gateway hub into a Z-Wave Plus controller - enabling you to manage multiple devices connected to the Z-Wave Plus network!


USB RF transceiver.Operation Protocol: Z-Wave Plus.Operating Frequency: 868.42MHz (EU).Operating range: Up to 100m in Z-Wave Plus network.Plugs into a standard USB port.


Requires controller software compatible to the Sigma Designs Serial API.


Raspberry pi



NAME="Raspbian GNU/Linux"

VERSION_ID="8"

VERSION="8 (jessie)"

ID=raspbian

ID_LIKE=debian

HOME_URL="http://www.raspbian.org/"

SUPPORT_URL="http://www.raspbian.org/RaspbianForums"

BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs


open-zwave-control-panel


The OpenZWave Control Panel (ozwcp for short) is an application built on the OpenZWave library that permits users to query, manage and monitor Z-Wave nodes and networks. It provides a web based user interface using AJAX principles.


OpenHab Installation on Raspberry Linux



https://www.openhab.org/docs/installation/linux.html



Mosquitto 


Openhab converts Z wave messages into MQTT messages for gateways and consumers.

To communicate in MQQT , you need to install Mosquitto



The details above gives the list of devices and software packages which form part of the IOT edge ecosystem. 

In my next blog I will explain the necessary instruction to install and configure the device. 

Smart Home Pickle

I started a mini project playing with few doors sensors and Raspberry Pi. After few agonising hours setting up the communications and getting to know Openhab application, I realised there is much more than getting few devices accentuate.

A smart home technical solution is evolutionary and has many challenges. Although it started off as a hobby , I soon found many reason to question and research the technological solutions which I thought I will employ. The focus shifted from connecting devices and firing up OpenHab smart home application for monitoring to making sure the messages and data is representative. 

Background


Any smart home solution involves integrating data from difference streams, it could be your

  1. Wearable sensors 
  2. Environmental sensing devices
  3. Home infrastructure sensing devices

The smart home data is multi-modal and heterogeneous in nature. This heterogeneity induces interoperability issues while developing cross-domain applications, thereby restricting the possibility of reusing sensor data to develop new applications. As a solution to this, semantic approaches have been used  to tackle problems related to interoperability of sensor data.

Several ontologies have been proposed to handle different aspects of IoT-based sensor data collection, ranging from discovering the IoT sensors for data collection to applying reasoning on the collected sensor data for drawing inferences.

To satisfy user-centric service requirements, context awareness,  ontology plays an important role. It is necessary to convert the real world data into meaningful information to make decisions based on the context. 
This drew my attention to aspects of  object and service designs. A standard mechanism for object recreation not only improves the reusability of objects but also enhances service modularity and extensibility by reuse of objects with microservices. 
Reuse of objects through microservices avoids duplications, and reduces time to search and instantiate them from their registries.


The solution was to employ a standard to manage the challenges of interoperability and knowledge extraction.  My focus shifted to incorporating  Web of Objects  architectural platform for smarthome. 


The WoO supports semantic modeling of objects that provides a user-centric IoT service model with the use of a semantic ontology. The semantic ontology maintains the relationship among all the virtual objects (VOs) for information reusability.

Please check the references below for more information on The ITEA 2 Web of Objects project.


In my next blog I will try and explain the devices and the edge architecture that I used for the smart home implementation. 


References


  1. Microservices in Web Objects Enabled IoT Environment for Enhancing Reusability Muhammad Aslam Jarwar ID , Muhammad Golam Kibria ID , Sajjad Ali ID and Ilyoung Chong *
  2. Smart home – a challenge for architects and designers N. Bitterman∗ and D. Shach-Pinsly
  3. A User-Centric Knowledge Creation Model in a Web of Object-Enabled Internet of Things EnvironmentMuhammad Golam Kibria 1, Sheik Mohammad Mostakim Fattah 1, Kwanghyeon Jeong 1, Ilyoung Chong 1,* and Youn-Kwae Jeong 2
  4. https://itea3.org/project/web-of-objects.html

Smart Home Edge Device Setup and Configuration

In the previous blog I listed down few edge devices and software packages and its specifications/features. In this blog I will explain the c...