OpenRemoteHelpers under version 2.0.0

Discussions about RaZberry - Z-Wave board for Raspberry computer
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: OpenRemoteHelpers under version 2.0.0

Post by pz1 »

Sorry I do not get it yet. One of my Stella's has device number 11.
If I do a http://raspberry:8083/ZAutomation/api/v1/devices/11 the response is "Device 11 doesn't exist". I double checked with the apiary documentation which states that the id should be an integer. (Outdated documentation perhaps?)
If I use a virtual device name instead (e.g. "ZWayVDev_11:0:49:1", I do get output:

Code: Select all

{"data":{"id":"ZWayVDev_11:0:49:1","metrics":{"probeTitle":"Temperature","scaleTitle":"°C","level":21,"icon":"temperature","title":"Sensor 11:0:49:1"},"tags":[],"location":null,"deviceType":"sensorMultilevel","updateTime":1412667537},"code":200,"message":"200 OK","error":null}
Using its JSONPath filter the OpenRemote http protocol can select any of the metrics. But only one metric per call. But due to the nature of OR that would also apply for the metric function.

side note: a more clumsy solution on the openremote side would be to parse the whole json blurp using the Drools engine with Java code.
Since 29-12-2016 I am no longer a moderator for this forum
User avatar
PoltoS
Posts: 7649
Joined: 26 Jan 2011 19:36

Re: OpenRemoteHelpers under version 2.0.0

Post by PoltoS »

Id is a string, we will correct this. This JSON is hard to parse in OR, so in our new v2.0 @aivs added new call to fetch metric from device metrics.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: OpenRemoteHelpers under version 2.0.0

Post by pz1 »

PoltoS wrote:metrics are to fetch directly metrics from HA. Out /ZAutomation/api/v1/devices/StellaZ1 returns JSON object, while OpenRemote can not parse it. This 'metrics' is made ti fetch data from it.
The command below does return the metric "Temperature"

Scroll the image down to see the JSONPath (data.metrics.probeTitle) I used to get this in OpenRemote.
metrics.PNG
metrics.PNG (9.95 KiB) Viewed 6767 times
So what do I get with ORhelper metrics that I do not get otherwise using JSONPath?
Since 29-12-2016 I am no longer a moderator for this forum
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: OpenRemoteHelpers under version 2.0.0

Post by pz1 »

I still don't get what this ORHelper function is supposed to do:

Code: Select all

            case "metrics":
                // used HA API for all device to get metrics
                return this.controller.devices.get(N).get("metrics:level")
If I call it, it does give an error:

Code: Select all

http://raspberry:8083/OpenRemote/metrics/11
Uncaught TypeError: Cannot read property 'get' of undefined
Do you have an example how to use it?

Some more remarks on the OpenRemoteHelpers:
  • The line starting with "OpenRemote usage:" needs to get a corrected path
  • Below that, the list of functions needs completetion including required parameters
  • For some reason the RaZ-OR functions DeviceName and DeviceLocation did not make it to the Helpers.
  • The status of Switches used to change in the GUI's when the device itself was switched manually. A few did not. Now none of the switches update their status when changed manually. (As a matter of fact they don't change in good old blue GUI anymore either)
Additional helpers which I tested for quite a while

Code: Select all

            case "DeviceName":
                return zway.devices[N].instances[I].NodeNaming.data.nodename.value;

            case "DeviceLocation":
  			    return zway.devices[N].instances[I].NodeNaming.data.location.value;
I would appreciate if these two were added.
Since 29-12-2016 I am no longer a moderator for this forum
pofs
Posts: 688
Joined: 25 Mar 2011 19:03

Re: OpenRemoteHelpers under version 2.0.0

Post by pofs »

pz1 wrote:Additional helpers which I tested for quite a while

Code: Select all

            case "DeviceName":
                return zway.devices[N].instances[I].NodeNaming.data.nodename.value;

            case "DeviceLocation":
  			    return zway.devices[N].instances[I].NodeNaming.data.location.value;
I would appreciate if these two were added.
Added these ones, will be available in the next build (rc13, I believe)
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: OpenRemoteHelpers under version 2.0.0

Post by pz1 »

pofs wrote:Added these ones, will be available in the next build (rc13, I believe)
Thanks for the addition of these two functions :D (there were a few more serious issues in my post though :mrgreen: )

I did try rc 9, 10, 12. None of these are working "out of the box". No virtual devices, and more. So I am afraid I have to wait until a realistic Release Candidate for external testing appears.

From the perspective of integration with OpenRemote, release 1.4.1 is the least frustrating. At the same time I admit that the whole "Z-Way" concept and architecture is maturing drastically.
Since 29-12-2016 I am no longer a moderator for this forum
pofs
Posts: 688
Joined: 25 Mar 2011 19:03

Re: OpenRemoteHelpers under version 2.0.0

Post by pofs »

pz1 wrote:The status of Switches used to change in the GUI's when the device itself was switched manually. A few did not. Now none of the switches update their status when changed manually. (As a matter of fact they don't change in good old blue GUI anymore either)
Do you see reports coming in the log when you manually switch them? Probably some associations got broken.
pz1 wrote:No virtual devices
That was also fixed by now :)
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: OpenRemoteHelpers under version 2.0.0

Post by pz1 »

pofs wrote:Do you see reports coming in the log when you manually switch them? Probably some associations got broken.
The associations for all my Zwave>me wall switches were set to Razberry (node1). Only one of them gave a response in the log when operated manually. This one also does show status change in the UI.

To my surprise I found that the associations were not set for the Fibaro Wall plug at inclusion. As this was done with all my other switches, I did not pay attention. After I set the values via the expert interface the Fibaro was OK too.

I remember I had this problem before with the the Zwave>me switches. PoltoS gave me a method to fix that. Unfortunately I can not find that again.

edit:20141205-Switching off the 230V for a short period did help
Since 29-12-2016 I am no longer a moderator for this forum
Post Reply