Determining if RPI-GIO IN was triggered by change or from Startup/Initialization?

That appears to be in conflict with this:

This is what is now working wonderfully.
Thank you so much for your help. I really appreciate it!!!

// Get whether this is second or later from context, if not defined in context then set to false
let secondOrLaterMessage = context.get("secondOrLaterMessage") || false
if (msg.payload == 1) {
    if (secondOrLaterMessage) {
        msg.payload = "Opening"
    } else {
        msg.payload = "Open"
    }
} else {
    // payload is 0 Return "Closed"
    msg.payload = "Closed"
}
// remember that next message will be second or later
secondOrLaterMessage = true
context.set("secondOrLaterMessage", secondOrLaterMessage)
return msg
1 Like