Page 1 of 2

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

Posted: 26 Feb 2015 10:29
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

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

Posted: 26 Feb 2015 10:38
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.

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

Posted: 26 Feb 2015 10:42
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

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

Posted: 26 Feb 2015 10:55
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.

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

Posted: 26 Feb 2015 11:49
by Kobi.beja
Ok i'll post something about iRule
Thanks
Kobi

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

Posted: 26 Feb 2015 15:53
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? :)

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

Posted: 26 Feb 2015 16:51
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)

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

Posted: 02 Mar 2015 11:24
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.

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

Posted: 02 Mar 2015 15:45
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.

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

Posted: 02 Mar 2015 17:41
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