Question about internal pullup

Hello,

I'd like to use two magnetic door sensors (NO - Normally Open) on two digital inputs. This is a vertical moving door, so for example if the bottom sensor is in closed state (digital input is LOW), we know that the door is closed.

I enabled internal pullup on both inputs, one sensor end connected to the arduino pin, the other one is to GND, and they work just fine. Because this is a battery based project, I'd like to save power whenever I can, so after the closed state of the door is acknowledged, the pullup resistor is not needed during sleep. They can be re-enabled during wake up process.

What would be the best practice to do this?

The closed sensor can be set to INPUT mode, it will remain LOW anyway. (Reference states: "Additionally, the INPUT mode explicitly disables the internal pullups.")

However this is not OK for the other one, because this way it would be floating. How can I make sure by setting to OUTPUT it will never get HIGH state during the config? (for safety reasons, because the other sensor end is connected to GND, it could accedintally cause shortcut).

If I think further, it is possible that the internal pullup will be not enough in the final project (e.g. noise from the door operating motor) so I have more concerns. If I add external 4,7k pullups for example, how can I "disable" them during sleep?

Or should I switch to pull down method? The bad thing about this, is the 5V being "outside the box". (it will operate outside, open air). However it will be powered by battery, if the isolation to earth is OK everywhere, this shouldn't be a problem?

I'm in a bit of a hang up with this, so I will be glad if someone could help me out.
Thanks in advance

However this is not OK for the other one, because this way it would be floating.

Wouldn't matter, the MCU will be asleep. Enable pullups first thing after wakeup and disable last thing before sleep.

What's the point? The internal pullups draw negligible current, probably in picoamps.

@JCA34F: I have interrupts on other INPUT pins, so I shouldn't leave any INPUT pin floating to avoid random interrupts.

The DigitalPins tutorial also draws attention to this:

"This also means however, that pins configured as pinMode(pin, INPUT) with nothing connected to them, or with wires connected to them that are not connected to other circuits, will report seemingly random changes in pin state, picking up electrical noise from the environment, or capacitively coupling the state of a nearby pin. "

@SteveMann: I measured 130uA on the digital pin in case of closed sensor (connected to ground through the sensor). That is all wasted continuously during whole day, because the door will be operated twice a day.

(Edited: 0,13uA was incorrect, correct value is 0,13mA or 130uA --> ~38kOhm internal pullup resistor)

If you are that concerned about current draw, I would wire it so that the normal connection is nothing but a pulldown resistor on the pin so it isn't floating, and when the sensor is active it applies 5V to the pin to create a High input.
And keep the pinMode as just Input, and not Input_High.

CrossRoads:
If you are that concerned about current draw, I would wire it so that the normal connection is nothing but a pulldown resistor on the pin so it isn't floating, and when the sensor is active it applies 5V to the pin to create a High input.
And keep the pinMode as just Input, and not Input_High.

That would be the same situation, because when to door is closed, the bottom NO sensor would be in closed state, making a path from 5V --> sensor --> pulldown resistor --> GND.