rules editor

I am having problems getting any rules to work, I am using openremote controller 2.5 on windows 7 pc, with android client.

I have copied the most basic rule from the first example in the documentation but cannot get it to update to the DRL file.

I did previously have some rules setup which did update the DRL file, but none of them worked so in order to try to resolve the problem,

I have gone right back to basics. I copied the first example rule, and simply changed the name of the sensor, and the command

to be executed to match valid entries in my building modeller.

This is the rule below, and it appears with much of it underlined in red which is believe indicates

a syntax problem, but I started by copy and pasting from the documentation, the deleted all the text and typed it afresh, but no change.

package org.openremote.controller.protocol;

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

rule “AVTURNON” when

Event( source == “AvPowerStatus”, value == “on” )


execute.command( “AVRPWRTOGGLE” );


When I click submit, I do (after a pause) get a “property saved successfully” message, but no DRL file is created anymore,

I am looking in the webapps\controller\rules folder on the server.

Can anyone please help get me started.

P.S. in the above rule, I have added a semicolon at the end of the “package” statement, this appears in some examples in the documentation

and is missing in others, I have tried both alternatives.

Ian Pollard

Did you update your controller? After you save the rule, you have to synchronise you controller with your builder modeler.

Thanks Igoris, I though I had done sync, but I probably hadn’t, to be certain I have done

  1. Submit Rules editor

  2. Save designer,

3 Sync controller

  1. logout, and log back in designer.

This has now updated the DRL file, and the basic rule is working ok.

This leads to a further question,

How often are rules evaluated, the rule seems to perform the requested action when the sensor changes to “on” but if I toggle on/off/on again

it mostly misses the second time setting to “on”. If I wait for 30 seconds between changing the sensor state, it seems to work reliably.

Is there anything I can do to influence the timing of the rules being evaluated?

Rules are evaluated almost instantly after sensor changes its state. I have rules which react of double-, triple clicks without problems when there is less than 0.5 s between clicks. Usually I use 0.3s debounce delay in rules which react on button press to prevent accidentally multiply clicks.

Thanks Michal

I will do some more investigation, the delay must be in the device responding to the command I guess.

Rules worked ok for a short time, after I made sure was syncing controller.

But now rules stopped working and every sensor with a polling interval on command has stopped working, all show N/A value.

don’t know where to start looking for solution, am thinking of deleting all sensors and commands and recreating but before

I do does anyone have any ideas, I am sure I saw a thread along these lines but I cannot find it now so a stumped.

Start looking in the log files. There are many, but for sure check rules/drools.log and dev/dev.log.


thanks for the tip, I had reset rules to default, and deleted all my virtual switches, and sensors with polling commands, but was still having problems

in the boot.log I found this error.

ERROR 2017-03-14 11:03:19,510 : Could not instantiate commandBuilder: org.openremote.controller.protocol.alarm.AlarmCommandBuilder

so I removed the Alarm entries as well, and rebooted the controller.

After doing this I have added back 2 senors which seem to be working at the moment, I will try to rebuild up from here

and see if I can get basic rule working again.

Further to last post, after a short while with 2 sensors working, problems started again, so I removed one sensor. These 2 sensors are polling via TCPIP an application

on the same PC as Controller via Ip address

With one sensor running it seems ok, but with both running I encounter issues with closed socket, so I may have to rework my code.

However I now have an error appearing in dev.log every time I load the client (android) application, log details below.

2017-03-14 12:42:56,115 ERROR [HTTP-Thread-1]: Failed to execute REST API call ‘’ : Invalid URL format – expected format ‘/rest/devices/{device_name}/commands?name={command_name}’, got ‘/rest/commandsnull’.
2017-03-14 12:44:23,023 ERROR [HTTP-Thread-1]: CommandException occurs
org.openremote.controller.config.ControllerXMLChangedException: The content of controller.xml had changed.
at org.openremote.controller.service.impl.StatusPollingServiceImpl.queryChangedState(Unknown Source)
at Source)
at Source)
at Source)
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at Source)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(
at org.springframework.web.filter.OncePerRequestFilter.doFilter(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$
2017-03-14 12:44:23,226 ERROR [HTTP-Thread-4]: Failed to execute REST API call ‘’ : Invalid URL format – expected format ‘/rest/devices/{device_name}/commands?name={command_name}’, got ‘/rest/commandsnull’.

coincidentally the Webconsole app now doesn’t seem to work, it loads resources and then just locks up.

Ok I think the bulk of this error is simply being logged when I re-sync the controller, the failed to execute REST API error is still being logged

whenever the client is reloaded but it doesn’t seem to be causing a problem.

I have added back a rule (scheduled command) and I think this was what was causing much of the previous problems, because I had a

syntax error in the cron statement. once this is corrected, I seem to be getting good results.

Thanks very much for the help, I will mark this thread as closed now. And carry on from here,