OH3 Read data from Sonoff TH

A friendly hello to the community. Since some weeks I’m working successful with OH3. A lot of hours with try and error brought me to my success. Now I have only one open issue.
I’ve connected a Sonoff TH10 flashed with the newest Tasmota firmware.
In OH3 I can read only the full string.
I need only the temperature value. How can I extract it.
I’m not able to write any code. I can only copy and paste.
Thanks to all for constructive proposals.

You probably missed to configure of the temperature channel in order to parse the returned JSON string ( which you posted above).
When displaying the channel configuration check the Show advanced box and insert JSONPATH:$.DS18B20.Temperature into the setting of Incoming Value Transformation.
Additionally please confirm that the JSON-Path transformation is installed.

As @opus says you need to configure your Thing Channel so that it extracts the temperature value using the JSONPATH Transformation Service.

See step 6 of this tutorial if you’re doing it all via the MainUI, substituting the JSONPATH that @opus has provided.

Thanks for this support. It’s running now.

Good evening, now I have again a question.
How I can extract the measuring time?

Would you like to have a guess, based on how you extract Temperature using JSONPATH?

1 Like

Thanks for the reply. I have the temperature value in openHab. I would like to know the last readin time.

Only the time would be best, without a date.

That would be a presentation issue for the UI; you can use a DateTime Item and choose to only display the time part in it’s state description.

Would you please so kind and give me an example? Do I have to create a new THING first? I’m still quite new to Openhab

You don’t need another thing, just create another channel, like the one for the temperature.
Look how you got the temperature from the JSON string, use the same technique to get the datetime.

This is what I did for the temperature and it’s running

And this for datetime but only NULL appears.

Look at the complete JSON string, getting the temperature worked with: $.DS18B20.temperature, because the JSON contains:
So you needed two statements to get the temperature.

I have understood. But in JSONPATH:$.DS18B20.datetime I have two statements, What I’m doing wrong? Would you please so kind and give me the solution.

Using the first statement only, you would have got either the statement after the : , since there is a statement within {}, a second statement is needed.
Now you are looking for another statement, you find it directly after the “time”. So you only need a single statement.

I apologize, but your well-meaning answers are of no help to me. I think the mistake is in that expression.

A concrete proposal for a solution would certainly help me further.

As you are trying to get the part of the JSON string that follows after "time", your needed statement is simply:

On how to display only the time from that datetime please use the search function of the forum.

Sorry, it’s not running.

This are my two channels. One for temperature and one for the time.
And these are my commands for the time.

Funny, OH3 did it for by itself. I linked an newly created item to Datum channel. Everything else ( including the JSONPATH… and the selection of item-type DateTime ) was done by OH3.
Can’t say what is not working for you.

Good morning Jürgen, maybe it was too late yesterday. Today morning I started again and tadaa, it’s working. Now I will look, how to seprate the time. My UI on a tablet is the HABPanel and I use the widget Dummy.

Maybe there I can format this string. Until now many thanks for your support.