Convert a base 64 to bin and then integer

Hi all,
i’m analizing a tuya “value”: “DAABAQweAgENAAQBDR4DAQ4ABAEOHgYB”
it is a base64 number.
i used the link Base64 to binary: Encode and decode bytes online - cryptii to convert the number in integer number grouping the number in bytes (see image)


these integer number rappresent some information like hours minute and other.
Can i produce the same wthit a model in homeassitant?
thanks

This template code does the same operations as seen in your screen shot:

{{ ("DAABAQweAgENAAQBDR4DAQ4ABAEOHgYB" | base64_decode).encode() | map('int') | list}}

Result:

[
  12,
  0,
  1,
  1,
  12,
  30,
  2,
  1,
  13,
  0,
  4,
  1,
  13,
  30,
  3,
  1,
  14,
  0,
  4,
  1,
  14,
  30,
  6,
  1
]

best!
another question
for me each number rappresent an information for my pet feeder device.
for exsample [12, 0, 1, 1,…] 12:00 time, 1 integer meal portion, 1 boolean active/ no active.
if i use

i recive “0”
How i can have “00”?

Here’s an example:

{%- set decoded_bytes = ("DAABAQweAgENAAQBDR4DAQ4ABAEOHgYB" | base64_decode).encode() | map('int') | list -%}
Decoded bytes are {{ decoded_bytes }}
Time is {{ "{0:02d}:{1:02d}".format(*decoded_bytes) }}
Datetime is {{ now().replace(hour=decoded_bytes[0], minute=decoded_bytes[1], second=0, microsecond=0) }}
Meal portion is {{ decoded_bytes[2] }}
Is feeder active? {{ decoded_bytes[3] | bool }}

It looks like the list might have multiple groups? If this is a fixed size, you can process all the groups as well, for example:

slice {{ decoded_bytes | slice(6) | list}}

{% set groups = decoded_bytes | slice(decoded_bytes|length // 4) -%}
{% for group in groups %}
Group {{ loop.index }}
Time is {{ "{0:02d}:{1:02d}".format(*group) }}
Datetime is {{ now().replace(hour=group[0], minute=group[1], second=0, microsecond=0) }}
Meal portion is {{ group[2] }}
Is feeder active? {{ group[3] | bool }}
{% endfor %}

Another good solution
Thank
( @freshcoast i propose you another topic opposit Convert an integer list to bin and then base64)

If you have MQTT you can turn these into sensors pretty easily with an automation.