A mechanism for linkage between the open state of a device containment apparatus and an electrical switch, relating to the technical field of electrical and electromechanical technology, comprising: a switch shaft (1-1), which is rotatably arranged on a side wall of a box, case, cabinet or
enclosure; a lock hook (1-2), which is arranged inside the box, case, cabinet or
enclosure, one end thereof being fixed at an inner end of the switch shaft (1-1); a hook head (1-3), which is mounted at the other end of the lock hook (1-2) via a hook head rotating shaft (1-6), the hook head (1-3) rotating around the hook head rotating shaft (1-6) through a
limited angle; a spring (1-4), which is mounted between the lock hook (1-2) and the hook head (1-3); a lock pin (2-1), which is fixed on the inner side of a door or cover of the box, case, cabinet or
enclosure, the rotation axis thereof being parallel or perpendicular to that of the hook head (1-3); and a switch block (1-10), which is fixed on the lock hook (1-2), controlling an electrical switch (1-5) to turn on or off during rotation of the lock hook (1-2). When the switch shaft (1-1) is rotated to a locked position, since the hook head (1-3) is rotatable, the hook head (1-3) does not obstruct closing of the door or cover, thereby preventing the problem of component damage due to improper use, and preventing the problem of linkage failure between the open state of the box, case, cabinet or enclosure and the electrical switch.