OpenRemoteHelpers under version 2.0.0

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

OpenRemoteHelpers under version 2.0.0

Post by pz1 »

It seems that the OpenRemoteHelpers module is not working anymore under version 2.0.-rc8. I do get error message Invalid ZAutomation request
That can be tested with the WEBbrowser. For example I took command

Code: Select all

http://raspberry:8083/ZAutomation/OpenRemote/TemperatureLevel/13/3
Which is supposed to read the temperature level of the fist sensor of the Fibaro FGBS001. This did work well in 1.7.2.
As a matter of fact none of OpenRemote calls does return a value. I guess the module needs adaptation for the new 2.0.0. Or can I find somewhere an update? I just use wgat comes with the RC.
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 »

Yes, url access is changed in 2.0.

But you may fix it quite simple. Just add the following line in the end of OpenRemoteHelpers:

Code: Select all

allowExternalAccess("OpenRemote");
And drop /ZAutomation part from the url, so it would be http://ip:8083/OpenRemote/
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: OpenRemoteHelpers under version 2.0.0

Post by pz1 »

I have added the allowExternalAccess at the end of the index.js of module OpenRemoteHelpers:

Code: Select all

OpenRemoteHelpers.prototype.stop = function () {
    OpenRemoteHelpers.super_.prototype.stop.call(this);

    OpenRemote = null;
};

allowExternalAccess("OpenRemote");

// ----------------------------------------------------------------------------
// --- Module methods
// ----------------------------------------------------------------------------
Restarted Z-Way server

Command http://raspberry:8083/OpenRemote/TemperatureLevel/15/3

reports now 404 Not Found
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 »

Has it even loaded? Do you have any errors in log?
I've tried to do the same, and it kinda works :)

Just not sure about response format, as strings like "on" and "off" are returned with quotes (default JSON serialization)
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: OpenRemoteHelpers under version 2.0.0

Post by pz1 »

Just got this solved: I did a complete reboot of the Pi :D

Apparantly restart Z-Way-server was not enough.
I have it working for Switches and Universal sensors. I am now confident to change all urls to my 10 StellaZ devices.

CPU usage seems the same as under 1.7, not yet the 1-2% predicted for release 2.x
top.PNG
top.PNG (17.53 KiB) Viewed 7849 times
PS: Shouldn't you guys add this line:

Code: Select all

allowExternalAccess("OpenRemote");
To the OpenRemoteHelpers JS file?

I'll make a prelimenary write-up of this transition from 1.x to 2.x under Recipes
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 »

Sure, we'll add it.

About CPU usage: 1-2% was measured on my laptop (against 3-4% on 1.7), not on RPi. Sure it would be a bit higher on RPi because of different architecture and computing power.
We don't have influence on resources used by v8 engine on a specific platform. Just watch mem and CPU usage isn't growing too much :)
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: OpenRemoteHelpers under version 2.0.0

Post by pz1 »

Can confirm that StellaZ main functions work fine now with OpenRemoteHelpers. There are a few minor functions e.g. device location/name that were in the old RaZOR module, which are (not yet) in the OpenRemoteHelpers.
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 »

You can add allowExternalAccess in OpenRemote module if you want to shorten URLs from /ZAutomation/OpenRemote to /OpenRemote.

@pofs: why allowExternalAccess is global and not in ws?
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: OpenRemoteHelpers under version 2.0.0

Post by pz1 »

On my own machine I have extended the index.js op OpenRemoteHelpers a bit. For my OR-GUI I do use devicename and location as they are stored in my StellaZ devices.

Just before case "metrics" I added:

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;
By the way, what is the "metrics" suposed to do for me?

Code: Select all

http://raspberry:8083/OpenRemote/metrics/21
Uncaught TypeError: Cannot read property 'get' of undefined
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 »

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.
Post Reply