And my MQTT broker shows the client connection. But Openhab complains with a communication error: âNo MQTT clientâ. Something is going wrong and I canât understand itâŠ
To avoid restarting when you often redefining things, you can separate definition of broker and thingâŠ
Example: bridge.things
Bridge mqtt:broker:broker âMQTT Broker: Mosquittoâ
[
host=â192.168.2.1â,
port=1883,
secure=âfalseâ
] temp.things
Thing mqtt:topic:miTemp (mqtt:broker:broker) {
Channels:
Type number : tempObyvak âAir Temperatureâ [ stateTopic=âsensor/teplota/obyvakâ]
}
The syntax is not defined by bindings and MQTT2 did not invent or provide its own syntax. The OH documentation explains the .things file syntax in detail, but @Ales_Macoun syntax works as well as the syntax in the binding documentation.
Trying to implement MQTT in OH2.4 until fixes are on the way, I must build a workaround.
I thought the hint from @Ales_Macoun will work for me. I understood to seperate the broker
and things in two different files. If I do this, OH gives me a warning.
2019-01-14 16:27:09.869 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model âmqtt.things.thingsâ is either empty or cannot be parsed correctly!
mqtt.things.things
Thing mqtt:topic:sensoren (mqtt:broker:MyMosquitto) {
Channels:
Type number : netatmo_4a41f941_sensor_temperature âSensor Temperaturâ [stateTopic=âU1/Buero/Sensor/Temperatureâ]
Type number : netatmo_4a41f945_sensor_noise âSensor LautstĂ€rkeâ [stateTopic=âU1/Buero/Sensor/Noiseâ]
Type number : netatmo_4a41f942_sensor_humidity âSensor Luftfeuchtigkeitâ [stateTopic=âU1/Buero/Sensor/Humidityâ]
Type number : netatmo_4a41f944_sensor_co2 âSensor CO2â
}
The syntax is exact the same than @Ales_Macoun. In the binding documentation for MQTT2 I could find following informations:
That is rather dangerous. Depending on the developer the file could be interpreted as âmqttâ filename with âthings.thingsâ extension. Please do not use the extension within the filename, that doesnât necessarily work.
And please use code fences. The syntax is not very readable your way.