Hello,
i got a little problem with previousState in a rule for a battery alarm.
I want a broadcast-message at every change of the battery level of my iPad, if its 25% or lower.
To avoid messages during charging, i want the message just, if the previousState ist greater than the actual state.
I created the following rule, but i doesn’t fire.
Woult be great if you could help me to get it running.
Thanks Alex!
rule "Battery_Low_iPad"
when
Item IPadVonFamilieIPad_Batterieladung changed
then
if (IPadVonFamilieIPad_Batterieladung.state <=25 && IPadVonFamilieIPad_Batterieladung.previousState.state > IPadVonFamilieIPad_Batterieladung.state ) {
sendBroadcastNotification("Das iPad muss geladen werden, der Akku hat nur noch "+IPadVonFamilieIPad_Batterieladung.state+" %!")
}
end
i also tried it with the if-statements in two brackets:
rule "Battery_Low_iPad"
when
Item IPadVonFamilieIPad_Batterieladung changed
then
if ((IPadVonFamilieIPad_Batterieladung.state <=25) && (IPadVonFamilieIPad_Batterieladung.previousState.state > IPadVonFamilieIPad_Batterieladung.state )) {
sendBroadcastNotification("Das iPad muss geladen werden, der Akku hat nur noch "+IPadVonFamilieIPad_Batterieladung.state+" %!")
}
end