This page last changed on Sep 18, 2013 by hank.

Hi

I try to implement below rules to my Openremote controller, but it all of them doesn´t work.

Rule "Play Sonos Vardagsrum" works perfectly but the other two doens´t work.
Anyone that could see any mistakes?

The reason of the rules are to: 1. Volume up 2. Start Sonos in Living room 3. Volume down.
These the rules are connected to a sensor which waiting for a KNX adress to become active.

package org.openremote.controller.protocol
global org.openremote.controller.statuscache.CommandFacade execute;
global org.openremote.controller.statuscache.SwitchFacade switches;
import org.openremote.controller.protocol.Event;

rule "SonosSovrum VolPlus" when
Event( source == "SonosSovrum VolPlus", value == "on" )
then
execute.command( "Sovrum VolPlus" );
end

rule "Play Sonos Vardagsrum" when
Event( source == "Sonos Play", value == "on" )
then
execute.command( "Sovrum VolPlus" );
end

rule "SonosSovrum VolMinus" when
Event( source == "Sonos Sovrum VolMinus", value == "on" )
then
execute.command( "Sovrum VolMinus" );
end

If there were a syntax error in one of the rules, the rule "Play Sonos Vardagsrum" wouldn't work - so the syntax of your rules is OK.

To check whether a rule is triggered, you can add logging:

rule "SonosSovrum VolPlus" 

when

  Event( source == "SonosSovrum VolPlus", value == "on" )

then
   
  System.out.println("Rule : SonosSovrum VolPlus"); 

  execute.command( "Sovrum VolPlus" );

end

If you do not see the message "Rule : SonosSovrum VolPlus" in the console then there is something wrong with the sensor configuration or the related command.

Posted by rhitz at Sep 19, 2013 18:07

Thanks, but i found the problem.

If the event/sensor already are in "on" mode the rule will not be executed.
Which is a problem when you want to increase the volume of the sound each time yuou press a button.

The solution was to change the command in KNX to "toggle" instead of "on" each time you press the button.

Posted by hank at Sep 27, 2013 12:40
Document generated by Confluence on Jun 05, 2016 09:30