venerdì 29 aprile 2016

The JEMMA - OpenHAB remote binding

This is the first of a series of post explaining the experience of the JEMMA and Energy@home community with the OpenHAB framework. Find below links to all posts of the series:
  1. JEMMA and OpenHAB: a nice match (publication date: 18/4/2016)
  2. OpenHAB in theory: a short overview (publication date: 22/4/2016)
  3. OpenHAB in action: a quick example (publication date: 26/4/2016)
  4. The JEMMA - OpenHAB remote binding (publication date: 29/4/2016)
  5. The JEMMA - OpenHAB local binding (publication date: 3/5/2016)
  6. Conclusions and future work (publication date: 9/5/2016)

The JEMMA - OpenHAB remote binding

After the preliminary study and the first tutorials explained in previous post, we moved to the implementation phase, so experience what does it means for real to bridge OpenHAB with JEMMA.

After some internal brainstorming, we found relevant uses for two main use cases:

  1. As a JEMMA user, I want to control their appliances via OpenHAB GUI or rules, keeping my own JEMMA gateway;
  2. As a system integrator, I want to embed devices compatible with Energy@home (read: ZigBee HA 1.2, but also newer wifi-enabled devices) inside a gateway running OpenHAB
Both cases seemed equally relevant, so we decided to attempt the development of two separate proof-of-concepts to evaluate the feasibility of both approaches.

Important Note: both developments are provided as proof-of-concept to evaluate the feasibility of the proposed approaches. They are not meant as "professional" bindings - as much more work would be needed to use them reliably an in all cases. If you are interested in turning them in full-fledged binding - get in contact with the JEMMA community on the public mailing list.

In this first post, we focus on the first case.

The overall architecture of the proposed solution looks like the following:


Setting up the JRB

Make sure to have an OpenHAB environment up and running otherwise setup a new one following this guide. If you haven't already one, set up a JEMMA gateway following this guide and execute it on your designed host machine.  
  
  1. 1. Clone the ismb/jemma-remote-binding repository in any local folder or add a new Git repository inside your Eclipse IDE.
  2. 2. From within the Eclipse IDE import the JEMMA binding project into the OpenHAB workspace.
  3. 3. In the OpenHAB run configuration select the JEMMA remote binding plug-in  


To make OpenHAB aware of JRB existence it is required to edit the demo.things configuration file typically in _demo-resources/src/main/resources/things_. Append a line which defines the Thing the framework has to instantiate and with what configuration parameters.  

```jemmaremotebinding:jemma:jemma1 [address="192.168.1.2", port="8080", username="admin", password="Admin"]```  

Make sure to replace the arguments reported in the previous sample line with information valid to your JEMMA instance.

Runtime configuration

Point your browser to the http://localhost:8080 address and select the the OpenHAB Paper UI - . If you have any appliance currently associated to your JEMMA gateway the discovery service implemented in the JRB will find it and put into the Inbo  ![](https://raw.githubusercontent.com/wiki/ismb/jemma-remote-binding/link-menu.png)  x of discovered results. By selecting the "+" button you can make the appliance available to OpenHAB and the associated ThingHandler to be instantiated.  

The appliance has been made available but it is not actually linked to any item of the OpenHAB's site map. By moving into the Configuration/Things section it is possible to have a view of all the things currently associated to the environment.  

1. Click on the thing representing the appliance you wish to link.  



2. Click on the button beside the channel you want to activate.
3. In the dialog select the item to which the appliance thing has to be linked i.e. the DemoSwitch.  


4. Navigate toward http://localhost:8080/basicui/app and locate the Toggle Switch inside the Widget Overview section

5. By interacting with this switch it is now possible to control the smart plug previously linked




The code of the developed solution is available in the ismb/jemma-remote-binding repository.

Authors

This series of posts has been prepared by Sandro Tassone, supported by Riccardo Tomasi(ISMB). Sandro holds a MSc in Computer Engineering from Politecnico di Torino. He is currently collaborating with ISMB and Energy@home on JEMMA and other OSGi-based projects. He is a Software and C++ enthusiast.&; This activity has been partially co-funded by Energy@home. Thanks to IOOOTA for providing initial ideas and support for the jemma remote binding component.

Nessun commento:

Posta un commento