JSONPATH Transform on dynamic json - spams WARN in log

OH 3.3.x

I have my first MQTT thing connected to Openhab, awesome :slight_smile: But I have some issue with parsing the incoming data. Problem: the JSON content varies!
When the sensor thingy starts it delivers a full status on all measured items like this

{
  "Time": "2023-01-12T21:09:48",
  "LOGAREX": {
    "total_in": 6512.0818,
    "total_out": 0.008,
    "current": 345,
    "total_day": 18.8,
    "total_week": 67.1,
    "total_month": 282.2,
    "total_year": 2750.9
  }
}

But all following messages contain only the subset of items whose value has acutally changed, like

{
  "Time":"2023-01-12T21:27:32",
  "LOGAREX":{
    "current":282
  }
}

I have started to create channels of type Number based on this MQTT items JSON data, utilizing the JSONPATH, like

JSONPATH:$.LOGAREX.current

the next channel

JSONPATH:$.LOGAREX.total_in

The issue: openhab.log gets now spammed with

2023-01-12 21:31:44.674 [WARN ] [t.generic.ChannelStateTransformation] - Executing the JSONPATH-transformation failed: Invalid path '$.LOGAREX.total_in' in '{"Time":"2023-01-12T21:31:44","LOGAREX":{"current":280}}'

How to deal with that? It’s only a WARNING and not an ERROR but I still would like to get rid of that, if possible

thanks
Jens

No solution on how to deal with the case of data missing in a JSON.

But a configuration change on the tasmota device, by setting

TelePeriod 10

results in getting the complete JSON status every time instead of only the changed data.
This solves the problem by fixing the cause instead of the symptoms :slight_smile:

The solution is in the post just above yours.

This command can modify the delay between tele topic messages (assuming a Tasmota device), but the device may still send updates on value changes outside these messages (on a different topic usually, again assuming a Tasmota device). Depends whether the OP wants to act immediately on value changes, or is happy to wait for the tele topic.

Assuming Tasmota, of course…