Hi!
I've looked in the sample file "Holidays.drl" from the test suite, and it says for example
> then
>
> execute.command ("temp", 21);
>
> end
What kind of command is "temp"? I haven't found any command to write a specific value. Is it possible to send 21 to the KNX installation without using a slider?
Another question.
I want to show different images for different ranges of values (ex, a type of stabeldigram for the air supply fan, 0 - 10% one pin 10 - 20% two pins 20 - 30% three pins......
My first thought was to use a Custom sensor and have different states for different ranges of values, but I couldn't get it to work with < and > characters in the Value field (is it possible to have a Custom Sensor with ex. "State1" Value <10 and "State2", Value > 10 && <20)?
Then I tried with a rule file and create a "virtual value" (ex. 10 for 0-10, 20 for 10-20....) And then use a custom sensor with states for 10, 20 .... and different images for different states. But I didn't found any way to get the custom sensor to read the virtual value. Is there any way to solve this?
(A In-memory virtual command to save and view "virtual" values from the rules would be an nice feature)
Now I use rule files and "In-memory Virtual" On, Off, and Status commands for each interval then I have Images and use a On/Off-Status-sensor to put on and off the images for each interval . It works, but there will be two rules, three commands and one sensor for each (11) interval. Then I must have an "off picture" for each interval (witch I don't want).
(Did anyone understand this???)
Is there any easier or better way to solve this?
/Kenneth
Comments (47)
Mar 20, 2012
Marcus Redeker says:
"temp" in that case is a dummy command which created from the testsuite. You can..."temp" in that case is a dummy command which created from the testsuite.
You can create a KNX command with DPT9.001 and command param "temp" to send temperature values to KNX devices.
The rule sysntax will be the same except the command name is the one you give when creating the command.
The custom sensor does not allow the greater or smaller logic. You could create a rule for that and give the state 1,2,3 into the sensor from the rule.
This way you only need one custom sensor with the 3 state and one image ui object which is linked to that sensor which has one image for each state.
Mar 21, 2012
Kenneth Stridh says:
Thank you very much Markus! I tried with a "temp" command together with my rule...Thank you very much Markus!
I tried with a "temp" command together with my rules and I got it to work.
Thanks alot!
(But I had some problems, I had to set the temp command in a "dummy slider" and put the slider on the UI first. I also had problems with, that the disigner didn't want to export my additions and changes, first when I removed some old commands and sensors the Disigner exported the changes.)
The solution with, put a custom sensor in different states directly from a rule, sounds great. I'll try it as soon as I have learned a little more about rules. (I'm not sure how the rule syntax to put a sensor in different states should look.)
What command should I use when creating the custom sensor? The fan speed is in DPT. 5.001 and the custom sensor doesn't support DPT. 5.001.
/Kenneth
Mar 21, 2012
Marcus Redeker says:
True, in the moment a command needs UI object linked to it to be exported into t...True, in the moment a command needs UI object linked to it to be exported into the controller.
I will have a look at that.
Custom sensor should also work with DPT5.001. If not try Level which 1-100%
Mar 22, 2012
Kenneth Stridh says:
Hi, Markus. Now I don't think I understand what you mean. The reason you recom...Hi, Markus.
Now I don't think I understand what you mean.
The reason you recomend a custom sensor was to use the states for showing different images. Can you have states in a level sensor?
I tried again with a custom sensor and a DPT5.001 command and it didn't work now either. (February 27, you wrote this to me.)
"Ok, I just checked the source. Custom Sensor indeed does not support DPT 5.001."
That's why I wished a "in-memory virtual command" to get a value from a rule into a sensor
/Kenneth
Mar 22, 2012
Marcus Redeker says:
I think, I also misunderstood you What you need is a level sensor for the DPT5....I think, I also misunderstood you
What you need is a level sensor for the DPT5.001 and additionally a state sensor for the three states.
When the level sensor changes, you trigger a rule which does the equation (0-10, 10-20, 20-30) and sets, depending on the values, one of the three states.
Mar 23, 2012
Kenneth Stridh says:
Thank you for taking your time to explain this to me. I really appreciate it. Y...Thank you for taking your time to explain this to me. I really appreciate it.
Yes, that's the way I understood you the first time. My question was referring to what command I should use when I create the state sensor (with state sensor, I assume you mean a custom sensor with states?)
Can I take any command (except DPT5.001 commands) because the state sensor will not use the command?
/Kenneth
Mar 23, 2012
Marcus Redeker says:
Any command should do it. You could try the dummy command.Any command should do it. You could try the dummy command.
Mar 26, 2012
Kenneth Stridh says:
Hi, Markus. I've been trying all weekend to find out how the rule to put the st...Hi, Markus.
I've been trying all weekend to find out how the rule to put the state sensor in different states should look like, but without any success. I even tried to look in the source, but it was too difficult for me.
The first half is not a problem, but I can't figure out, how to put the custom sensor in different states.
Do you have the possibility of helping me with the missing line??
rule "create state1 for fan speed"
when
Level( source == "fan speed", value > 0 && <= 10 )
then
????? ("name of state sensor") ??????? ("name of state1")
end
Thanks in advance.
/Kenneth
Mar 26, 2012
Marcus Redeker says:
I will try something myself and also asked Juha to take a look. We will let you ...I will try something myself and also asked Juha to take a look.
We will let you know.
Mar 26, 2012
Kenneth Stridh says:
Thanks a lot! I really appreciate it. /KennethThanks a lot!
I really appreciate it.
/Kenneth
Mar 27, 2012
Marcus Redeker says:
The VirtualCommand did not support a CustomSensor, but only the CustomSensor all...The VirtualCommand did not support a CustomSensor, but only the CustomSensor allows different images for each state.
So I fixed the VirtualCommand and it worked for me
The fix is for the offical 2.0 release which you can download from sourceforge.
Please replace the file VirtualCommand.class with the attached one in folder "openremote-controller/webapps/controller/WEB-INF/classes/org/openremote/controller/protocol/virtual".
You should be able to try with the attached openremote.zip and the attached rules.
openremote.zip
VirtualCommand.class
modeler_rules.drl
Mar 28, 2012
Kenneth Stridh says:
Yes Yes! It works for me too Markus Thank you so much. You guys really do a f...Yes Yes!
It works for me too
Markus Thank you so much. You guys really do a fantastic job.
Will the new Virtual Command "1" be added in the disigner in the future, so I can add it there instead of edit the controller.xml?
One small problem I noticed is, that after every time I restart the controller, I have to do a sync to get it to work.
This is the log text I get before I have synced:
Exception in thread "Polling Sensor Thread ID = 783, Name ='State sensor'" java.lang.NullPointerException
at org.openremote.controller.model.sensor.Sensor.isUnknownSensorValue(Sensor.java:161)
at org.openremote.controller.model.sensor.StateSensor.processEvent(StateSensor.java:231)
at org.openremote.controller.model.sensor.Sensor.update(Sensor.java:338)
at org.openremote.controller.model.sensor.Sensor$DeviceReader.run(Sensor.java:608)
at java.lang.Thread.run(Thread.java:662)
Could it have something to do with, that I get this error message every time I stop the controller with Ctrl C.
ERROR [KNX IP reconnector]: Disconnect failed
org.openremote.controller.protocol.knx.ip.KnxIpException: Disconnect failed
at org.openremote.controller.protocol.knx.ip.IpTunnelClient.disconnect(IpTunnelClient.java:146)
at org.openremote.controller.protocol.knx.KNXIpConnectionManager$KNXConnectionImpl.stop(KNXIpConnectionManager.java:816)
at org.openremote.controller.protocol.knx.KNXIpConnectionManager$KNXConnectionImpl.access$000(KNXIpConnectionManager.java:636)
at org.openremote.controller.protocol.knx.KNXIpConnectionManager.stop(KNXIpConnectionManager.java:209)
at org.openremote.controller.protocol.knx.KNXIpConnectionManager$ConnectionTask.removeConnection(KNXIpConnectionManager.java:990)
at org.openremote.controller.protocol.knx.KNXIpConnectionManager$ConnectionTask.run(KNXIpConnectionManager.java:977)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Exception in thread "KNX IP reconnector" java.lang.IllegalStateException: Shutdown in progress
at java.lang.ApplicationShutdownHooks.add(ApplicationShutdownHooks.java:39)
at java.lang.Runtime.addShutdownHook(Runtime.java:192)
at org.openremote.controller.protocol.knx.ip.IpTunnelClient.connect(IpTunnelClient.java:128)
at org.openremote.controller.protocol.knx.KNXIpConnectionManager$KNXConnectionImpl.connect(KNXIpConnectionManager.java:704)
at org.openremote.controller.protocol.knx.KNXIpConnectionManager.getConnection(KNXIpConnectionManager.java:224)
at org.openremote.controller.protocol.knx.KNXIpConnectionManager$ConnectionTask.run(KNXIpConnectionManager.java:980)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
The result is that I have to wait a few minutes before I can get the controller to start properly again. I don't think I had that problem with earlier versions of the controller.
Thank you,
/ Kenneth
Mar 28, 2012
Marcus Redeker says:
The polling Error and the KNX error should not be related. I also see the KNX er...The polling Error and the KNX error should not be related.
I also see the KNX error lately with my setup and we will have to take a look at that.
The virtual command itself should be already in the designer. What is not available there?
The few minutes wait could be because your KNX gateway only releases the connection after a few minutes if the connection was not closed properly. This is probably related to the KNX problem.
Mar 28, 2012
Kenneth Stridh says:
When I try to create the new Virtual Command "1" in the designer, I can't fill i...When I try to create the new Virtual Command "1" in the designer, I can't fill in command = 1. It says "use on/off or status"
Mar 28, 2012
Marcus Redeker says:
The NullPointerException is from my modification. Please update with the attache...The NullPointerException is from my modification. Please update with the attached VirtualCommand.class.
You can just use "status" as a command since this is not used at the time of controller startup anyway.
The KNX problem, we have to investigate.
VirtualCommand.class
Mar 29, 2012
Kenneth Stridh says:
Thanks Markus! Now the state sensor works perfectly, no polling errors and stat...Thanks Markus!
Now the state sensor works perfectly, no polling errors and status as command works too.
Thank you very much.
Mar 29, 2012
Marcus Redeker says:
You are welcome. If you are done with your design and it's worth sharing, you co...You are welcome.
If you are done with your design and it's worth sharing, you could post some screenshots
Mar 30, 2012
Kenneth Stridh says:
I'm just at the beginning of my design, but as soon as I have something that may...I'm just at the beginning of my design, but as soon as I have something that may be worth showing, I promise to post some screenshots.
Feb 04
pe zanstra says:
I'm just at the beginning of my design, but as soon as I have something that may...@Kenneth, Did you ever get this working and documented?
Feb 08
Kenneth Stridh says:
Yes, it works perfectly, but I have not done any documentation on it. I'm still...Yes, it works perfectly, but I have not done any documentation on it.
I'm still not finished with my design, but of course I can show some screenshots of my images, depending on various states (as I promised).
I use the "State Sensor" for example to show different images depending on, dimming value of lamps, bar chart showing different fan speeds and different positions on my awnings.
Here are a few screenshots.
The way I did it:
Create a in-memory Virtual Command (like this).
Create a custom sensor to display state value from the command (like this).
Connect the new sensor to your image and then add the alternate image for each state (like this).
Write a rule to put the sensor in the different state (like this).
"balcony awing position status" is the name of the level sensor, where the value will trigger the state.
"Set state balcony awing" is the name of the in-memory virtual command that we just created.
Feb 08
pe zanstra says:
Impressive, thanks!Impressive, thanks!
Apr 18, 2012
Nejc Šmid says:
Hi all! I focus on monitoring my 1-wire radiation solar sensor. Sensor gives me...Hi all!
I focus on monitoring my 1-wire radiation solar sensor. Sensor gives me the current values witch I can display with using custom sensor. Output value is like 0.0002343. I would like to set rules to separate range of output values. Like from 0 to 0.0003454, display "it is dark " and so on.
I did the following steps:
Command: State
Address: 1
Name: a, Value: a
Name: b, Value: b
package org.openremote.controller.protocol
package org.openremote.controller.model.event
global org.openremote.controller.statuscache.CommandFacade execute;
global org.openremote.controller.statuscache.SwitchFacade switches;
global org.openremote.controller.statuscache.LevelFacade levels;
(i just add all that i found)
rule "crate a"
when
????( source == "solar command ", value > 0.0000000 && <= 0.0002111 )
then
execute.command("state", "a");
end
rule "create b"
when
????( source == "solar command", value > 0.0002111 && <= 0.0050111 )
then
execute.command("state", "b");
end
I tried with "Level" but it didn't work. Do I need to use "CustomState"? I'm also confused by the line " $evt : "(like $evt : Range()). When can i use this?
Thanks for all support,
Nejc
Apr 18, 2012
Marcus Redeker says:
Are you using the 2.0 release with the patches from this thread? The 1-Wire com...Are you using the 2.0 release with the patches from this thread?
The 1-Wire command only returns a String and no number like the KNX temperature command.
This means you are most likely using a CustomSensor to display your 1-Wire reading which is fine for the UI.
For the rule to work you need to use CustomState where you have your questionmarks but also need to convert the value (which is a String) into a number.
Could you try this one:
rule "crate a"
when
CustomState( source == "solar command ", Float.parseFloat(value) > 0.0000000 && <= Float.parseFloat(0.0002111) )
then
execute.command("state", "a");
end
Apr 18, 2012
Nejc Šmid says:
First, thanks for your quick reply. Yes i'm using the 2.0 release with the patc...First, thanks for your quick reply.
Yes i'm using the 2.0 release with the patches from this thread.
But i have strange problem. When i define rules and upload it into controller, all my display number(labels)... temperature (1-Wire) and date (DateTime protocol) (which is not connected with rules or virtual command) became N/A.
Rules:
package org.openremote.controller.protocol
package org.openremote.controller.model.event
global org.openremote.controller.statuscache.CommandFacade execute;
global org.openremote.controller.statuscache.SwitchFacade switches;
global org.openremote.controller.statuscache.LevelFacade levels;
rule "create a"
when
CustomState( source == "svetilnost", Float.parseFloat(value) > Float.parseFloat(0.0000000) && <= Float.parseFloat(0.0002111))
then
execute.command("state", "a");
end
rule "create b"
when
Level( source == "svetilnost", Float.parseFloat(value) > Float.parseFloat(0.0002111) && <= Float.parseFloat(0.0050111))
then
execute.command("state", "b");
end
Thank you,
Nejc
Apr 18, 2012
Marcus Redeker says:
Please check the log directory and see if you find any errors and stacktraces.Please check the log directory and see if you find any errors and stacktraces.
Apr 18, 2012
Nejc Šmid says:
This is from boot.log. DEBUG 2012-04-18 15:17:37,274 : Initializing event proce...This is from boot.log.
DEBUG 2012-04-18 15:17:37,274 : Initializing event processor: Drools Rule Engine
DEBUG 2012-04-18 15:17:37,302 : Adding Rule 'modeler_rules.drl'...
ERROR 2012-04-18 15:17:37,719 : Cannot start event processor 'Drools Rule Engine' : Unable to load dialect 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java:org.drools.rule.builder.dialect.java.JavaDialectConfiguration'
org.drools.RuntimeDroolsException: Unable to load dialect 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java:org.drools.rule.builder.dialect.java.JavaDialectConfiguration'
at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:283)
at org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:268)
at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:181)
at org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:159)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:210)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:143)
at org.drools.builder.impl.KnowledgeBuilderFactoryServiceImpl.newKnowledgeBuilder(KnowledgeBuilderFactoryServiceImpl.java:34)
at org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:47)
at org.openremote.controller.statuscache.rules.RuleEngine.getValidKnowledgePackages(RuleEngine.java:484)
at org.openremote.controller.statuscache.rules.RuleEngine.start(RuleEngine.java:253)
at org.openremote.controller.statuscache.EventProcessorChain.start(EventProcessorChain.java:112)
at org.openremote.controller.statuscache.StatusCache.start(StatusCache.java:120)
at org.openremote.controller.deployer.Version20ModelBuilder.buildSensorModel(Version20ModelBuilder.java:615)
at org.openremote.controller.deployer.Version20ModelBuilder.build(Version20ModelBuilder.java:537)
at org.openremote.controller.deployer.AbstractModelBuilder.buildModel(AbstractModelBuilder.java:148)
at org.openremote.controller.service.Deployer.startup(Deployer.java:760)
at org.openremote.controller.service.Deployer.softRestart(Deployer.java:373)
at org.openremote.controller.service.Deployer$ControllerDefinitionWatch.run(Deployer.java:1188)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.drools.RuntimeDroolsException: value '1.7' is not a valid language level
at org.drools.rule.builder.dialect.java.JavaDialectConfiguration.getDefaultLanguageLevel(JavaDialectConfiguration.java:162)
at org.drools.rule.builder.dialect.java.JavaDialectConfiguration.init(JavaDialectConfiguration.java:57)
at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:279)
... 18 more
Apr 18, 2012
Marcus Redeker says:
The Drools version we currently use, does not support Java7. Can you try with a ...The Drools version we currently use, does not support Java7. Can you try with a Java6?
Apr 18, 2012
Nejc Šmid says:
I will try with a Java6. Thank you very much, NejcI will try with a Java6.
Thank you very much,
Nejc
Apr 19, 2012
Nejc Šmid says:
Hi. I installed java6 and tried deploy my configurations. I get this (boot.log...Hi.
I installed java6 and tried deploy my configurations.
I get this (boot.log):
UNDEPLOYING CURRENT CONTROLLER RUNTIME...
--------------------------------------------------------------------
DEBUG 2012-04-19 12:44:53,921 : Stopping event processor: Drools Rule Engine
INFO 2012-04-19 12:44:53,922 : Stopped event processor : Drools Rule Engine
INFO 2012-04-19 12:44:53,923 : Shutdown complete.
INFO 2012-04-19 12:44:53,923 :
Any idea why Drools Rule Engine stopped?
Thanks,
Nejc
Apr 19, 2012
Marcus Redeker says:
It looks like the system started with a configuration that was already there and...It looks like the system started with a configuration that was already there and then a new sync was performed which does an undeploy first and then deploys again.
Please stop your Tomcat, delete controller.xml, panel.xml, panel.obj and any files in "rules" folder. Then start Tomcat again which should not deploy anything.
Now you can do a clean sync and see what happens.
Apr 19, 2012
Nejc Šmid says:
Now i get more useful errors: DEBUG 2012-04-19 13:26:30,891 : Adding Rule 'mode...Now i get more useful errors:
DEBUG 2012-04-19 13:26:30,891 : Adding Rule 'modeler_rules.drl'...
ERROR 2012-04-19 13:26:31,550 : Rule definition 'modeler_rules.drl' could not be deployed. See errors below.
ERROR 2012-04-19 13:26:31,551 : [ERR 103] Line 2:0 rule 'rule_key' failed predicate:
ERROR 2012-04-19 13:26:31,551 : [ERR 101] Line 2:8 no viable alternative at input 'org' in rule package
ERROR 2012-04-19 13:26:31,551 : [ERR 101] Line 4:0 no viable alternative at input 'global' in rule package in rule event
ERROR 2012-04-19 13:26:31,551 : [ERR 101] Line 12:56 no viable alternative at input 'value' in rule package in rule event in rule "ustvari stanje a" in pattern CustomState
ERROR 2012-04-19 13:26:31,551 : [ERR 102] Line 12:82 mismatched input '0.0000000' expecting ')' in rule package in rule event in rule "ustvari stanje a" in pattern CustomState in pattern Float.parseFloat
ERROR 2012-04-19 13:26:31,551 : [ERR 101] Line 12:96 no viable alternative at input '<=' in rule package in rule event in rule "ustvari stanje a" in pattern CustomState
ERROR 2012-04-19 13:26:31,551 : [ERR 102] Line 12:116 mismatched input '0.0002111' expecting ')' in rule package in rule event in rule "ustvari stanje a" in pattern CustomState in pattern Float.parseFloat
ERROR 2012-04-19 13:26:31,551 : [ERR 101] Line 19:50 no viable alternative at input 'value' in rule package in rule event in rule "ustvari stanje a" in rule "ustvari stanje b" in pattern Level
ERROR 2012-04-19 13:26:31,552 : [ERR 102] Line 19:76 mismatched input '0.0002111' expecting ')' in rule package in rule event in rule "ustvari stanje a" in rule "ustvari stanje b" in pattern Level in pattern Float.parseFloat
ERROR 2012-04-19 13:26:31,552 : [ERR 101] Line 19:90 no viable alternative at input '<=' in rule package in rule event in rule "ustvari stanje a" in rule "ustvari stanje b" in pattern Level
ERROR 2012-04-19 13:26:31,552 : [ERR 102] Line 19:110 mismatched input '0.0050111' expecting ')' in rule package in rule event in rule "ustvari stanje a" in rule "ustvari stanje b" in pattern Level in pattern Float.parseFloat
ERROR 2012-04-19 13:26:31,555 : There was an error parsing the rule definition 'modeler_rules.drl' : Could not parse knowledge.
java.lang.IllegalArgumentException: Could not parse knowledge.
at org.drools.builder.impl.KnowledgeBuilderImpl.newKnowledgeBase(KnowledgeBuilderImpl.java:58)
at org.openremote.controller.statuscache.rules.RuleEngine.getValidKnowledgePackages(RuleEngine.java:532)
at org.openremote.controller.statuscache.rules.RuleEngine.start(RuleEngine.java:253)
at org.openremote.controller.statuscache.EventProcessorChain.start(EventProcessorChain.java:112)
at org.openremote.controller.statuscache.StatusCache.start(StatusCache.java:120)
at org.openremote.controller.deployer.Version20ModelBuilder.buildSensorModel(Version20ModelBuilder.java:615)
at org.openremote.controller.deployer.Version20ModelBuilder.build(Version20ModelBuilder.java:537)
at org.openremote.controller.deployer.AbstractModelBuilder.buildModel(AbstractModelBuilder.java:148)
at org.openremote.controller.service.Deployer.startup(Deployer.java:760)
at org.openremote.controller.service.Deployer.softRestart(Deployer.java:373)
at org.openremote.controller.service.Deployer$ControllerDefinitionWatch.run(Deployer.java:1188)
at java.lang.Thread.run(Thread.java:662)
INFO 2012-04-19 13:26:31,659 : Initialized event processor : Drools Rule Engine
This are my rules:
package org.openremote.controller.protocol
package org.openremote.controller.model.event
global org.openremote.controller.statuscache.CommandFacade execute;
global org.openremote.controller.statuscache.SwitchFacade switches;
global org.openremote.controller.statuscache.LevelFacade levels;
rule "ustvari stanje a"
when
CustomState( source == "svetilnost", Float.parseFloat(value) > Float.parseFloat(0.0000000) && <= Float.parseFloat(0.0002111))
then
execute.command("state", "a");
end
rule "ustvari stanje b"
when
Level( source == "svetilnost", Float.parseFloat(value) > Float.parseFloat(0.0002111) && <= Float.parseFloat(0.0050111))
then
execute.command("state", "b");
end
Apr 19, 2012
Kenneth Stridh says:
I also get a lot of those errors when I use the "package org.openremote.controll...I also get a lot of those errors when I use the "package org.openremote.controller.protocol"
Try without that line.
/ Kenneth
Apr 19, 2012
Nejc Šmid says:
The same errors appeared. Just for information: With this configuration (rules)...The same errors appeared.
Just for information: With this configuration (rules) my android app crashes.
In other cases my app works fine.
/Nejc
Apr 20, 2012
Marcus Redeker says:
This rule works: package org.openremote.controller.model.event global org.o...This rule works:
Try to adapt to your needs.
Apr 23, 2012
Nejc Šmid says:
I tried to adopt but without success. My rule: ackage org.openremote.controlle...I tried to adopt but without success.
My rule:
ackage org.openremote.controller.model.event
global org.openremote.controller.statuscache.CommandFacade execute;
global org.openremote.controller.statuscache.SwitchFacade switches;
global org.openremote.controller.statuscache.LevelFacade levels;
import java.lang.Float;
rule "ustvari a"
when
CustomState(source == "svetilnost", val : value, eval(Float.valueOf(val) > 0.0000000) && eval(Float.valueOf(val) < 0.0002111))
then
execute.command("state", "a");
end
rule "ustvari b"
when
CustomState(source == "svetilnost", val : value, eval(Float.valueOf(val) > 0.0002111) && eval(Float.valueOf(val) < 0.0050111))
then
execute.command("state", "b");
end
And error list:
DEBUG 2012-04-23 09:49:25,557 : Adding Rule 'modeler_rules.drl'...
ERROR 2012-04-23 09:49:25,869 : Rule definition 'modeler_rules.drl' could not be deployed. See errors below.
ERROR 2012-04-23 09:49:25,869 : Rule Compilation error The method valueOf(String) in the type Float is not applicable for the arguments (Object)
The method valueOf(String) in the type Float is not applicable for the arguments (Object)
ERROR 2012-04-23 09:49:25,869 : Rule Compilation error The method valueOf(String) in the type Float is not applicable for the arguments (Object)
The method valueOf(String) in the type Float is not applicable for the arguments (Object)
ERROR 2012-04-23 09:49:25,869 : There was an error parsing the rule definition 'modeler_rules.drl' : Could not parse knowledge.
java.lang.IllegalArgumentException: Could not parse knowledge.
at org.drools.builder.impl.KnowledgeBuilderImpl.newKnowledgeBase(KnowledgeBuilderImpl.java:58)
...
/ Nejc
Apr 23, 2012
Marcus Redeker says:
try: Float.valueOf((String)val)try: Float.valueOf((String)val)
Apr 23, 2012
Nejc Šmid says:
Now there are no errors, but Drools Rule Engine is stopped. Boot.log: DEBUG 201...Now there are no errors, but Drools Rule Engine is stopped.
Boot.log:
DEBUG 2012-04-23 13:05:35,923 : Initializing event processor: Drools Rule Engine
DEBUG 2012-04-23 13:05:35,924 : Adding Rule 'modeler_rules.drl'...
DEBUG 2012-04-23 13:05:36,056 : Adding rule definitions from 'modeler_rules.drl'...
INFO 2012-04-23 13:05:36,067 : Initialized event processor : Drools Rule Engine
...
DEBUG 2012-04-23 13:05:38,177 : Stopping event processor: Drools Rule Engine
INFO 2012-04-23 13:05:38,178 : Stopped event processor : Drools Rule Engine
INFO 2012-04-23 13:05:38,181 : Shutdown complete.
Sensors.log (svetilnost sensor is custom sensor that uses Virtual command):
INFO 2012-04-23 13:05:36,167 : Started polling thread for sensor (ID = 266, name = svetilnost senzor).
INFO 2012-04-23 13:05:38,178 : Shutting down polling thread of sensor (ID = 266, name = svetilnost senzor).
Apr 23, 2012
Marcus Redeker says:
Can you try and delete controller.xml, panel.xml, and file within rules folder. ...Can you try and delete controller.xml, panel.xml, and file within rules folder.
Restart tomcat and make a fresh sync.
Apr 23, 2012
Nejc Šmid says:
The same happens.The same happens.
Apr 23, 2012
Marcus Redeker says:
It seems to redeploy the configuration. Do you find anything in the logfiles?It seems to redeploy the configuration.
Do you find anything in the logfiles?
Apr 23, 2012
Nejc Šmid says:
No, i didn't. Could be problem in java and javac path? I have jdk6 in /usr/lib/j...No, i didn't.
Could be problem in java and javac path? I have jdk6 in /usr/lib/jvm/. I set JAVA_HOME to /usr/lib/jvm/ and JRE_HOME to /usr/lib/jvm/jre/ (jdk containing jre).
When I run openremote.sh I get in terminal:
root@ort-laptop:/usr/OpenRemote-Controller/bin# sh openremote.sh run
Using CATALINA_BASE: /usr/OpenRemote-Controller
Using CATALINA_HOME: /usr/OpenRemote-Controller
Using CATALINA_TMPDIR: /usr/OpenRemote-Controller/temp
Using JRE_HOME: /usr/lib/jvm/jre
23.4.2012 17:17:13 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/OpenRemote-Controller/webapps/controller/WEB-INF/lib/native
23.4.2012 17:17:13 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
23.4.2012 17:17:13 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 618 ms
23.4.2012 17:17:13 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
23.4.2012 17:17:13 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
23.4.2012 17:17:13 org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive webconsole.war
23.4.2012 17:17:14 org.openremote.controller.bootstrap.Startup redirectJULtoLog4j
INFO: Initialized JUL to LOG4J Redirector.
...
Apr 23, 2012
Marcus Redeker says:
Everything looks normal. If you start tomcat does it look like this at the end: ...Everything looks normal.
If you start tomcat does it look like this at the end:
Can you see your design when access the controller with your console?
Apr 23, 2012
Nejc Šmid says:
If you start tomcat does it look like this at the end: yes. I can see my design...If you start tomcat does it look like this at the end: yes.
I can see my design in webconsole. Label that should display rule output isn't shown. Other looks normal.
May 23, 2012
Pawel Jucewicz says:
(del)(del)
May 23, 2012
Pawel Jucewicz says:
I searched forums and haven't found such an issue. I want send a value to KNX ...I searched forums and haven't found such an issue.
I want send a value to KNX via Switch or button. I have created In Memory commands: on, off, status. Then i created sensor using status command and after that I created Switch. Addresses for commands are "dummy". I also added switch to a panel.
I also created rule which, I hope, will write value to a KNX group addres (scene recall). Updated file VirtualCommand.class
The Rule is
rule "Send Value 1"
when
Switch( source == "switch 1 sensor", value == "on")
then
execute.command("Scena 1 slide",1);
end
And I get error form openremote
ERROR 2012-05-23 16:31:35,925 : Rule definition 'modeler_rules.drl' could not be deployed. See errors below.
ERROR [HTTP-Thread-1]: Rule definition 'modeler_rules.drl' could not be deployed. See errors below.
ERROR 2012-05-23 16:31:35,925 : Unable to resolve ObjectType 'Switch'
ERROR [HTTP-Thread-1]: Unable to resolve ObjectType 'Switch'
ERROR 2012-05-23 16:31:35,926 : Rule Compilation error execute cannot be resolved
ERROR [HTTP-Thread-1]: Rule Compilation error execute cannot be resolved
Unable to resolve ObjectType 'Switch' : [Rule name='Send Value 1']
Rule Compilation error : [Rule name='Send Value 1']
defaultpkg/Rule_Send_Value_1_0.java (8:295) : execute cannot be resolved
What am I doing wrong? I think that the value should be derived from sensor but why OpenRemote cannot resolve ObjectType Switch?
I would really appreciate your help.
P.S I tried with rule
rule "Send Value 1"
when
Switch( sourceID == 550, value == "on")
then
execute.command("Scena 1 slide",1);
end
And had no changes...
May 23, 2012
Marcus Redeker says:
Do you have the package, the globals and imports in your rule file? If not, put ...Do you have the package, the globals and imports in your rule file?
If not, put the following lines
infront of your rule definition
May 23, 2012
Pawel Jucewicz says:
That's it! I did quick update and everything works perfect now! Thank you very ...That's it!
I did quick update and everything works perfect now! Thank you very much.