The invention discloses a smart lock for a power distribution cabinet. The lower portion of a rotating shaft is fixedly connected with a cam, the left side of the cam abuts a small rotating wheel, thesmall rotating wheel is rotatably connected witha movable plate, the center of the left side end surface of the movable plate is fixedly connected with atelescopic plate, a strip-shaped through-holeis formed in the left side of a smart lock body, the telescopic plate is slidably connected to the strip-shaped through-hole,the upper surface of the telescopic plate is fixedly connected to a keyboard, the lower portion of the movable plate is fixedly connected to a pull rod, the right side of the pull rod is sleeved witha second sleeve, and the inside of the second sleeve is provided with a second spring. The smart lock drives the rotating shaft and the cam to rotate by rotating the handle, the cam drives the movable plate to move to the left, the movable plate drives the keyboard to be pushed out from the inside of asmart lock body, the upper end of a sleeve rod is aligned with a round hole, the sleeve rod pushes up a top rod to make a button protrude so as tokeep the cam still, it is convenient to input a password, when the button is pressed to separate the sleeve rod from the round hole, the pull rod and the movable plate are driven to move to the right by the action of the secondspring to place the keyboard, and the case that the long-term exposure of the keyboard increases the damage rate and reduces the service life is avoided.