Create a lock entity and let a switch control it

I am experiencing some problems with the following:

I want to make a lock entity(just for visibility in UI) and let a IKEA E1743 switch control the status. So pushing the I(on) button should be “Locked” and pushing the O(off) should be “Unlocked”.

The switch is paired through Z2M.

I have no luck creating the lock entity because I cant figure it out when its not attached to any entity. And I guess the controls should keep it in a state when the buttons are pushed but dont know how to do it.

Can somebody guide me in the right direction, please?