add to OpenRemote module - return "on" + id number?

Discussions about RaZberry - Z-Wave board for Raspberry computer
Kobi.beja
Posts: 11
Joined: 25 Feb 2015 19:39

add to OpenRemote module - return "on" + id number?

Post by Kobi.beja »

Hello

I'm new here and I'm looking for some help,
The OpenRemote module working for me good but i'm trying to use him in other way.
In the file index.js
I added to "Toggle" command and it's working good but my next step was to add to the return function the node id number + the real status for example : "4:on" "4:off"
someone can help me?

the tog code

Code: Select all

         
   case "SwitchBinaryTog":
                if (zway.devices[N].instances[I].SwitchBinary.data.level.value == 0)
			{
                zway.devices[N].instances[I].SwitchBinary.Set(255);
                return "on";
			}
                zway.devices[N].instances[I].SwitchBinary.Set(0);
                return "off";
Thanks
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: add to OpenRemote module - return "on" + id number?

Post by pz1 »

If you intend to use this with the OpenRemote http call, I can tell you it won't work. This is because OpenRemote does not do anything with the value returned by the command.
Kobi.beja
Posts: 11
Joined: 25 Feb 2015 19:39

Re: add to OpenRemote module - return "on" + id number?

Post by Kobi.beja »

Ok
I'm, understand thanks,
You know maybe other way? i'm tring to us Irule platform and trying to receive not only "on" or "off" status I need also the node number to change the icon form on to off..

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

Re: add to OpenRemote module - return "on" + id number?

Post by pz1 »

If you don't use OpenRemote, my remark does not apply.
I am not familiar with iRule. There have been some discussions on this forum. See if you can find solution there.
If not submit a new topic with iRule in the title. Focus on describing what you want to achieve with iRule.
Kobi.beja
Posts: 11
Joined: 25 Feb 2015 19:39

Re: add to OpenRemote module - return "on" + id number?

Post by Kobi.beja »

Ok i'll post something about iRule
Thanks
Kobi
dolpheen
Posts: 119
Joined: 10 Feb 2015 00:38

Re: add to OpenRemote module - return "on" + id number?

Post by dolpheen »

Kobi.beja wrote:add to the return function the node id number + the real status for example : "4:on" "4:off"
someone can help me?

Code: Select all

return N+":on";
etc. Or I don't understand something? :)
Razberry B+ 2.0.1-rc25 on ZW500 + 15 devices / Razberry B 2.0.1-rc25 on ZW300 for test
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: add to OpenRemote module - return "on" + id number?

Post by pz1 »

dolpheen wrote:

Code: Select all

return N+":on";
etc. Or I don't understand something? :)
That seems correct to me.

Yet one must be carefull with adding this to the existing OpenRemoteHelpers, because it will get overwritten with every update. A better approach may be to make a new [userModule]. Might be derived from OpenRemoteHelpers, but with a different name I guess. (I don't know if userModules take precedence over the core modules)
Kobi.beja
Posts: 11
Joined: 25 Feb 2015 19:39

Re: add to OpenRemote module - return "on" + id number?

Post by Kobi.beja »

Hi thanks for the help,
it is working like you said.

Code: Select all

            case "SwitchBinaryOn":
                zway.devices[N].instances[I].SwitchBinary.Set(255);
                return (N) + ":" + (I) + ":on" ;
Thanks

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

Re: add to OpenRemote module - return "on" + id number?

Post by pz1 »

[quote="Kobi.beja"]

Code: Select all

return (N) + ":" + (I) + ":on" ;
Just for my understanding why we should change the return in OpenRemoteHelpers I would like to know more about your application:
My main question is why do you need device and instance numbers returned, while you actually already now these parameters at the moment you send the command?

note: I am a bit hesitant for change since there is still the pending request ORCJAVA-337 on OpenRemote to implement the device status update from the returned value. OpenRemote would count on a returned on value only. That being said, I do no longer expect that ORCJAVA-337 will ever be implemented.
Kobi.beja
Posts: 11
Joined: 25 Feb 2015 19:39

Re: add to OpenRemote module - return "on" + id number?

Post by Kobi.beja »

I'm using with other system to listen to the feedback from http like Openremote,
but it's not enough to receive only "on" or "off" command I need to give more details to separate from other devices on the system, The command that received after I changed the code is "4:1:on" / "4:1:off" with this string I can change the position of my device.
It's working 2 way, the system poling the ZWAY every 10 sec with this (/OpenRemote/SwitchBinaryStatus/4/1) - I'm using in Qubino (http://qubino.com/products-2/flushtworelays/)

Before I changed this I received "on" or "off" in this case all the device on the system changed their position.
Right now it's working good
Kobi
Post Reply