Announcements‎ > ‎

OpenRemote joins the panStamp ecosystem

posted Feb 14, 2013, 7:35 AM by Daniel Berenguer   [ updated May 2, 2013, 3:07 PM ]

Introduction

panStamps are now officially supported devices by OpenRemote, a powerful open source home automation software for iPhones, iPads and Android devices. OpenRemote's main strength is in our opinion the fact that anyone can create custom graphic layouts for their preferred mobile platforms and make them interoperate with a long list of home automation hardware. And all this for free, by simply using OpenRemote's online designer and uploading the generated files to a computer running OpenRemote Controller.

Before this release, panStamp was integrable with OpenRemote by means of the http engine included in lagarto-swap. An old tutorial explained this in fact. What makes the current release really interesting is that OpenRemote does not need polling values from lagarto anymore. New OpenRemote's protocol extension for lagarto is now able to receive events from lagarto without the need to be continuously querying our SWAP servers. Another advantage about the new extension is that users can create their custom GUI frontends faster from OpenRemote Designer.... but we will talk about this along the current tutorial.

Download and run OpenRemote

Also download and install the latest version of lagarto as explained here. The current OpenRemote snapshot does not include the necessary binary ZeroMQ libraries (libzmq.so and libjzmq.so files on linux and some dll's on Windows). You have to locate these files on your computer and place them under OpenRemote/webapps/controller/WEB-INF/lib/native/.

Now it's time to run lagarto-max:
python lagarto-max.py

You can run OpenRemote after that:

From Linux:
sh OpenRemote/bin/openremote.sh run

From Windows:
OpenRemote\bin\openremote run

And finally run lagarto-swap:
python lagarto-swap.py

OpenRemote Designer

Now it's time co configure OpenRemote from the online Designer tool. Simply open the following URL from a web browser: http://composer.openremote.org/preview

and create the necessary commands, sensors and actuators. Let's start by creating a device called “Lagarto-SWAP” or whatever name you prefer. Once we have our device created we can then proceed with the creation of commands, sensors and actuators attached to our device.

Temperature sensor

Before creating a sensor object from OpenRemote Designer we need to define a command to link OpenRemote to the actual SWAP sensor. We can then create our sensor from Designer and attach it to the command previously defined.

1. Annotate the endpoint id appearing on the first column from lagarto-swap's Network page. This id uniquely represents each endpoint in lagarto-swap.

Endpoint id's from lagarto-swap

Figure 1 : Endpoint id's from lagarto-swap

In the above example our Temperature0 endpoint has the id "10.12.0"

2. Create a new command from OpenRemote Designer and select “panStamp lagarto” from the protocol field.

Sensor command

Figure 2 : Sensor command

  • Name : Enter your preferred name for the command
  • Protocol : Select "panStamp lagarto".
  • Server name :  The name of the lagarto-swap server which our endpoint belongs to. This name can be found (and edited) in lagarto-swap's web GUI -> Preferences -> Lagarto Settings.
  • Endpoint ID : Endpoint ID taken from step 1.
  • New value : Leave it empty.

3. Create a sensor object from OpenRemote Designer's device manager

Sensor object

Figure 3 :Sensor object

Enter a name for the sensor and attach it to the command defined in the precedent step. Set the "Type" field to "custom".

Binary actuator

1. Actuators, like sensors, need a command which will be used by OpenRemote to link to the real parameter in lagarto-swap. The only difference is that actuators need the "New value" field to be filled from the command window.

Command for binary actuators

Figure 4 : Command for binary actuators

  • Name : Enter your preferred name for the command
  • Protocol : Select "panStamp lagarto".
  • Server name :  The name of the lagarto-swap server 
  • Endpoint ID : Endpoint ID
  • New value : "TOGGLE". This is the "trick" used to turn on and turn off binary loads using a single command from OpenRemote. Otherwise, you can create two different commands with "ON" and "OFF" values.
2. Create sensor object and attach it to the command defined in step 1. Set the type of sensor to "switch".

Binary sensor

Figure 5 : Binary sensor

3. Create switch object. We have to attach the switch to the sensor defined in the precedent step and set both ON/OFF commands to our single binary command.

Switch object

Figure 6 : Switch object

OpenRemote users will appreciate how a single command can be used to read and write endpoints with our protocol extension.

Level actuator

Level actuators, dimmers, DAC's (digital to analog converters) or PWM (pulse width modulation) outputs can be controlled using sliders from Openremote. The configuration procedure is similar to the binary input:

1. Create a new command for your output:

Command for level actuator

Figure 7 : Command for level actuator

  • Name : Enter your preferred name for the command
  • Protocol : Select "panStamp lagarto".
  • Server name :  The name of the lagarto-swap server 
  • Endpoint ID : Endpoint ID.
  • New value : "${param}". This is OpenRemote's magic word to pass numeric values to the protocol handlers.
2. Create sensor object and attach it to the new command:

Sensor created to get and set values from the slider object

Figure 8 : Sensor defined to get/set values from the actuator

3. Create a new slider object and attach your new sensor and command to it:

Slider object

Figure 9 : Slider object

Like switches, sliders need to be attached to a sensor, responsible to read values from the real endpoint, and a "setValue" command which will be used to send new values to lagarto-swap. Again, a single command (cmd_Level0) is used to read and write values.

Design your GUI

Once arrived at this point you should see a list of objects similar to the following one:

Device view from OpenRemote Designer

Figure 10 : Device view from OpenRemote Designer

Now you can design your custom GUI for your Android/iPhone device. Open the Panel view from Designer and create a new panel. We are omitting the cosmetic aspects in this tutorial.

1. Create new screen.
2. Place a grid and define its number or rows and columns
3. Place a label for each analog input. In our example we should create the a label and attach it to the Temperature0 sensor.
4. Place a switch for every binary actuator. In our example we should select Relay0 from the SwitchCommand selector.
5. Place a slider for every level actuator, dimmer, ADC or PWM. We should then enter Level0 (Level0 slider object created from Designer's Device view) in the SliderCommand field for our current example.
6. Save your work.

Upload design to OpenRemote Controller

Upload your Designer project to your OpenRemote controller by opening the following URL from a web browser: http://ip_addr_controller:8080/controller/. You will have to identify yourself and press the "Sync with Online Designer" button. Finally, open your graphic interface and select the OpenRemote Controller from the list.

And that's all. We are currently designing a nice interface for a 7-inch Android tablet for CeBIT. We will try to post some pictures when we get it ready. Thanks for your time.

Comments