Openhab2 + Tasmota devices: MQTT communication log WARN messages

Hi @all,
I’m new registered in this community, but was reading posts since many weeks and spend much ours in trying to help myself, but I didn’t find a solution.
I’m using OpenHab 2.5.6 in combination with Tasmota devices V8.3.1, which are integrated as MQTT generic device over the Mosquitto MQTT Broker.
Now, I have a problem and was searching for the solution, but didn’t find or understand the described hints, so I would like to describe my case in my own words and would be very happy, if someone have a hint for me.

I have installed the JSON transformation and polling some data from the tasmota devices over publishing e.g. “cmnd//Timer1” for Timer profile 1 settings of the tasmota device. In sum, I have configured 4 Timers and requesting the “cmnd//Timer<1-4>” frequently. So the response from tasmota for every of this 4 different requests is “state//RESULT” on which are more than one of the same Thing-channels listening. Channels for Timer1, Timer2, Timer3, Timer4 with the matching “JSONPATH:” syntax. If the result message from tasmota device is about settings for Timer1, Openhab generates log entries with WARN messages, that the JSON transformation of channels for Timer2, Timer3 and Timer4 can’t find any valid values in RESULT response for Timer1 settings. This doesn’t influence the functionality, but is not a nice behaviour in my opinion and trashing the logfile. Do I have any possibility to prevent these WARN messages in Openhab or in the Tasmota config.?

I would imagine, if it is possible in tasmota to differ between RESULT messages, it would be easy and unique for reading the response information. Maybe like if I’m publishing “cmnd//Timer1”, the request should be “stat//RESULTt1” and for “cmnd//Timer4” then “stat//RESULTt4”.

The Error messages looks like this:
2020-07-04 13:50:03.127 [WARN ] [t.generic.ChannelStateTransformation]
Executing the JSONPATH-transformation failed: Invalid path ‘$.Timer2.Time’ in ‘{“Timer4”:{“Arm”:1,“Mode”:0,“Time”:“22:10”,“Window”:0,“Days”:“1111111”,“Repeat”:1,“Output”:1,“Action”:0}}’

Many thanks for every hint or solution!

You’ve identified the problem correctly, the need to test whether a JSON field is actually present in a payload before trying to extract it with JSONPATH

1 Like

Ok, thanks for the advice. Then I didn’t understand the REGEX filter use, because I was finding these solution for more than one time and hab a problem in realizing it.
But, I’m happy to know, that I recognized the problem correctly and that there is a solution for that.

In my particular case on example requesting the “TIMER1” settings of the Tasmota S20, I got the response:

16:04:07 CMD: Timer1
16:04:07 MQT: stat/Bewaesserung/RESULT = {“Timer1”:{“Arm”:1,“Mode”:0,“Time”:“05:30”,“Window”:0,“Days”:“1111111”,“Repeat”:1,“Output”:1,“Action”:1}}

The JSON transformation channel which is listening to the RESULT response and focusing the “Arm” setting looks like this:

If I understand it right, I need to use the REGEX filter function in this example on the Timer1 part of this syntax right?

Yes, the MQTT binding allows the magic of chaining two transforms. So first you would use REGEX to see if the payload contains “Timer1” at all.
If it does, the whole payload gets passed to the chained JSONPATH.
If it doesn’t, the transformation stops without WARN messages.

See that linked post

Ok, now it could be that it is clear to me. Sorry for the stupid questions after you giving the right direction, but I would like to ensure the 100% solution because I’m searching for that since days until now…

So first you would use REGEX to see if the payload contains “Timer1” at all” means I need to change my Incoming JSON Transformation to:
So the REGEX filter at the beginning is the ‘gate’ to which the incoming string is able to come through, if in the following values are the “Timer1” existing?

Therefor the UTF-8 configuration is important to know and to configure it right in the Openhab settings?

I think you need some * in your REGEX as well.

All openHAB configs ought to be in UTF-8

Yes, that was a copy and paste format issue in this texteditor. The * were part of the Timer1 in brackets. Ok, I try to fix it with this information.

Thank’s a lot for clarification!

Unfortunately, I’m not successful to configure it according to the REGEX syntax in PaperUI. If I’m pasting REGEX:(.*Timer1.*)∩JSONPATH:$.Timer1.Days , after saving, refreshing browser with paperui view, it changes to REGEX:(.*Timer1.*)?JSONPATH:$.Timer1.Days with the question mark instead of the chain sign.

Before, I added EXTRA_JAVA_OPTS="-Dfile.encoding=UTF-8" in the file /etc/default/openhab2

If I’m opening the things file (org.eclipse.smarthome.core.thing.Thing.json), located in var/lib/openhab2/jsondb with Visual Studio Code, it shows the charset UTF-8 in the bottom line.

Now, I’m struggling with this… Any hint for solving that situation?

Who knows what character set your browser is using. Have you tried copy/pasting the intersection ∩ symbol from the help text onscreen?

I use Google Chrome. It should use the charset coding which is given by the source. Additionally I installed the addin “Set Character Encoding” and for PaperUI sites I set it to UTF-8. Behavior is still the same.
I copied & pasted it from posts in this thread or from other thread you were forwarding to. What do you mean with “help text onscreen”?

You talked of PaperUI. For a generic MQTT Thing channel, there is some descriptive text associated with the “transformation pattern” box that includes a display of the intersection ∩ symbol. That can be copy-pasted.

It works for other people. I don’t know what’s special about your setup. Does it actually work? Are you chasing a config display artifact?

So, copy&paste with the chain symbol from online help was not possible. In my case also not possible to configure it in the json files. So I was searching for another solution and figured that out today.

Thing Pool_Pump
Many Channels for Timer 1, listening all on stat/%topic%/RESULT of tasmota device and transforming each value in each channel with JSONPATH
Many Channels for Timer 2, listening all on stat/%topic%/RESULT of tasmota device and transforming each value in each channel with JSONPATH
Problem were the logs with collision information like described in the first post. It was not possible to filter that with REGEX function in my case. Also not with UTF-8 charset. Not sure why…

Thing: Pool_Pump
One channel for each Timer profile (1…4) which is listening to stat/%topic%/RESULT. The JSONPATH transformation are not performed in the channels but in the items. In the channels im only using the REGEX filter standalone in Incoming Value Transformations, like: REGEX:(.*Timer1.*)

Then the item which is linked to the channel is configured like this: String Bew_Timer1_Status "Bew_Timer1_Status" {channel="mqtt:topic:Bewaesserung:Timer1"[profile="transform:JSONPATH", function="$.Timer1.Arm"]}

Now, the REGEX filter will just pass the e.g. Timer1 setting string which is published on stat/%topic%/RESULT and the item will filter the particular value with the JSONPATH transformation setting in it.

Thank’s a lot for your hints. I learned a lot more about OpenHAB!

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.