I am using pushover to send notifications to my android device but for some reason if statements will not work
what so ever. what am I missing?
this code here works:
rule "Enable/Disable Alarm"
when
Item Arm_Alarm changed to ON
then
sendPushoverMessage(pushoverBuilder("Kitchen Door Opened").withEmergencyPriority())
end
This does not work for some reason:
rule "Enable/Disable Alarm"
when
Item Arm_Alarm changed to ON
then
if (XiaomiSensorKitchen_OpenStatus.state == OPEN){
sendPushoverMessage(pushoverBuilder("Kitchen Door Opened").withEmergencyPriority())
}
end
Am I missing some sort of Import or have I forgotten to enable something in a config file somewhere?
Perhaps this isnāt going to do what you expect. It isnāt an āalarmā for the kitchen door. The rule runs only once when āArmā is turned on, checks if the kitchen door is open at that time, and messages if so.
Did you mean to have a rule that runs when the door is opened, checks to see if the alam is armed, and messages if so?
rule "Enable/Disable Alarm"
when
Item XiaomiSensorKitchen_OpenStatus changed from CLOSED or
Item XiaomiSensorFrontDoor_OpenStatus changed from CLOSED
then
if(Arm_Alarm.state == ON)
{
if(XiaomiSensorKitchen_OpenStatus.state == OPEN){
sendPushoverMessage(pushoverBuilder("Kitchen Door Opened").withEmergencyPriority())
}else if(XiaomiSensorFrontDoor_OpenStatus.state == OPEN){
sendPushoverMessage(pushoverBuilder("Front Door Opened").withEmergencyPriority())
}
}
end
rule "Enable/Disable Alarm"
when
Item XiaomiSensorKitchen_OpenStatus changed to OPEN or
Item XiaomiSensorFrontDoor_OpenStatus changed to OPEN
then
if(Arm_Alarm.state == ON) {
val String doorName = triggeringItem.name.toString.split("_").get(0).substring(12) // returns "Kitchen or FrontDoor"
sendPushoverMessage(pushoverBuilder(doorName + " Door Opened").withEmergencyPriority())
}
end