You’re describing a ‘momentary switch’, and while we do have this on our Product Roadmap, it’s not a feature of Cayenne just yet.
I know that you’ve mentioned that you’re on a Raspberry Pi here, but for the sake of completeness in case you want to go a different route with this project, or for anyone else who finds this thread, I wanted to link this thread where @kreggly was nice enough to share his solution for a momentary switch on Arduino: