How to create a sensor to display the Sonos audio in format?

How can I create a sensor to display the audio in format for a Sonos (Arc). I find myself checking that quite often and would like for a faster way to see it, or even make some automation around it.

I fixed it myself, if anyone interested:

#Sensor for Sonos Line-In format
- platform: scrape
  resource: http://192.168.50.179:1400/status/zp
  name: Sonos Arc Line-In
  select: "HTAudioInCode"
  value_template: >-
    {% if value == '33554434' %}
        Stereo
    {% elif value == '84934714' %}
        DD+
    {% elif value == '84934713' %}
        DD 5.1
    {% elif value == '59' %}
        Atmos
    {% elif value == '21' %}
        No Signal
    {% elif value == '0' %}
        No Signal
    {% else %}
        {{ (value | int)}}
    {% endif %}

Thanks for this! Only when it did not work I discovered that for my system the “HTAudioInCode” codes were different (eg. Atmos = 63). Do these change with firmware updates?

I don’t know, but I stopped using that since now the integration provides by default a sensor on audio input format