You may not use the card on Shabbos, since it sets off a light. One solution is to leave your door unlocked, by blocking the locking mechanism with a piece of cardboard. It may be halachically permissible to ask a non-Jew to open the door for you with the electronic key, but ask your rabbi. If your rabbi determines that you cannot ask the non-Jew directly, it may be permissible to hint indirectly that you cannot get into your room. Increasing sophistication has led to other problems.
Many hotel rooms have an electronic sensor that monitors movement.
When the sensor detects an empty room, it turns off the heat or air-conditioning. When someone enters the room, these switch on. More problematic is a sensor that turns on the lights when you enter. There are even hotel bathrooms where the bidet is activated electronically. It is your responsibility as a halachically sensitive traveler to determine your hotel's conditions ahead of time.