Many hotels today equip the guests’ rooms with electronic locks, such that the doors open with a special card that is inserted into the door and unlocks the door electronically. It is clear that a Jew may not open a door in this fashion on Shabbat, and that the card has the status of Mukseh and may not be handled on Shabbat. To solve this problem, many hotels in Israel offer their guests a conventional key to use to open their doors on Shabbat. But elsewhere in the world, this solution is rarely available. What should a person do if he spends Shabbat in a hotel whose rooms can only be opened electronically?
Hacham Yishak Yosef, in his work Sefer Hamaarachot (p. 186; listen to audio recording for precise citation), writes that a Jewish traveler must do what he can to avoid this situation, and ensure not to stay in such a hotel on Shabbat. If, however, no hotel offering manual locks is available in the area, or if a person arrives right before Shabbat and does not have time to find a different hotel, then he should arrange with the hotel staff before Shabbat that a non-Jewish staff member should open his door for him. Meaning, he should inform them before Shabbat that when they see him come in or standing by his room, they should have someone – a non-Jew – open his door for him. If this arrangement was not made before Shabbat, Hacham Yishak writes, then there is room to allow the guest to ask a non-Jew directly to open his door. Hacham Yishak notes that this situation qualifies as a "Shebut D’shbut B’makom Sa’ar," which means that it entails asking a gentile to perform an action forbidden on the level of Rabbinic enactment in a situation where one would otherwise experience considerable discomfort. On this basis, there is room to allow asking a gentile to open one’s electronically operated door.
Clearly, however, this option should be viewed as a last resort; as mentioned, every effort should be made to avoid such a situation.
Hacham Yishak also discusses the issue of buildings whose front door is operated electronically by a doorman. He writes that in this regard there is more room to be lenient and allow one to enter after being "buzzed in" by the doorman. These doors can be opened manually, but the doorman prefers opening it with the buzzer for his own convenience. Since he performs the Melacha (activity that is forbidden for a Jew on Shabbat) for his own purposes, and not specifically for the Jew who enters the building, one may enter the building after the non-Jewish doorman presses the buzzer to unlock the door for him. Hacham Yishak adds, however, that it is laudable for one to be stringent in this regard, and ensure to walk into the building only together with a gentile who was "buzzed in."
This discussion assumes that the doorman is not Jewish. If the doorman is Jewish, then one certainly may not have him press the buzzer to open the door for him.
Summary: A traveler should make every effort not to say in a hotel on Shabbat if the doors can only be opened electronically. If one has no other option, then he should arrange with the hotel staff before Shabbat that a staff member will open the door for him each time he enters. If this arrangement was not made, then one may ask a gentile staff member on Shabbat to open his door for him. One may enter a building through a door that a non-Jewish doorman opens for him with a buzzer, though it is preferable to walk through such a door only together with a non-Jew.