Reading LoRa electricity meters via TTN

Since my electricity meter in the basement cannot be connected to the WiFi, I use the iOKE868 Smart Metering Kit. It is connected to The Things NETWORK via LoRaWAN, which I have integrated into my Home Assistant.

Now I have an entity that alternately outputs the consumption and feed-in of a balcony power plant. I am wondering how I can assign these changing values ​​to a consumption or feed-in sensor.

This is what the output looks like in json format.

For consumption

{
  "OBIS_IDs": [
    {
      "GroupMask": 252,
      "OBIS_ID": "1_0_1_8_0_255",
      "Scaler": -1,
      "rawValue": 101501104,
      "unit": "Wh",
      "value": 10150110.4
    }
  ],
  "general_info": {}
}

and for the feed-in

{
  "OBIS_IDs": [
    {
      "GroupMask": 252,
      "OBIS_ID": "1_0_2_8_0_255",
      "Scaler": -1,
      "rawValue": 24176,
      "unit": "Wh",
      "value": 24176.6
    }
  ],
  "general_info": {}
}

The values ​​can be differentiated using the OBIS_IDs. How can I assign this to different sensors depending on the OBIS_ID?

Thank you for your help!

To be precise, I have a device with a sensor entity. The format of the entity is in json. The representation of this format comes from TTN for better readability. In Home Assistant, the state of the sensor is displayed like this:

[{‘GroupMask’: 252, ‘OBIS_ID’: ‘1_0_2_8_0_255’, ‘Scaler’: -1, ‘rawValue’: 24598, ‘unit’: ‘Wh’, ‘value’: 2459.8}]

The attribute for differentiation is “OBIS_ID”

I think I solved it. I created two template sensors that extract the string. I then had to divide them by 10 to get the decimal places.

# Strombezug
- name: "Strombezug"
  unique_id: "strombezug"
  unit_of_measurement: "Wh"
  device_class: energy
  state_class: total_increasing
  state: >
    {% if '1_0_1_8_0_255' in states('sensor.ioke868_obis_ids') %}
      {{ states('sensor.ioke868_obis_ids')[74:83]|float(0) / 10}}
    {% endif %}

# Stromeinspeisung
- name: "Stromeinspeisung"
  unique_id: "stromeinspeisung"
  unit_of_measurement: "Wh"
  device_class: energy
  state_class: total_increasing
  state: >
    {% if '1_0_2_8_0_255' in states('sensor.ioke868_obis_ids') %}
      {{ states('sensor.ioke868_obis_ids')[74:79]|float(0) / 10}}
    {% endif %}