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" {
Channels:
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" {
Channels:
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"]
}
}
Items
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