- Platform information:
- Hardware: RPI3
- OS: _Rabian
- Java Runtime Environment: Whats installed with OpenHAb2
- openHAB version: 2.5
- Issue of the topic: I am trying to make a simple rule as follows
var LB1_last_value_dimmer = 0
rule “Aan/Uit LB1”
when
Item LB1_Brightness changed
then
logInfo("LB1", "LB1 Rule fired")
logInfo("LB1", LB1_Brightness.state.toString)
if (LB1_Brightness.state == 0) {
logInfo("LB1-Cmd", "LB1-off")
LB1_last_value_dimmer=LB1_Brightness.previousState()
logInfo("LB1-LV", LB1_last_value_dimmer)
sendCommand(LB1_Brightness,0)
logInfo("LB1-SV", LB1_Brightness.state.toString)
} else {
if(LB1_Brightness.state == 100) {
logInfo("LB1-Cmd", "LB1-on")
sendCommand(LB1_Brightness,LB1_last_value_dimmer)
// LB1_Brightness.postUpdate(LB1_last_value_dimmer)
logInfo("LB1-SV", LB1_Brightness.state.toString)
}
}
end
In the logfile when I switch to ON the following text is seen:
2020-01-15 22:39:09.073 [INFO ] [g.eclipse.smarthome.model.script.LB1] - LB1 Rule fired
2020-01-15 22:39:09.082 [INFO ] [g.eclipse.smarthome.model.script.LB1] - 100
2020-01-15 22:39:09.099 [INFO ] [lipse.smarthome.model.script.LB1-Cmd] - LB1-on
2020-01-15 22:39:09.105 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Aan/Uit LB1’: An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.sendCommand(org.eclipse.smarthome.core.items.Item,java.lang.Number) on instance: null
It doenst seem to see LB1_last_value_dimmer anso when i switch OFF the following is in the log :
2020-01-15 22:41:53.317 [INFO ] [g.eclipse.smarthome.model.script.LB1] - LB1 Rule fired
2020-01-15 22:41:53.325 [INFO ] [g.eclipse.smarthome.model.script.LB1] - 0
2020-01-15 22:41:53.340 [INFO ] [lipse.smarthome.model.script.LB1-Cmd] - LB1-off
2020-01-15 22:41:53.348 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Aan/Uit LB1’: An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.LogAction.logInfo(java.lang.String,java.lang.String,java.lang.Object[]) on instance: null
I have the persistance service running mapdb with the following CFG file:
Strategies {
default = everyUpdate
}
Items {
LB1_Brightness : strategy = everyUpdate, restoreOnStartup
LB1_ColorTemperature : strategy = everyUpdate, restoreOnStartup
}
I am a beiginner in rules and tried a lot of combinations they all seem to fail, what am i doing wrong ?
please be detailed explaining your issue
- Please post configurations (if applicable):
- Items configuration related to the issue
- Sitemap configuration related to the issue
- Rules code related to the issue
- Services configuration related to the issue
- If logs where generated please post these here using code fences: