Hello all,
I would like to send a broadcast information if the range of my Zoe is going below a certain limit.
I would like to get this message just once and not all the time I used a boolean. Following you’ll see the rule.
var boolean MessageB = false
rule "RenaultZEService_Zoe_send_broadcast_if_under_certain_limit"
when
Time cron "0 0/10 * * * ?" or
System started
then
if ((RenaultZEServices_Zoe_RemainingRange.state <= 100) && (!MessageB) ){
sendBroadcastNotification("Achtung! Restreichweite: " + RenaultZEServices_Zoe_RemainingRange.state +"km Ladestatus: " + RenaultZEServices_Zoe_ChargeLevel.state + "%" )
MessageB = true
logInfo("RemainingRange", "Remaining Range: " + MessageB)
} else (RenaultZEServices_Zoe_RemainingRange.state >= 100 && MessageB==true){
MessageB = false
}
Currently the range is below 100. I am receiving all 10 min the message, but this should not happen. I dont know why and where my mistake is.
Thanks in advance
Have you tried the same notation as in the else (missing if when using your condition?!? - else if (condition) or just else without condition), i.e. without the extra brakets and using a direct compare for the MessageB as well?
if (RenaultZEServices_Zoe_RemainingRange.state <= 100 && MessageB==false) {
Is it remaining above 100? Is it possible that it’s flapping between over and under? Look at your events.log and/or add some logging so you see when the else is running.