[userMODULE] OpenRemoteHelpers

Tips, Tricks and Scripts to enhance your home automation and workaround known device bugs, limitations and incompatibilities
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

[userMODULE] OpenRemoteHelpers

Post by pz1 » 14 Nov 2014 11:11

Last updated: 2016-01-30
Tested with: v2.2.4-rc9
STATUS: stable
Install from: Online Appstore
Sources: Github


Note: For this recipe you only need a running Z-Way(e.g. Razberry module + Pi), and the free or pro version of OpenRemote.
OpenRemoteHelpers is a standard RaZberry module for communication with OpenRemote. Apart from installing the App no further installation is needed on Z-Way nor on OpenRemote. Reading the installation and deployment guide is strongly recommended.!

This specification has last been tested on OpenRemote Pro 1.4.0.

To control devices there are several HTTP commands:

Check the operability of the commands from the browser.

Code: Select all

Turn on the light:
http://192.168.0.39:8083/OpenRemote/SwitchBinaryOn/5/0
Request temperature:
http://192.168.0.39:8083/OpenRemote/TemperatureLevel/8/0
Dimming light on 50%:
http://192.168.0.39:8083/OpenRemote/SwitchMultilevelSet/6/0/50
Learn worked whether the motion sensor:
http://192.168.0.39:8083/OpenRemote/SensorBinaryStatus/4/0/1
"on"
To set temperature the thermostat 22 degrees:
http://192.168.0.39:8083/OpenRemote/ThermostatSet/8/22
Since 29-12-2016 I am no longer a moderator for this forum

pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: [Module] OpenRemoteHelpers

Post by pz1 » 15 Nov 2014 21:22

Today I have updated the installation instruction for Openremote. The link to that document is at the bottom of the first post.
Comments on both this Recipe a well as on the Openremote document are welcome in this thread. I am pretty sure I missed some points.

SubnetMask
Posts: 19
Joined: 06 Nov 2014 07:07

Re: [userMODULE] OpenRemoteHelpers

Post by SubnetMask » 19 Nov 2014 09:00

I've been playing with Z-Way and OR this evening, and I've made some pretty amazing progress (for me) in making it work, even though my OR UI looks like it was designed by a 2 year old :). I've gotten binary switches working with buttons, but where I'm stuck now is 'more advanced' functions in OR, and I think it may stem from my understanding (or lack thereof) of Z-Ways commands.

With the binary switches, I haven't gotten the 'switches' in OR working right. Not sure if it's something with OR or Z-Way that's causing it. The 'switch' buttons partially work. They will usually turn the device on, but don't update the status and won't turn the device back off.

Where I'm really stuck is with dimmers and the sliders in OR. I've found the Z-Way command for the multilevel switches (http://RPi-IP:8083/OpenRemote/SwitchMul ... Set/5/0/15 - which would set device 5 to 15%), but how would I set up the command so that the value is variable and tied to the slider?

Similarly, when I tried to set up buttons for a dimmer, with one being 'Off' (/SwitchMultilevelSet/5/0/0), one being 10% (/SwitchMultilevelSet/5/0/10) and one being On Full (/SwitchMultilevelSet/5/0/100), the 10% button and Off button work, but the On Full button doesn't work right - if the light is on at 10%, it doesn't change, and if it's off, it brings it to 10%.

It think the ideal setup would be something along the lines of what Z-Way has - an 'Off' button, a slider, an 'On' button that brings it to it's last level, and a 'Full' button that brings it to 100% regardless of what it's at before the button is pressed.

Any thoughts on what I'm doing wrong?

pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: [userMODULE] OpenRemoteHelpers

Post by pz1 » 19 Nov 2014 11:47

See in the description on the OpenRemote help pages referenced in the Recipe.
Under Using the OpenRemoteHelpers module you will see that for setting a slider you will need to fill in ${param}. edit: I have updated the first page with this information
As a matter of fact I would not use sliders, because they are very sluggish. This is because every move has to be communicated to and read back from RaZberry. At present we do get status value through polling. If you use very high rates, Pi can not cope with that.

I suggest you further discuss this on the OpenRemote forum, as OR specific questions are outside the scope of this Topic.

pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: [userMODULE] OpenRemoteHelpers: metrics revised

Post by pz1 » 11 Feb 2015 18:47

The metrics function in OpenRemoteHelpers is meant to retrieve data from the Home Automation engine. It interacts with the Virtual Devices. So it can be used for example to retrieve data from the OpenWeather module. The present metrics function only takes the device id (e.g. N = ZWayVDev_zway_15-3-49-1) as an argument, and returns the level of the sensor.

Code: Select all

                    case "metrics":
                    // used HA API for all device to get metrics
                    return this.controller.devices.get(N).get("metrics:level")
I have adapted the code a bit so it can take the metric type as a second argument.

Code: Select all

            case "metrics":
			     // used HA API for all device to get metrics
				 if (I !== "") {
				   attrib = "metrics:" + I;
				   }
				 else {
				   attrib = "metrics";
				   }
                return this.controller.devices.get(N).get(attrib)
You can now give the following commands:

Code: Select all

http://raspberry:8083/OpenRemote/metrics/ZWayVDev_zway_15-3-49-1/
{"probeTitle":"Temperature","scaleTitle":"°C","level":12.68,"icon":"temperature","title":"Sensor Temperature 15-3-49-1"}

Code: Select all

http://raspberry:8083/OpenRemote/metrics/ZWayVDev_zway_15-3-49-1/level
12.68

Code: Select all

http://raspberry:8083/OpenRemote/metrics/ZWayVDev_zway_15-3-49-1/probeTitle
"Temperature"
I have asked to consider this functionality

pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: [userMODULE] OpenRemoteHelpers

Post by pz1 » 27 Feb 2015 15:46

>>> As of v2.0.1-rc16, the metrics function has been updated: <<<
Version 1.01.02 2015-02-12 (Pieter E. Zanstra)
Added a second argument to metrics command, so the user can select other attributes than the
default level-attribute (http://192.168.0.85:8083/OpenRemote/met ... -0-37/icon)
Without the second argument the call returns all device attributes as json.
Closed the Switch statement with keyword default: to cater for erroneous function calls
On first page of this thread, the syntax has been adapted accordingly

pierre2302
Posts: 121
Joined: 15 Oct 2013 19:04

Re: [userMODULE] OpenRemoteHelpers

Post by pierre2302 » 23 May 2015 08:04

Hello,

Is it possible to add the following commands in OpenRemoteHelpers to you it so that they are functional with each new installation ?

Code: Select all

       case "DeviceStatus":
                return zway.devices[N].data.isFailed.value ? "off" : "on";

       case "DeviceStatusAwake":
                return zway.devices[N].data.isAwake.value ? "on" : "off";
DeviceStatus indicates the connection status between Razberry and modules sector.

DeviceStatusAwake can receive the clock pulse of battery modules.


Thank you
" Raspi 2 (RaZberry) / Raspi B (Razberry) " With OpenRemote Free 2.2.0_TTS-Email-Serial and Z-Way

pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: [userMODULE] OpenRemoteHelpers

Post by pz1 » 23 May 2015 09:58

pierre2302 wrote:Hello,

Is it possible to add the following commands in OpenRemoteHelpers to you it so that they are functional with each new installation ?

Code: Select all

       case "DeviceStatus":
                return zway.devices[N].data.isFailed.value ? "off" : "on";

       case "DeviceStatusAwake":
                return zway.devices[N].data.isAwake.value ? "on" : "off";
DeviceStatus indicates the connection status between Razberry and modules sector.

DeviceStatusAwake can receive the clock pulse of battery modules.


Thank you
I will have to test these commands in my own installation first. Secondly the primary design goal of this module is simplicity for users. So we should not overload it with specialist functions.
In that context I have my doubts about the DeviceStatusAwake. I don't see for what/why you would use that. Can you enlighten me with some example

pierre2302
Posts: 121
Joined: 15 Oct 2013 19:04

Re: [userMODULE] OpenRemoteHelpers

Post by pierre2302 » 23 May 2015 17:41

I think it's important to know the connection status between the modules and the Razberry.

My cell modules that awakening all 20000s I created a scene and a virtual control as below.

Within a period of 90000s there is no wake-up pulse, status_virtual goes to "1" (HS)

Code: Select all

rule "status_device_on"

 when
   Event( source == "device_status_awake" , value == on )

 then
   execute.command( "status_virtual ", 0); 

  end



rule "status_device_off"

timer (int: 90000s)

 when
   Event( source == "device_status_awake" , value == off )

 then
   execute.command( "status_virtual ", 1); 

  end
Attachments
Note_warning..png
status_virtual=1
Note_warning..png (1.13 KiB) Viewed 10818 times
Note_wifi..png
status_virtual=0
Note_wifi..png (2 KiB) Viewed 10818 times
" Raspi 2 (RaZberry) / Raspi B (Razberry) " With OpenRemote Free 2.2.0_TTS-Email-Serial and Z-Way

pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: [userMODULE] OpenRemoteHelpers

Post by pz1 » 23 May 2015 18:17

These devices usually have a very short period in which they are awake. If you want to catch that moment you must have a very short polling interval on the openRemote call that you propose.
If I had to do this, I would rather try to bind the battery awake status to a function similar to how I do other device status updates to OpenRemote with UDP send

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest