I am using a Tasmota device with a lot of inputs which i want to use in openHAB.This works in general with openHAB2.5 and MQTT 2.5.1.
The Tasmota device sends a MQTT-Message
stat/RESULT = {“Time”:“2020-06-29T12:55:39”,“MCP230XX_INT”:{“D0”:0,“MS”:1305604}} or
stat/RESULT = {“Time”:“2020-06-29T12:56:07”,“MCP230XX_INT”:{“D0”:1,“MS”:28480}}
when the status of the input changes.
Every 5 minutes It also sends a
tele/SENSOR = {“Time”:“2020-06-29T12:54:02”,“MCP230XX”:{“D0”:1,“D1”:1,“D2”:1,“D3”:1,“D4”:1,“D5”:1,“D6”:1,“D7”:1,“D8”:0,“D9”:0,“D10”:0,“D11”:0,“D12”:0,“D13”:0,“D14”:0,“D15”:0}}
message which includes the stati of all inputs.
So i defined in a .things file:
Thing mqtt:topic:Homeio "Home IO" (mqtt:broker:myMqttBroker) {
Channels:
Type switch : In0 "Home IO In 0" [ stateTopic="tele/SENSOR", transformationPattern="JSONPATH:$.MCP230XX.D0", on="0", off="1" ]
Type switch : In0 "Home IO In 0" [ stateTopic="stat/RESULT", transformationPattern="JSONPATH:$.MCP230XX_INT.D0", on="0", off="1" ]
}
I want to use the two different message-types to set the status of the item, because if an stat/RESULT message gets lost the staus should be set at least every 5 Minutes from the tele/SENSOR message.
and in my .items file:
Switch OG1_Homeio_in0 "Test Taster 0" ( G_HOMEIO ) { channel="mqtt:topic:Homeio:In0" }
But it does not work as expected. Only the stat/RESULT message sets the item. I don’t know the right method to set the item from two different MQTT-Messages.
Has anyone an idea?
Michi