GPIO high after boot


Hi out there.

I realy enjoy to do projects with Cayenne. Its super simple.
But i have a real world problem and i hope anyone out there can help me:

I´ve made a outdoor-Whirlpool-Controller out of my RaspberryPi with Cayenne. I can controll the filterpump and the heater.
Both are controlled via a dual-relaisboard. Problem of this board is: it has inverted inputs. So, when the relais should be off, the GPIO has to be high. So far not problem. But we had a power-outage last night. Afterwards my PoolPi came up again and activated the pump and the heater. So my pool was useless heated.

How can i set the GPIO default as high after bootup?
Can anyone help?

cheers from Germany


Bug Filed on 05-18-2016: GPIO state changes after restart

Hi Ben
I have one or two relays set up on my pi that when it is rebooted all go high and some stay high and some that go low after a couple of seconds.
So depending on your set up would it be possible to exchange Gpio or change the no/nc round and use the inverted logic on the widget set up.


Hey Ben!

This is an issue we’ve seen come up before. We will be looking into a way to enable Cayenne users to set the default pin state upon boot. Right now we’re working on getting Arduino out the door so this may not be worked on for a little while.

Sorry to hear about the power-outage!



Hello take a read to this it might help if you dont resolve it yet.


Thanks for posting this!



for now I solved it by setting all pins as inputs … return later with app

Gpio state at reboot/ power up

I had the same problem with the relays on my pi. To set the GPIO pin to HIGH, these are the steps I took for my GPIO pin number 25.

  1. sudo nano /etc/webiopi/config
  2. Find the section on [GPIO] and add a new line like this: 25 = OUT 1
  3. Find the section on [~GPIO] and add the same line: 25 = OUT 1
  4. Exit and Save
  5. Reboot. The GPIO pin should stay HIGH when rebooting is done.

I hope this helps.

All relay switch automatically turning on when reboot raspberry pi

This would be a very valuable work around until Cayenne team can work on it…please share :slight_smile:


Ho there , It is not a solution but only a trick .
I noticed that at the boot inputs do not go high .
I set gpio as input .
when I have to change the relay status , change with output …
Pin gpio will go up immediately.
but it’s what I wanted …
certainly not good for continued use . …


You may want to alter the default pin state. Read more at

Note, the task is rated Advanced User.


Thanks! :slight_smile: I’m having to deal with it right now… :frowning:


Okay…I read it.

I’ll continue to design using the external pull-up resistors.
5 pin SIP, 2.2k, -or whatever. 2.2k allows enough current @ 3.3v
to light a LED-to-ground, -but still pull the GPIO input LOW.
Used for, like, a lit toggle switch.


@skyercorp Your workaround (note this is not a solution just a workaround) worked for me, Thank you for the help.

It would be awesome if this was built into Cayenne


Could this be used to change in input into an output


Any update on an official fix for this?


I have the same problem with raspberry pi 3 with INVERT LOGIC on relay. When the raspberry is reboted, the relays goes on because the GPIO pins goes HIGH.



This is going to happen with any system that is reset. The only thing you can do is try to minimize the disruption.

Because Linux needs to boot and then get an ethernet address and then connect to Cayenne before the I/O is restored, another solution is required.

I think the Cayenne guys were going to look at somehow storing off a current state structure that could be loaded at startup, but personally, I wouldn’t rely on this and instead, make sure my hardware goes to a safe state after reboot based on the Pi initial I/O state.




I will read more accurately the posts for workaround because on my relays I used to have water pumps for irrigation.


I’ve got the same problem with irrigation, a reboot could be very wet and expensive. If you are able to decipher the above work around or find a simpler answer, please share.


I think if I was doing this, I would use an I/O expander for my critical signals. That way when the chip resets, the state is very well known (defined in the data sheet), and isn’t fiddled with until we write to it.

Another idea is to just use an Arduino, or create a Pi controlled Arduino module and save the current I/O state to NVRAM and restore on reset.