[inputs.mqtt_consumer] Error in plugin: cannot parse with empty selection node

Hi there,

I’m unable to parse data from a Tasmota device via MQTT. JSON contains two power meter sensors. I like to get the data for PwrZ1 and PwrZ2. Any hints on this? I’m lost here.

Thank you! :slight_smile:

I get this error:
2024-12-14T18:36:59Z E! [inputs.mqtt_consumer] Error in plugin: cannot parse with empty selection node

Config is this:

 data_format = "xpath_json"
 [[inputs.mqtt_consumer.xpath]]
    metric_name="'tasmota'"
    metric_selection = "child::*[starts-with(name(), 'Pwr')]"
    timestamp = "/Time"
    timestamp_format = "2006-01-02T15:04:05"
    timezone = "Local"
    [inputs.mqtt_consumer.xpath.tags]
      device = "name(.)"
      id = "Meter_id"
    [inputs.mqtt_consumer.xpath.fields]
      Total_in = "number(Total_in)"
      Power_cur = "number(Power_cur)"
      Total_out = "number(Total_out)"

JSON looks like this:

{"Time":"2024-12-14T19:41:58",
"PwrZ1":{"Total_in":105.5255,"Power_cur":395,"Total_out":499.7064,"Meter_id":"xxxxx"},
"PwrZ2":{"Total_in":188.5779,"Power_cur":382,"Total_out":219.1320,"Meter_id":"yyyy"}}