I’m trying to make a rule that will send an E-Mail according to the battery state.
When I try to compare the battery state to the value I want I get the following error:
[ntime.internal.engine.RuleEngineImpl] - Rule 'sent test email': Unknown variable or command '>'; line 6, column 9, length 8
If I try to set the battery state as as Number
I get the following error:
[ntime.internal.engine.RuleEngineImpl] - Rule 'sent test email': Could not cast mqtt_topic_e4df1f67_battery (Type=NumberItem, State=100, Label=Battery, Category=null) to java.lang.Number; line 6, column 9, length 13
Here is my code:
rule "sent test email"
when
Item mqtt_topic_e4df1f67_battery received update
then
var bat = mqtt_topic_e4df1f67_battery as Number
if (bat > 90) {
val mailActions = getActions("mail","mail:smtp:81520fb9")
mailActions.sendHtmlMail("shaulliv@gmail.com", "Batt status", "batt status > 90%")}
end
And In Visual studio code I get the value of mqtt_topic_e4df1f67_battery
as value 100 (which is correct):
Any help Would be appreciated.