Alarmdecoder rule to close myq garage

I am just starting to get into rules, my programming skills are really hit and miss, so I am stuck.

I have attempted to read from a few controls, first I tried and was unsuccessful to have the door closed when alarmdecoder’s AlarmPanelDisplay is "ARMED STAY "

The second thing I tried was to go off of the alarmPanalStatusArmedStay, but that didn’t work.

This is what I have so far:
rule “Alarm_Stay_garage_close”

when
Item alarmPanelStatusArmedStay == 1

then
{
if (GarageDoorSwitch==ON){
sendCommand(GarageDoorSwitch,OFF)
logInfo(“AlarmDecoder”, “Garage Door Closed by Alarm”)
}
else { logInfo(“AlarmDecoder”, “Garage Door Already Closed”) }
}

end

Any ideas from someone who has an alarmdecoder and uses it to kick off things within rules?

Item alarmPanelStatusArmedStay == 1 

is not allowed as a trigger. you can trigger for

Item alarmPanelStatusArmedStay changed to 1 

if alarmPanelStatusArmedStay is a Number Item.

But maybe you want to auto-close the garage every time someone tries to open it if the alarmdecoder is armed, then you should trigger to

Item GarageDoorSwitch changed to ON

and test

if(alarmPanelStatusArmedStay.state as DecimalType == 1)

Thanks for your help. Basically what I want to do is close the garage door at night when I arm the alarm at night. It would’t be bad to have the door not work if the alarm is armed for stay. This is what I have hacked together so far but it still doesn’t seem to work.

rrule “Alarm_Stay_garage_close”

when
alarmPanelStatusArmedStay.state as DecimalType == 1

then

if (GarageDoorSwitch==ON){
sendCommand(GarageDoorSwitch,OFF)
}
else
end

:slight_smile: this

when 
alarmPanelStatusArmedStay.state as DecimalType == 1
then

is not allowed!!! See the wiki for all allowed rule triggers.
When the alarmdecoder is armed, I think, alarmPanelStatusArmedStay will change, so the rule would be

rule "Alarm_Stay_garage_close"
when 
    Item alarmPanelStatusArmedStay changed to 1
then	
    if (GarageDoorSwitch.state==ON)
        sendCommand(GarageDoorSwitch,OFF)
end

If this doesn’t work, please try this one:

rule "Alarm_Stay_garage_close"
when 
    Item alarmPanelStatusArmedStay changed
then    
    if (GarageDoorSwitch.state==ON && alarmPanelStatusArmedStay.state as DecimalType == 1)
        sendCommand(GarageDoorSwitch,OFF)
end

doh… thanks for your help. I tried these, they don’t seem to work.

Then please show your item definition for

alarmPanelStatusArmedStay

I put “Text item=alarmPanelStatusArmedStay” in a stitemap for giggles and when it is disarmed it returns a 0 and when it is armed in stay mode it is a 0 as well.

I then did the same for item alarmPanelStatusReady and it returns a 1 unless it has a fault or it armed. At this point it looks like when it arms in stay mode it isn’t updating the alarmPanelStatusArmedStay

The item is defined as
Number alarmPanelStatusArmedStay “panel armed stay: [%d]” (gPanel) {alarmdecoder=“KPM:00#status,bit=0”}

I am really just running the stock binding and settings definded in https://github.com/openhab/openhab/wiki/AlarmDecoder-binding

Yea I’m stuck, the alarmPanelStatusArmedStay doesn’t ever change status even after it is armed for stay and the timeout period is over. Does anyone else with an alarmdecoder leverage it to trigger other things in your system?

I ended up with this, I think it should suffice, I don’t think statushome is set to 1 unless you are armed in stay mode.

rule "Alarm_Stay_garage_close"
when
Item alarmPanelStatusHome changed to 1
then
if (GarageDoorSwitch.state==ON)
sendCommand(GarageDoorSwitch,OFF)
end

Did you try to log a more detailed file for alarmdecoder? https://github.com/openhab/openhab/wiki/AlarmDecoder-binding#trouble-shooting-and-debugging

Yea I’ve been running that but it doesn’t really show too much. The key has been the alarmPanelStatusHome status. On a Honeywell vista20 alarm panel it’s arming in “stay” mode. This is why I tried the alarmPanelStatusArmedStay thinking this would correspond to what I was doing. I’ve never seen alarmPanelStatusArmedStay change from its 0 value.

It seems to be working great though. It is so nice to be able to have the garage door close when I arm the alarm at night. I hate opening the door into the garage and discovering my garage is wide open. If only I had a ton of money to blow I would augment my z-wave with a bunch of z-wave locks. Then arming the alarm could lock up my doors.

I’ve tinkered a bit more and discovered another useful item value is that of alarmPanelZone. When the alarm is in ready mode (with no faults) it is a 0. When it faults the value changes to that of the last fault. If it changes to a 5 I know my back door has been opened for example.

My weakness has always been the coding side of things, hopefully this will hold my attention enough to where I can spot my own boneheaded mistakes in code.

I really appreciate your help.