Use attribute value as variable in Picture Element configuration code

Hey guys!

Is there a way to Use an attribute value as variable in a Picture Element configuration code?

Basically, I am trying to use the brightness of a light as the opacity percentage of a state_image. In order to accurately reflect the brightness in a room in a 3d plan.

This is what I think it should look like. Although with a valid variable. https://i.imgur.com/uloExUt.png

I also tried using “{{ state_attr(‘light.livingroom_lights’, ‘brightness’) }}”

Thanks for reading!