How did you get the pet to unlock cage behind the bookcase. The only two people you can use is the Wesley brothers?
You're in the Year 5 Weasley Storeroom, right? If so, you go into "pet" mode, which is actually a little black sneaky detonator (or something like that). Walk it over to the cage and tap the wand button and it will explode the cage, releasing what's inside.