Item received command - how to find out which command it was?


I’ve got some rollershutter devices that are connected via RFY (Somfy RTS). I want a rule for a virtual roller shutter switch, that checks the state of the door, before the roller shutter goes down, so it does not hit the door, if it’s open. Basically my rule looks like this

rule "Rollo Esszimmer Terrasse"
        Item    vROLL_ESS_Terrasse      received command
        if (DOOR_EG_Esszimmer.state == CLOSED) {
                if (vROLL_ESS_Terrasse.state == 0) {
                        sendCommand(ROLL_ESS_Terrasse, UP)
                } else if (vROLL_ESS_Terrasse.state == 100) {
                        sendCommand(ROLL_ESS_Terrasse, DOWN)

My problem is that I don’t know which command was actually issued to the virtual rollershutter (i.e., DOWN, STOP or UP) and I am currently checking the state for 0 (UP) and 100 (DOWN). A problem is, that the STOP command seems to trigger state 0 as well, so instead of stopping the roller shutter it keeps going up.

Can I somehow forward the UP, DOWN or STOP command instead of reading the state number and translating it myself to UP and DOWN? Is there a command that would allow me something like

sendCommand(ROLL_ESS_Terrasse, getReceivedCommand())

so the virtual switch really becomes a proxy?

Thanks in advance for any help.

You might be able to get the STOP command from the receivedCommand special variable. Since your rule is triggered by received command this variable should be populated by the command that triggered it.


@rlkoshak thanks a lot! That’s what I was looking for! So many things I still have to discover. I wonder how I missed that. Thanks a lot!