[mqtt v2] Status of items ignores the messages statusTopic

EDIT: It turned out that there was some misspelling. The solution post is actually a suggestion useful for debugging.
In the following the original message

I am using some sonoff POW switches and a sonoff 4ch pro RF with tasmota version 8.4. I am using the mqtt2 binding for sending commands and recording power readings.

I always had troubles with the status of the items (both the on-off status of switches and recently
percentage position of the sunblinds) is not updated when it is changed from outside openHAB or at system startup (the 4CH can be commanded from an RF remote or by the mini website, the same apply for the switches).

I wonder whether I misunderstood the docs, because this behavior also occurred in version 1 of the mqtt binding. I understand, in fact, that the message received on stateTopic should be used to update the status of the item.

Here’s my thing and items configuration

Bridge mqtt:broker:mosquitto "Mosquitto" [ host="localhost", port=1883, secure=false, clientID="openHAB2" ]

    Thing topic tasmota-su "tasmota-su" @ "Bagno mansarda" {
        Type string : reachable "Reachable"              [ stateTopic="tele/tasmota-su/LWT" ]
        Type switch : power     "Power"                  [ stateTopic="stat/tasmota-su/POWER", commandTopic="cmnd/tasmota-su/POWER" ]
        Type number : powerload "Power load"             [ stateTopic="tele/tasmota-su/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power"]
        Type number : voltage   "Line voltage"           [ stateTopic="tele/tasmota-su/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]

    Thing topic tasmota-tenda-giu "Tenda giu" @ "Soggiorno" {
        Type dimmer : position  "Position"  [ min=0,max=100,stateTopic="stat/tasmota_tenda_giu/SHUTTER1", commandTopic="cmnd/tasmota_tenda_giu/SHUTTERSTOPPOSITION1", transformationPattern="JSONPATH:$.Shutter1.Position"]
        Type number : test "Test" [stateTopic="stat/tasmota_tenda_giu/SHUTTER1"]



Dimmer TendaGiu "Tenda Soggiorno  [%s]"<blinds> {channel="mqtt:topic:mosquitto:tasmota-tenda-giu:position"}
Number Test "Test [%s]"  {channel="mqtt:topic:mosquitto:tasmota-tenda-giu:test"}

In the command line of my raspberry I can see the stat/tasmota_tenda_giu/SHUTTER1 messages coming in
but the value of the dimmer item associated to the dimmer channel is never updated. The same apply for the state of the switch. On the other hand the number item Test is updated when the position of the blinds is changed, meaning that the processing of mqtt messages is correct.

Is there something wrong with mqtt (I’m still using 2.5.5), or is my understanding incorrect?
As a workaround, I could write a rule to update the items.

Thank you for your attention

We can’t see those.

The dimmer channel is looking for topic
so I would not expect it to do anything with topic

Is this about your tasmota not sending the things you expected, or when you expected?

Sorry I made a mistake copying the code
Now I have corrected it.
I am expecting the dimmer item TendaGiu to show on the sitemap the same value as the number item Test, as they are associated to the same topic.

It seems to me that items which are associated to a commandTopic are not updated with their stateTopic.

Cannot ever happen
One channel is looking for topic payload in JSON format "{key:value}"
The other channel is looking for a plain numeric payload "1234"
One message payload cannot be in both formats at once.

A useful temporary diagnostic is something like

        Type string : rawtest "Test" [stateTopic="stat/tasmota_tenda_giu/SHUTTER1"]

linked to a String type Item, then you will see the naked payload in your events.log as and when it changes.

Thank you for your kind patience. Unfortunately the correction I made to the code was incomplete: that transformation is not present. Anyway, I’ll follow your suggestion of looking at the string instead of the number and I will report back.

I assume you have setoption4 to 1


This is my kitchen dimmer light

    Thing topic Kitchen_Bench_Light "Bench Light" @ "Kitchen" {
        Type dimmer : dimmer  [ stateTopic="stat/Kitchen_Bench_Light/DIMMER", transformationPattern="JSONPATH:$.Dimmer", commandTopic="cmnd/Kitchen_Bench_Light/Dimmer" ]

I should have mispelled something, now the status is updated. Thanks to rossko57 suggestion it was easy to sort out the trouble.
I will implement a rule to use the tele topics to update status at startup.
Thank you all for your suggestions