extracting different sensors from value_json array

I am using an bluetooth gateway to gather temperature data from several temperature sensors. The gateway sends the data through mqtt to my homeassistant. That part works wonderful.
The message of the gateway looks like following. It sends the data of several temperature sensors in one message:

[{"timestamp":"2024-12-31T12:42:24.203Z","type":"S1","mac":"C300002613FB","bleNo":0,"bleName":"","rssi":-78,"battery":100,"temperature":11.880000000000001,"humidity":60.109999999999999},
{"timestamp":"2024-12-31T12:42:24.204Z","type":"S1","mac":"C300002B46CC","bleNo":0,"bleName":"","rssi":-27,"battery":100,"temperature":22.859999999999999,"humidity":37.460000000000001}]

I am having trouble with configuring the mqtt sensors. The value_template needs to go through all entries, checking if the mac address is the right one and then choosing the temperature value.
So far this is how the sensor looks like, but I have no clue how to do the value_template.

sensor:
  - name: "Temperatur"
    unique_id: "minew_s1_1"
    state_topic: "gw/ac233dv18ddc/status"
    device_class: "temperature"
    unit_of_measurement: "°C"
    value_template: >-
          ???
    device:
      name: Minew Gateway 1
      model: Gateway G1
      model_id: ac233fc18ddc
      manufacturer: Minew
      identifiers: ["minew_g1_1"]

Can anyone help me please?

Thanks a lot.

Welcome to the forum, and thank you for a well-constructed and formatted first question :slight_smile: .

This should work:

value_template: "{{ value_json|selectattr('mac','eq','C300q002B46CC')|map(attribute='temperature')|first }}"

…with the appropriate MAC as required.

Thanks Troon! I am glad to be here and I am so hyped with HA, that I will be here for a while.

Thanks for the reply. I will test this tomorrow and let you know if it works.