This page last changed on Apr 04, 2013 by goovaerg.

Hi,

I have some Basalte light switches which I can put in a cleaning state. This cleaning object in ETS is of datatype on/off.
I don't think it has a corresponding status object.

I've created an ON and an OFF command. I want to use a switch to turn the cleaning state on/off.

But without a status comming back from the bus, I can't create a sensor. So I can't use a switch.

How do I proceed with this? I want to be able to toggle the cleaning state of all my switches in my house.

Kind regards,
Glenn

You could use the virtual command and a rule which sends the real KNX command.

Posted by mredeker at Apr 07, 2013 20:09

Hi Marcus,

can you give me a little bit more info to get me started?

Glenn

Posted by goovaerg at Apr 08, 2013 05:17

If there's no status, usually two distinct buttons (one for on and one for off command) is preferrable. Is that not an option for your UI?

Posted by juha at Apr 08, 2013 05:22

I can do that but I thought it would look a little bit better with a swich.

No problem.

Glenn

Posted by goovaerg at Apr 08, 2013 05:25

I don't recall if we allow a switch without a sensor. In theory there wouldn't be an issue with this other than the switch visual state may get out of sync with the physical switches actual state. But we may enforce sensor on the switch on the designer configuration if a sensorless switch wasn't considered a valid use case. I'd need to check with Eric.

Posted by juha at Apr 08, 2013 05:29

Like Marcus mentioned, you could create an in-memory (fake) sensor state with the virtual commands that are available in the Designer. This is just to fullfil the sensor requirement (if any) on the switch. This is a little more involved and currently only discussed on the forums, the documentation is on the todo list.

Posted by juha at Apr 08, 2013 05:34

Ok, a switch does always require a sensor which is a bit restrictive but should be able to work around with an in-memory virtual command.

Posted by juha at Apr 08, 2013 05:42

Ok this is what I did.

I created a Cleaning (ON) and Claning (OFF) command using group address 1/0/4
I Created an in memory virtual command Status Cleaning with command "status". But what is the group address? I tried specifying 1/0/4 but that's not allowed. So for now I used some dummy address
I created Sensor Cleaning wich uses the in memory virtual command

Finally I created a switch which uses the ON and OFF commands together with the Sensor Cleaning. I assigned this to my actual switch

Will this work?

Glenn

Posted by goovaerg at Apr 08, 2013 06:31

Give it a try. I'm worried the sensor UI will not behave as you'd like if it's going to pull its state from the virtual command (keeping the visual switch state fixed to a single view).

Posted by juha at Apr 08, 2013 06:43

Ok I'll give it a try and let you guys know what happened.

Glenn

Posted by goovaerg at Apr 08, 2013 07:01

The way to use the virtual command in this case is to have 3 commands using in memory protocol:
ON, OFF and STATUS, use whatever address you want, but the same for the 3 commands.
Create a sensor and a switch object based on those 3 commands, then assign the UI switch.

This will just toggle the values of an in memory switch.
Then, using rules, based on the sensor value, send the appropriate KNX command (or commands).

So you would still have your cleaning on and cleaning off commands like above, but only call those from the rules.

Here is an example rules file for this:

package org.openremote.controller.protocol;

global org.openremote.controller.statuscache.CommandFacade execute;

rule "LightOn"
when
  $evt : Event(source=="LightSensor", value=="on")
then
   System.out.println("LightOn rule");
   execute.command("CL_On");
end

rule "LightOff"
when
  $evt : Event(source=="LightSensor", value=="off")
then
   System.out.println("LightOff rule");
   execute.command("CL_Off");
end

In this example, LightSensor is the name of the sensor linked to the in memory virtual commands.
CL_On and CL_Off are the 2 commands that actually do send the commands you want to the device (KNX in your case).

Posted by ebariaux at Apr 08, 2013 20:00

The workaround with the virtual commands works for me. but is there an option to read the knx bus to update my virtual switch if I turn the light on with knx hardware? In this case my OR still shows OFF...

Posted by sinonimo at Jul 09, 2013 08:07

If your KNX actuator sends a status after changing the state just create a STATUS command on that group address.
If you actuator cannot send status commands you can create a STATUS command to listen on the switching group address.

Posted by mredeker at Jul 09, 2013 08:40

@Marcus:
My actuator can't send status...
I have the following configuration:

command: name:LightON, KNX, 2/1/1, on, 1.001
command: name:LightOFF, KNX, 2/1/1, off, 1.001

command: name:VIRTUALLightON, protocol:VirtualCommand, command:on, address:TestAddress
command: name:VIRTUALLightOFF, protocol:VirtualCommand, command:off, address:TestAddress
command: name:VIRTUALLightStatus, protocol:VirtualCommand, command:status, address:TestAddress

sensor: name:VirtualLightSensor, command:VIRTUALLightStatus, type:switch

I added the rules and this works fine!

now I create a command and a sensor:
command: name:TESTLightStatus, KNX, 2/1/1, status, 1.001
sensor: name:TESTLightSensor, command:TESTLightStatus, type:switch

I added an image (sensor:TESTLightSensor) to show the status but this will not work. I only get the off picture. Where is my mistake???

Posted by sinonimo at Jul 09, 2013 09:45

There is an isse that OpenRemote does not receive the KNX message it sends (discussed in anthoer thread).
But TESTLightSensor should work, when you use your KNX hardware (eg wall switch).
In that case you can have another rule which updates VIRTUALLightStatus.

Posted by mredeker at Jul 09, 2013 10:24

I have a rule to update VIRTUALLIGHTStatus:

rule "TESTON"
when
Event (source=="TESTLightSensor", value=="on")
then
System.out.print("Try VIRTUALLightON");
execute.command("VIRTUALLightON");
System.out.println("-Positiv " + now());
end

But I don't understand the meaning of "But TESTLightSensor should work, when you use your KNX hardware (eg wall switch)".

Posted by sinonimo at Jul 09, 2013 10:34

You were saying that everything is fine when you use your virtual switch (UI on SmartPhone) but the UI is out of sync when using your KNX hardware (I assume a wall switch). Creating an extra status command that listens on the group address which is sent from your wall switch this should work.

Posted by mredeker at Jul 09, 2013 10:58

after your post i added an extra status command:

command: name:TESTLightStatus, KNX, 2/1/1, status, 1.001
sensor: name:TESTLightSensor, command:TESTLightStatus, type:switch

but it does not work... no idea why not...

Posted by sinonimo at Jul 09, 2013 11:41

If you connect a label to the TESTLightSensor and you use your wall switch, does the label change?

Posted by mredeker at Jul 09, 2013 11:56

NO. It does not change...

Posted by sinonimo at Jul 09, 2013 12:08

Do you see anything in the log files? Maybe change KNX logging to debug in webapps/controller/WEB-INF/classes/log4j.properties

Posted by mredeker at Jul 09, 2013 12:15

amazing... spend some time on other things and today return to this problem... delete all components and recreate them. and ... surprise... it works. thank you!

Posted by sinonimo at Jul 11, 2013 10:54
Document generated by Confluence on Jun 05, 2016 09:41