Hello together it’s me again … the stupid one
now everything is working fine so it’s time to enhance the system. I have dicovered, that someone forget to switch off the toilet light, so I decide to write a rule that switch off the light after 15minutes. So far so good. I have defined the following item that will be updated correctly when I switch on/off the toilet-light.
Number LCN_WC_WC_Licht "M20(WC) WC Licht [%d]" <slider> {lcn="[lcn_home:OUTPUT_STATUS.4.20.1]"}
Now in the first step I want to get the brightness of the light as a integer value inside the rule.
rule "DetectWcLight"
when
Item LCN_WC_WC_Licht changed
then {
var int WC_Licht = LCN_WC_WC_Licht.state
logInfo("DetectLight", "LightOn =", WC_Licht) //, String::format ("%d", WC_Licht))
if (WC_Licht > 0) {
LightOn = true
//var Number A1Status = LCN_WC_Light.state
logInfo("LightOn =", WC_Licht)
}
else {
LightOn = false
}
}
end
When I know switch the light, I get empty Info-Message and an error
2018-04-11 14:58:19.564 [vent.ItemStateChangedEvent] - LCN_WC_WC_Licht changed from 0 to 64
==> /var/log/openhab2/openhab.log <==
2018-04-11 14:58:19.927 [INFO ] [e.smarthome.model.script.DetectLight] - LightOn =
2018-04-11 14:58:19.936 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'DetectWcLight': An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.IntegerExtensions.operator_greaterThan(int,int) on instance: null
My suggestion is, that the assigment to WC_Licht was the first error …
Are there any idear’s ?
Thanks and best regards
Stef