Even using an Arduino the default for Cayenne for a relay is incorrect. I am quoting from another website,
"Arduino microcontrollers start up with all pins as inputs that float high. (Pi starts with all pins as input also)
Any pins that are intended to be active high outputs will be ‘active’ until the program makes them outputs and resets them low. In other words if this board was active high, your relay would be energized when you start up, and would remain so until you reset your pins as outputs and take them low.
The manufacturer thinks you don’t want that (you probably don’t) so this board is set up the opposite of that (active low)."
The problem here to me is that Cayenne in the code assumes relays are Active High…and I am just not finding that to be true. So I would believe either correcting the relay default in the code or setup the option to set an initial state.
Go online and search for relay boards. Your search will return 1000 active lows for every active high you find.
There are about 30 different solutions we could design to deal with the fact that Cayenne believes that an active high relay is normal (or that you want all relays turned on during startup).
I believe this is either:
a) a bug in the default setting for Cayenne for a relay
b) a configuration option that is desperately needed.
So a recap
- While the Pi reboots everything is in the correct state. OFF
- Any relays NOT configured in Cayenne stay off even after the Pi/relay is energized and Cayenne is active.
- Cayenne drives all configured channels LOW as a default, thus activating all configured relays.