Translating a sensor with base64 value to 20 separate decimal sensors

Here’s how to convert that into the list:

{% set s = "AAAAEAAAABIAAAARAAAAFQAAABcAAAAOAAAAEAAAADEAAAFeAAAAAAAAAAAAAAAoAAACNgAAAAAAAAAAAAAAAAAAAAYAAAAOAAAAAAAAAAA=" %}
{% set ns = namespace(s="") -%}
{% for c in s|map('ord')|reject('==',61) -%}
{% set ns.s = ns.s+"{:0=6b}".format(c+{1:-71,c<91:-65,c<58:4,c<48:16,c<44:19}[true]) -%}
{% endfor -%}
{{ ns.s|batch(32)|map('join')|map('int',base=2)|list }}

Note: this creates a 21st, unneeded item that you could trim off if you wanted.

I’d implement this by creating a template sensor with the list as an attribute, which you’ll need to do in YAML. Then, if you need to, you can read each item from the attribute into a separate template sensor without needing to re-do the calculation 20 times:

template:
  - sensor:
      - name: Tuya 101 list
        state: "{{ states['sensor.101']['last_updated'] }}"
        attributes:
          value_list: >
            {% set ns = namespace(s="") -%}
            {% for c in states('sensor.101')|map('ord')|reject('==',61) -%}
            {% set ns.s = ns.s+"{:0=6b}".format(c+{1:-71,c<91:-65,c<58:4,c<48:16,c<44:19}[true]) -%}
            {% endfor -%}
            {{ ns.s|batch(32)|map('join')|map('int',base=2)|list }}

You can create template sensor helpers in the UI with state templates of:

{{ state_attr('sensor.tuya_101_list','value_list')[x] }}

where x is a number from 0 (first) to 19 (last).

If that template looks like Perl or runic incantations, there’s an explanation here.