[SOLVED] Temperature reading from Sonoff / Tasmota TH16

I have an Openhab2.3 installed on a old IBM X41 running Debian 9.
I can control Sonoff / Tasmota (version 6.2.1) units via my local Mosquitto installationn
I can control the switch on the TH16 (and get status back) and I can read the temperature from the sensor attached to it.
But I only get readings every 5 minutes.
I have tried “everything” but cannot find out how to get readings with a shorter interval or eventually trigger it via a timed rule.
My items for the TH16 looks as follows:
Switch jum130 “JUM-130” {mqtt="<[jum-mqtt:stat/JUM-130/POWER:state:default],>[jum-mqtt:cmnd/JUM-130/POWER:command:ON:1],>[jum-mqtt:cmnd/JUM-130/POWER:command:OFF:0]"}
Number jum130temp “Temperature [%.1f °C]” { mqtt="<[jum-mqtt:tele/JUM-130/SENSOR:state:JSONPATH($.DS18B20.Temperature)]" }
How should my item definitions look to get temperature readings with shorter interval?

The MQTT Item only receives the temperature readings when the Sonoff sends them. So you will have to configure how often it sends the temperature readings on the Sonoff itself. I only have Sonoff Basics so I can’t tell you how or whether it is possible to change the reporting period.

But there is nothing you can do from OH to increase the frequency.

Thanks for clarifying that.
Now I see that the Sonoff under “Configure Logging” can change the interval with the parameter “Telemetry period”.
That is fine for my use of the TH16 for now.
But I have read somewhere that it is possible to trigger a “tele” reporting but have not succeded in getting it to work.

cmd/mysonoff/stat/STATUS 8
Should reply with the sensors status


This was a great help. I had some trouble transforming it to an OpenHAB string, but here is what I ended up with. It requests a Sonoff status update with temperature (and time):

Switch jum130stat "JUM-130-Status" {mqtt=">[jum-mqtt:cmnd/JUM-130/STATUS:state:*:8]"}

After this I can read the temperature with the following which read periodic readings via the part with “tele” and the corresponding reading triggered via the Switch above via the part with “stat”:

Number jum130temp "Temperature  [%.1f °C]" { mqtt="<[jum-mqtt:tele/JUM-130/SENSOR:state:JSONPATH($.DS18B20.Temperature)], 
    <[jum-mqtt:stat/JUM-130/STATUS8:state:JSONPATH($.StatusSNS.DS18B20.Temperature)]" }

But how do I end this thread? - I have got all the answers needed!

1 Like

You tick the solved mark under the post that provided the solution

That’s not the post that gave you the solution, that’s the post that told you how to mark as solved, please tick the post #4