I'm starting to feel like I have made a Rube Goldberg device

Do you mean something like this?

The first part is correct. The second part is questionable. Not wrong, just questionable.

Questionable in the sense that relayPin doesn't way anything about the type of relay it controls, so one doesn't know whether to use type one or type two constants.