Exposing volume_level of media_player to knx bus

Hello community!

i am trying to expose volume_level of a media_player entitiy to my knx bus. preferably in DPT 5.001.
according to the developer tools, volume_level a floating value reaching from 0 to 1.

is there an easy way to convert and expose this value?

If not, i guess a dirty automation + knx_send could be of help.
Hints and/or working snippets welcome!

Thanks!

Why would that be dirty? Just multiply by 100 (or by 255 to get HA and KNX native percent) and send it.
Alternatively create a template multiplying it to equal percent and expose that entity.

Because it seems like automations are the wrong use-case for it.

Do you happen to have code snippets ready for both cases? Id accept a workaround.
I am quite new to HA. Especially interested in the template approach.

Thanks!

I think this is a perfect use case for an automation. That’s exactly what they are there for.

If you like the template approach better see Template - Home Assistant
Upside of using expose is that it answers GroupValueRead requests.