OpenHab 2.5 + Mosquitto + MQTTv2 not reads sensors

Hello guys!

I have a problem which makes me completely stucked, and start to drive me crazy :smiley:
So, I migrated to openhab2.5 (latest openhabian 32bit) with the new mqttv2 binding from 2.3 and mqtt1. I think I have set up everything correctly.
Mosquitto, zigbee2mqtt are running, Openhab is communicating with them, I can switch sonoff/tasmota switches on/off.
My problem is, that openhab simply don’t want to read the sensors, and any other datas, like wifi, ipaddress of sonoffs, etc. It not reads the zigbee2mqtt sensors, and not even the temperature and humidity sensors of a Sonoff TH16. But it can read the switch state of the same sonoff, and can turn it on and off.
There is no error in openhab log, or in mosquitto log
What I tried:

  • reinstall
  • used one broker for all
  • used transformations in .things
  • used mqtt without user/pass
  • used only one sonoff_TH16 and try to get the temperature
  • sacreficed a female goat on the top of the highest mountain in my country
  • reinstall
  • using different version of JAVA (now it is Zulu8 32bit)
  • tried different topic, channel namings

I don’t know if it is related with my things/items files, but here they are. I hope someone can help, or at least have faced with this kind of problem before.

sonoff.things

Bridge mqtt:broker:sonoff "MQTT Sonoff Broker" 
	[
	host="localhost",
    username="......",
    password="......",
    clientID="openHAB2sonoff",
	port=1883,
	secure=false
	]

{

	// Spajz venti
	Thing topic sonoff_TH16_01 "Sonoff - Spájz szellőzés" (mqtt:broker:sonoff) {
		Channels:
			Type switch : VentiSwitch "Spájz szellőző" [ 
				stateTopic="stat/sonoff_TH16_01/POWER", 
				commandTopic="cmnd/sonoff_TH16_01/POWER",
				on="ON",
				off="OFF"        
			]
			Type number : Temperature  "Hőmérséklet" [
				stateTopic="tele/sonoff_TH16_01/SENSOR/AM2301.Temperature"
			]
			Type number : Humidity  "Páratartalom" [
				stateTopic="tele/sonoff_TH16_01/SENSOR/AM2301.Humidity"
			]
			
		// Karbantartás
			Type string : Reachable "STH16_01 állapot" [ 
				stateTopic="tele/sonoff_TH16_01/LWT", transformationPattern="MAP:reachable.map"      
			]
			Type string : MacAddress "STH16_01 MAC Address" [
				stateTopic="stat/sonoff_TH16_01/STATUS5/StatusNET.Mac"
			]
			
			Type string : IPAddress "STH16_01 IP Address" [
				stateTopic="stat/sonoff_TH16_01/STATUS5/StatusNET.IPAddress"
			]
			
			Type number : WifiPower "STH16_01 Wifi power" [
				stateTopic="tele/sonoff_TH16_01/STATE/Wifi.RSSI"
			]
	}
	
	// Padlás villany
	Thing topic sonoff_basic01 "Sonoff - Padlás világítás" (mqtt:broker:sonoff) {
		Channels:
			Type switch : LightSwitch "Padlás villany" [ 
				stateTopic="stat/sonoff_basic01/POWER", 
				commandTopic="cmnd/sonoff_basic01/POWER",
				on="ON",
				off="OFF"          
			]			
			
		// Karbantartás
			Type string : Reachable "Padlás SB01 állapot" [ 
				stateTopic="tele/sonoff_basic01/LWT", transformationPattern="MAP:reachable.map"         
			]
			Type string : MacAddress "SB01 MAC Address" [
				stateTopic="stat/sonoff_basic01/STATUS5/StatusNET.Mac"
			]
			
			Type string : IPAddress "SB01 IP Address" [
				stateTopic="stat/sonoff_basic01/STATUS5/StatusNET.IPAddress"
			]
			
			Type number : WifiPower "SB01 Wifi power" [
				stateTopic="tele/sonoff_basic01/STATE/Wifi.RSSI"
			]
			
	}

	Thing topic sonoff_basic02 "Sonoff - Csengő relé" (mqtt:broker:sonoff) {
		Channels:
			Type switch : Csengo "Csengő relé" [ 
				stateTopic="stat/sonoff_basic02/POWER", 
				commandTopic="cmnd/sonoff_basic02/POWER",
				on="ON",
				off="OFF"          
			]			
			
		// Karbantartás
			Type string : Reachable "Csengő SB02 állapot" [ 
				stateTopic="tele/sonoff_basic02/LWT", transformationPattern="MAP:reachable.map"         
			]
			Type string : MacAddress "SB02 MAC Address" [
				stateTopic="stat/sonoff_basic02/STATUS5/StatusNET.Mac"
			]
			
			Type string : IPAddress "SB02 IP Address" [
				stateTopic="stat/sonoff_basic02/STATUS5/StatusNET.IPAddress"
			]
			
			Type number : WifiPower "SB02 Wifi power" [
				stateTopic="tele/sonoff_basic02/STATE/Wifi.RSSI"
			]
			
	}

		// Fürdő fűtés
	Thing topic sonoff_S26_01 "Sonoff - Fürdő radiátor" (mqtt:broker:sonoff) {
		Channels:
			Type switch : HeatSwitch "Fürdő radiátor" [ 
				stateTopic="stat/sonoff_S26_01/POWER", 
				commandTopic="cmnd/sonoff_S26_01/POWER",
				on="ON",
				off="OFF"          
			]		
            			
		// Karbantartás
			Type string : Reachable "Fürdő S26_01 állapot" [ 
				stateTopic="tele/sonoff_S26_01/LWT", transformationPattern="MAP:reachable.map"    
			]
			Type string : MacAddress "S26_01 MAC Address" [
				stateTopic="stat/sonoff_S26_01/STATUS5/StatusNET.Mac"
			]
			
			Type string : IPAddress "S26_01 IP Address" [
				stateTopic="stat/sonoff_S26_01/STATUS5/StatusNET.IPAddress"
			]
			
			Type number : WifiPower "S26_01 Wifi power" [
				stateTopic="tele/sonoff_S26_01/STATE/Wifi.RSSI"
			]
			
	}
}

sonoff.items

//padlás sonoff_basic01
    Switch padlasvillany "Be/Ki" <light> (gLight) { channel="mqtt:topic:sonoff:sonoff_basic01:LightSwitch" }
    
    //Karbantartás
    String SB01_live "sonoff_basic01 (padlás) állapot" (gReachable) { channel="mqtt:topic:sonoff:sonoff_basic01:Reachable" }
    String SB01_MACaddress "SB01 MAC: [%s]" <sonoff_basic> { channel="mqtt:topic:sonoff:sonoff_basic01:MacAddress" }
    String SB01_ip "SB01 IP: [%s]" <sonoff_basic> { channel="mqtt:topic:sonoff:sonoff_basic01:IPAddress" }
	Number SB01_wifi "SB01 Wifi [%d %%]" <network> (gWifi) { channel="mqtt:topic:sonoff:sonoff_basic01:WifiPower" }

//csengő sonoff_basic02
    Switch Doorbell "Ajtócsengő teszt" (gbell) {ihc="0x33c311", autoupdate="false"}
    Switch Doorbell_state (gbell) {ihc="0x33c312"}
    Switch csengo "SB02 power állapot" <light> (gLight) { channel="mqtt:topic:sonoff:sonoff_basic02:Csengo",  autoupdate="false" }
    
    //Karbantartás
    String SB02_live "sonoff_basic02 (csengő) állapot" (gReachable) { channel="mqtt:topic:sonoff:sonoff_basic02:Reachable" }
    String SB02_MACaddress "SB02 MAC: [%s]" <sonoff_basic> { channel="mqtt:topic:sonoff:sonoff_basic02:MacAddress" }
    String SB02_ip "SB02 IP: [%s]" <sonoff_basic> { channel="mqtt:topic:sonoff:sonoff_basic02:IPAddress" }
	Number SB02_wifi "SB02 Wifi [%d %%]" <network> (gWifi) { channel="mqtt:topic:sonoff:sonoff_basic02:WifiPower" }


//spájz TH16_01
    Switch spajzventi "Be/Ki" <fan_box> (gVenti) { channel="mqtt:topic:sonoff:sonoff_TH16_01:VentiSwitch" }

    //Szenzor
    Number spajzhofok "Hőmérséklet [%.1f °C]" <temperature> (gTemp) { channel="mqtt:topic:sonoff:sonoff_TH16_01:Temperature" }
    Number spajzparatartalom "Páratartalom [%.1f %%]" <humidity> (gHumi) { channel="mqtt:topic:sonoff:sonoff_TH16_01:Humidity" }
				
	//nyomógombhoz:
    Switch spajzvent_gomb "Szellőztetés" (gVenti) {ihc="0x33c311", autoupdate="false"}
    Switch spajzvent_gomb_state (gVenti) {ihc="0x33c312"}
        //szellőzés ideje
    Number szellozido 	"Szellőztetés időtartama (perc)     [%d]" <time> (gIdozites)
    
    //Karbantartás
    String STH16_01_live "sonoff_TH16_01 (Spájz venti) állapot" (gReachable) { channel="mqtt:topic:sonoff:sonoff_TH16_01:Reachable" }
    String STH16_01_MACaddress "STH16_01 MAC: [%s]" <sonoff_basic> {channel=" mqtt:topic:sonoff:sonoff_TH16_01:MacAddress" }
    String STH16_01_ip "STH16_01 IP: [%s]" <sonoff_basic> { channel="mqtt:topic:sonoff:sonoff_TH16_01:IPAddress" }
	Number STH16_01_wifi "STH16_01 Wifi [%d %%]" <network> (gWifi) { channel="mqtt:topic:sonoff:sonoff_TH16_01:WifiPower" }

//fürdő S26_01
    Switch furdofutes "Be/Ki" <radiator> (gFutes) { channel="mqtt:topic:sonoff:sonoff_S26_01:HeatSwitch" }

	//nyomógombhoz:
    Switch furdofutes_gomb "Fűtés" (gFutes) {ihc="0x33c311", autoupdate="false"}
    Switch furdofutes_gomb_state (gFutes) {ihc="0x33c312"}
        //szellőzés ideje
    Number furdofutesido 	"Fűtés időtartama (perc)     [%d]" <time> (gIdozites)
    
    //Karbantartás
    String S26_01_live "sonoff_S26_01 (F. radiátor) állapot" (gReachable) { channel="mqtt:topic:sonoff:sonoff_S26_01:Reachable" }
    String S26_01_MACaddress "S26_01 MAC: [%s]" <sonoff_basic> { channel="mqtt:topic:sonoff:sonoff_S26_01:MacAddress" }
    String S26_01_ip "S26_01 IP: [%s]" <sonoff_basic> { channel="mqtt:topic:sonoff:sonoff_S26_01:IPAddress" }
	Number S26_01_wifi "S26_01 Wifi [%d %%]" <network> (gWifi) { channel="mqtt:topic:sonoff:sonoff_S26_01:WifiPower" }

aqara.things

Bridge mqtt:broker:aqara "MQTT Aqara Broker" 
	[
	host="localhost",
    username="......",
    password="......",
    clientID="openHAB2aqara",
	port=1883,
	secure=false
	]

{
	Thing topic zigbeeMQTT "Zigbee2mqtt" {
    	Channels:
        	Type switch : permitJoin         [ stateTopic="zigbee2mqtt/bridge/config/permit_join", on="true", off="false" ]
        	Type string : state              [ stateTopic="zigbee2mqtt/bridge/state" ]
        	Type string : logType            [ stateTopic="zigbee2mqtt/bridge/log",  transformationPattern="JSONPATH:$.type" ]
        	Type string : logMessage         [ stateTopic="zigbee2mqtt/bridge/log",  transformationPattern="JSONPATH:$.message" ]
    }

	Thing topic AqaraHT01 "Aqara - HT01 - Nappali környezeti szenzor" {
		Channels:
			Type number : Temperature  "Hőmérséklet" [
				stateTopic="zigbee2mqtt/HT01/temperature"
			]
			Type number : Humidity  "Páratartalom" [
				stateTopic="zigbee2mqtt/HT01/humidity"
			]
			Type number : Pressure  "Légnyomás" [
				stateTopic="zigbee2mqtt/HT01/pressure"
			]
			
		// Karbantartás
			Type number : Voltage  "Elem feszültség" [
				stateTopic="zigbee2mqtt/HT01/voltage"
			]
			Type number : Battery  "Elem töltöttség" [
				stateTopic="zigbee2mqtt/HT01/battery"
			]
			Type number : Linkquality  "Jelerősség" [
				stateTopic="zigbee2mqtt/HT01/linkquality"
			]	
				
	}

	Thing topic AqaraHT02 "Aqara - HT02 - Fürdő környezeti szenzor" {
		Channels:
			Type number : Temperature  "Hőmérséklet" [
				stateTopic="zigbee2mqtt/HT02/temperature"
			]
			Type number : Humidity  "Páratartalom" [
				stateTopic="zigbee2mqtt/HT02/humidity"
			]
			Type number : Pressure  "Légnyomás" [
				stateTopic="zigbee2mqtt/HT02/pressure"
			]
			
		// Karbantartás
			Type number : Voltage  "Elem feszültség" [
				stateTopic="zigbee2mqtt/HT02/voltage"
			]
			Type number : Battery  "Elem töltöttség" [
				stateTopic="zigbee2mqtt/HT02/battery"
			]
			Type number : Linkquality  "Jelerősség" [
				stateTopic="zigbee2mqtt/HT02/linkquality"
			]	
				
	}



	Thing topic AqaraHT03 "Aqara - HT03 - Udvari környezeti szenzor" {
		Channels:
			Type number : Temperature  "Hőmérséklet" [
				stateTopic="zigbee2mqtt/HT03/temperature"
			]
			Type number : Humidity  "Páratartalom" [
				stateTopic="zigbee2mqtt/HT03/humidity"
			]
			Type number : Pressure  "Légnyomás" [
				stateTopic="zigbee2mqtt/HT03/pressure"
			]
			
		// Karbantartás
			Type number : Voltage  "Elem feszültség" [
				stateTopic="zigbee2mqtt/HT03/voltage"
			]
			Type number : Battery  "Elem töltöttség" [
				stateTopic="zigbee2mqtt/HT03/battery"
			]
			Type number : Linkquality  "Jelerősség" [
				stateTopic="zigbee2mqtt/HT03/linkquality"
			]	
				
	}

	Thing topic AqaraWL01 "Aqara - WL01 - Fürdőszobai csőtörés szenzor" {
		Channels:
			Type switch : Leakage  "Csőtörés" [
				stateTopic="zigbee2mqtt/WL01/water_leak", on="true", off="false"
			]


		// Karbantartás
			Type number : Voltage  "Elem feszültség" [
				stateTopic="zigbee2mqtt/WL01/voltage"
			]
			Type number : Battery  "Elem töltöttség" [
				stateTopic="zigbee2mqtt/WL01/battery"
			]
			Type number : Linkquality  "Jelerősség" [
				stateTopic="zigbee2mqtt/WL01/linkquality"
			]	
				
	}

	Thing topic AqaraWL02 "Aqara - WL02 - Szuterén csőtörés szenzor" {
		Channels:
			Type switch : Leakage  "Csőtörés" [
				stateTopic="zigbee2mqtt/WL02/water_leak", on="true", off="false"
			]

					
		// Karbantartás
			Type number : Voltage  "Elem feszültség" [
				stateTopic="zigbee2mqtt/WL02/voltage"
			]
			Type number : Battery  "Elem töltöttség" [
				stateTopic="zigbee2mqtt/WL02/battery"
			]
			Type number : Linkquality  "Jelerősség" [
				stateTopic="zigbee2mqtt/WL02/linkquality"
			]	
				
	}

	Thing topic AqaraMS01 "Aqara - MS01 - Bejárati 1. mozgás érzékelő" {
		Channels:
			Type switch : Occupancy  "Mozgás" [
				stateTopic=" zigbee2mqtt/MS01", transformationPattern="JS:getZigbeeOccupancy2Switch.js",
				on="true",
				off="false"
			]

			Type number : Illuminance "Fényerő" [
				stateTopic = "zigbee2mqtt/MS01/illuminance"
			]

					
		// Karbantartás
			Type number : Voltage  "Elem feszültség" [
				stateTopic="zigbee2mqtt/MS01/voltage"
			]
			Type number : Battery  "Elem töltöttség" [
				stateTopic="zigbee2mqtt/MS01/battery"
			]
			Type number : Linkquality  "Jelerősség" [
				stateTopic="zigbee2mqtt/MS01/linkquality"
			]	
				
	}	
}

aqara.items

// Control zigbee2mqtt
Group  gZigbeeMQTT    "Zigbee2mqtt"
String ZigbeeState               "Zigbee2mqtt state"                  <switch>    (gZigbeeMQTT) { channel="mqtt:topic:myMQTTBroker:zigbeeMQTT:state" }
Switch ZigbeePermitJoin          "Permit join new devices"            <switch>    (gZigbeeMQTT) { channel="mqtt:topic:myMQTTBroker:zigbeeMQTT:permitJoin" }
String ZigbeeLogType             "Zigbee2mqtt log type"                           (gZigbeeMQTT) { channel="mqtt:topic:myMQTTBroker:zigbeeMQTT:logType" }
String ZigbeeLogMessage          "Zigbee2mqtt log message"                        (gZigbeeMQTT) { channel="mqtt:topic:myMQTTBroker:zigbeeMQTT:logMessage" }

//Nappali szenzor
Number HT01_Temperature "Hőmérséklet [%.1f °C]"  <temperature> (gTemp) { channel="mqtt:topic:aqara:AqaraHT01:Temperature" }
Number HT01_Humidity "Páratartalom [%d %%]" <humidity> (gHumi) { channel="mqtt:topic:aqara:AqaraHT01:Humidity" }
Number HT01_Pressure "Légnyomás [%d mbar]" <pressure> (gPres) { channel="mqtt:topic:aqara:AqaraHT01:Pressure" }
Number HT01_Voltage "Tápfeszültség [%d mV]" <energy> (gVolt) { channel="mqtt:topic:aqara:AqaraHT01:Voltage" }
Number HT01_Battery "Töltöttség [%.1f %%]" <battery> (gEnerg) { channel="mqtt:topic:aqara:AqaraHT01:Battery" }
Number HT01_Linkquality "Jelerősség (max. 180) [%d]" <network> (gZigBeeWifi) { channel="mqtt:topic:aqara:AqaraHT01:Linkquality" }

//Fürdőszobai szenzor
Number HT02_Temperature "Hőmérséklet [%.1f °C]"  <temperature> (gTemp) { channel="mqtt:topic:aqara:AqaraHT02:Temperature" }
Number HT02_Humidity "Páratartalom [%d %%]" <humidity> (gHumi) { channel="mqtt:topic:aqara:AqaraHT02:Humidity" }
Number HT02_Pressure "Légnyomás [%d mbar]" <pressure> (gPres) { channel="mqtt:topic:aqara:AqaraHT02:Pressure" }
Number HT02_Voltage "Tápfeszültség [%d mV]" <energy> (gVolt) { channel="mqtt:topic:aqara:AqaraHT02:Voltage" }
Number HT02_Battery "Töltöttség [%.1f %%]" <battery> (gEnerg) { channel="mqtt:topic:aqara:AqaraHT02:Battery" }
Number HT02_Linkquality "Jelerősség (max. 180) [%d]" <network> (gZigBeeWifi) { channel="mqtt:topic:aqara:AqaraHT02:Linkquality" }

//Udvari szenzor
Number HT03_Temperature "Hőmérséklet [%.1f °C]"  <temperature> (gTemp) { channel="mqtt:topic:aqara:AqaraHT03:Temperature" }
Number HT03_Humidity "Páratartalom [%d %%]" <humidity> (gHumi) { channel="mqtt:topic:aqara:AqaraHT03:Humidity" }
Number HT03_Pressure "Légnyomás [%d mbar]" <pressure> (gPres) { channel="mqtt:topic:aqara:AqaraHT03:Pressure" }
Number HT03_Voltage "Tápfeszültség [%d mV]" <energy> (gVolt) { channel="mqtt:topic:aqara:AqaraHT03:Voltage" }
Number HT03_Battery "Töltöttség [%.1f %%]" <battery> (gEnerg) { channel="mqtt:topic:aqara:AqaraHT03:Battery" }
Number HT03_Linkquality "Jelerősség (max. 180) [%d]" <network> (gZigBeeWifi) { channel="mqtt:topic:aqara:AqaraHT03:Linkquality" }

//Fürdőszobai vízfolyás érzékelő
Switch WL01_Leakage "Csőtörés [%s]" <flow> (gAlarm) { channel="mqtt:topic:aqara:AqaraWL01:Leakage" }
Number WL01_Voltage "Tápfeszültség [%d mV]" <energy> (gVolt) { channel="mqtt:topic:aqara:AqaraWL01:Voltage" }
Number WL01_Battery "Töltöttség [%.1f %%]" <battery> (gEnerg) { channel="mqtt:topic:aqara:AqaraWL01:Battery" }
Number WL01_Linkquality "Jelerősség (max. 180) [%d]" <network> (gZigBeeWifi) { channel="mqtt:topic:aqara:AqaraWL01:Linkquality" }

//Szuterén vízfolyás érzékelő
Switch WL02_Leakage "Csőtörés [%s]" <flow> (gAlarm) { channel="mqtt:topic:aqara:AqaraWL02:Leakage" }
Number WL02_Voltage "Tápfeszültség [%d mV]" <energy> (gVolt) { channel="mqtt:topic:aqara:AqaraWL02:Voltage" }
Number WL02_Battery "Töltöttség [%.1f %%]" <battery> (gEnerg) { channel="mqtt:topic:aqara:AqaraWL02:Battery" }
Number WL02_Linkquality "Jelerősség (max. 180) [%d]" <network> (gZigBeeWifi) { channel="mqtt:topic:aqara:AqaraWL02:Linkquality" }

//Bejárati 1. mozgásérzékelő
Switch MS01_Occupancy "Mozgás [MAP(HM-Sen-MDIR-O-2.map):%s]" <motion> (gAlarm) { channel="mqtt:topic:aqara:AqaraMS01:Occupancy", autoupdate="false" }
Number MS01_Illuminance "Fényerő" <sun_clouds> (gLumi) { channel="mqtt:topic:aqara:AqaraMS01:Illuminance" }
Number MS01_Voltage "Tápfeszültség [%d mV]" <energy> (gVolt) { channel="mqtt:topic:aqara:AqaraMS01:Voltage" }
Number MS01_Battery "Töltöttség [%.1f %%]" <battery> (gEnerg) { channel="mqtt:topic:aqara:AqaraMS01:Battery" }
Number MS01_Linkquality "Jelerősség (max. 180) [%d]" <network> (gZigBeeWifi) { channel="mqtt:topic:aqara:AqaraMS01:Linkquality" }

This is unusual for a Sonoff with Tasmota. You would usually have to use the JSONPath transformation. Have a look at this post for a simple similar configuration.

You would also normally only create a single Bridge Thing from openHAB to your MQTT broker. You’ve shown two - are you sure that works?

With the sonoff you were right. Thank you very much for this! Now it is reading from the sonoff.

Both brokers are connecting to mosquitto. I changed to this two broker thingy in this morning, before this I tried with one. I’ve just wanted to separate my sonoff and aqara things into two files.

I do the same thing, and keep my Thing Bridge in a separate file too - have a look at the link again to see how I’ve done that! For each Thing, you reference the Bridge inside brackets ()…

Oh, cool! Thanks, I’m trying this.

Here’s another example using zigbee2mqtt. Make sure your zigbee2mqtt is setup to publish to individual topics, as detailed in the link!

Thank you very much, for your help. I struggled with this since days, and finally got it work. Everything is up and running.