MQTT Topic defintion

I have a Pixii Energy Storage Unit from which I’d like to get data for the HA Energy Dashboard. I can “listen” to the MQTT data stream from Pixii losing the HA Configuration Tool Listener, however only to Topics that contain several separate data elements.

When using the Topic pixii/status/253101100376/meter_ext6 I get the data for the whole Topic:
pixii/status/235101100376/meter_ext6 {“m_ts”:“2025-04-24T10:52:12.084Z”,“meter_a1”:13.9189,“meter_a2”:13.8863,“meter_a3”:13.8804,“meter_kwh_exp”:0.387,“meter_kwh_imp”:460.961,“meter_source”:“Front”,“meter_v1”:241.598,“meter_v2”:241.662,“meter_v3”:241.073,“meter_w1”:3359.8,“meter_w2”:3353.76,“meter_w3”:3344.72}

I only want wto parts of the topic as separate sensors, namely “meter_kwh_imp” and “meter_kwh_exp”.

If I specify state_topic: “pixii/status/253101100376/meter_ext6/meter_kwh_imp” in the listener I get nothing.

Using my Configuration.yaml I get “Unknown” from these sensors:

mqtt:
  sensor:
  - name: "Battery_energy_in"
    unique_id: battery_energy_in
    state_topic: "pixii/status/253101100376/meter_ext6"
    unit_of_measurement: "kWh"
    device_class: energy
    name: Energy To Battery
    state_class: total_increasing
#
  - name: "Battery_energy_out"
    unique_id: battery_energy_out
    state_topic: "pixii/status/253101100376/meter_ext6"
    unit_of_measurement: "kWh"
    device_class: energy
    icon: mdi:lightning-bolt
    name: Energy From Battery
    state_class: total_increasing

Obviously I have misunderstood the whole Topic thing or don’t understand it at all, so PLEASE, PLEASE help me to correct my Configuration.Yaml

/Göran Andersson

https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16

mqtt:
  sensor:
  - name: "Battery_energy_in"
    unique_id: battery_energy_in
    state_topic: "pixii/status/253101100376/meter_ext6"
    unit_of_measurement: "kWh"
    device_class: energy
    name: Energy To Battery
    state_class: total_increasing
    value_template: "{{ value_json.meter_kwh_imp }}"

  - name: "Battery_energy_out"
    unique_id: battery_energy_out
    state_topic: "pixii/status/253101100376/meter_ext6"
    unit_of_measurement: "kWh"
    device_class: energy
    icon: mdi:lightning-bolt
    name: Energy From Battery
    state_class: total_increasing
    value_template: "{{ value_json.meter_kwh_exp }}"

You MQTT Sensor configurations required a value_template field.