Toggle action in picture-glance

How can I toggle entities directly when tapping in a picture-glance?

I have a picture-glance with a camera image, and a lock entity. I would like tapping the lock to directly toggle the lock state. According to the docs, toggling is supported. However, it doesn’t say how. I have tried adding tap_action: toggle to the entity and to the card, with no luck.