My device only works connected to a power outlet

The battery may, after a long period of not being used, need to be charged for a longer period of time than usual. Try a full discharge of the battery and recharge it to 100% capacity. Check whether your device now works normally; that is, without being connected to a power supply