You’ve two different passwords in default.things file and your manual mqtt publishing.
Firstly: Is your broker connection is online? Pls check on paper-ui. OH’s broker connection must able to login to mqtt server, and subscribe to topics, what you defined as channels under that.
Second: Your temp sensor is well configured? In this case the sensor has to send temp values via mqtt. You could check it, if you download mqtt.fx application, connect it to the mosquitto service, and subscribe to #. You should see every mqtt messages in the app.
When everything is ready, your sensor will connect to mqtt server, and publish temp values to the configured topic. Your OH also connects to the mqtt server, and subscribe to this topic. When an mqtt message arrives to the mqtt server, the subscribed channel gets it, and write to the item, what you defined in your items file. You can check it step by step with mqtt.fx app, OH’s log viewer and OH’s paper ui.
mqtt.fx download link: https://mqttfx.jensd.de/index.php/download
Text item=AquariumTemperature label=“Temperature in Celcius” icon=“temperature”
}
}
mqtt.cfg
mosquitto.url=tcp://10.10.100.88:1883
mosquitto.qos=1
mosquitto.retain=true
mosquitto.async=false
mosquitto.user=openhabian
mosquitto.pwd=16394306
Let’s start!
After running - my logs:
[21:18:53] openhabian@openHABianPi:/var/log/mosquitto$ cat mosquitto.log
1562007758: mosquitto version 1.4.10 (build date Wed, 13 Feb 2019 00:45:38 +0000) starting
1562007758: Config loaded from /etc/mosquitto/mosquitto.conf.
1562007758: Opening ipv4 listen socket on port 1883.
1562007758: Opening ipv6 listen socket on port 1883.
1562007779: New connection from 10.10.100.174 on port 1883.
1562007779: New client connected from 10.10.100.174 as 4a471e603ba14ac683d0ef9b6b8129dd (c1, k60, u’openhabian’).
1562007813: New connection from 10.10.100.88 on port 1883.
[21:21:25] openhabian@openHABianPi:/var/log/openhab2$ cat openhab.log
2019-07-01 21:03:05.530 [WARN ] [.MqttBrokerConnectionServiceInstance] - MqttBroker connection configuration faulty: host : You need to provide a hostname/IP!
2019-07-01 21:03:07.479 [INFO ] [ebuilder.internal.HomeBuilderServlet] - Started Home Builder at /homebuilder
2019-07-01 21:03:07.493 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Time zone set to ‘Poland’.
2019-07-01 21:03:07.512 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Location set to ‘51.666,19.6838’.
2019-07-01 21:03:07.524 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Locale set to ‘en_PL’.
2019-07-01 21:03:07.527 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Measurement system set to ‘SIUnits’.
2019-07-01 21:03:14.573 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2019-07-01 21:03:18.065 [INFO ] [io.openhabcloud.internal.CloudClient] - Connected to the openHAB Cloud service (UUID = 635baac3-5139-404d-bbd9-62a5c4d8da4f, base URL = http://localhost:8080)
2019-07-01 21:03:25.147 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘default.items’
2019-07-01 21:03:28.803 [INFO ] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
2019-07-01 21:03:29.736 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘default.rules’
2019-07-01 21:03:29.773 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘default.rules’ is either empty or cannot be parsed correctly!
2019-07-01 21:03:30.365 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘default.sitemap’
2019-07-01 21:03:30.779 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘default.things’
2019-07-01 21:03:31.849 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at http://10.10.100.88:8080
2019-07-01 21:03:31.853 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at https://10.10.100.88:8443
2019-07-01 21:03:32.291 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2019-07-01 21:03:32.809 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin
2019-07-01 21:03:33.392 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to ‘10.10.100.88’ with clientid paho54054852791 and file store ‘/var/lib/openhab2/mqtt/10.10.100.88’
[21:21:30] openhabian@openHABianPi:/var/log/openhab2$ cat events.log
2019-07-01 21:03:31.035 [.ItemChannelLinkAddedEvent] - Link ‘AquariumTemperature-mqtt:topic:mosquitto:aquarium:temperature’ has been added.
2019-07-01 21:03:31.156 [hingStatusInfoChangedEvent] - ‘mqtt:topic:mosquitto:aquarium’ changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
2019-07-01 21:03:33.163 [hingStatusInfoChangedEvent] - ‘mqtt:broker:mosquitto’ changed from UNINITIALIZED to INITIALIZING
2019-07-01 21:03:33.282 [hingStatusInfoChangedEvent] - ‘mqtt:broker:mosquitto’ changed from INITIALIZING to OFFLINE
2019-07-01 21:03:33.312 [hingStatusInfoChangedEvent] - ‘mqtt:topic:mosquitto:aquarium’ changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING
2019-07-01 21:03:33.361 [hingStatusInfoChangedEvent] - ‘mqtt:topic:mosquitto:aquarium’ changed from INITIALIZING to OFFLINE (BRIDGE_OFFLINE)
2019-07-01 21:03:33.453 [hingStatusInfoChangedEvent] - ‘mqtt:broker:mosquitto’ changed from OFFLINE to ONLINE
2019-07-01 21:03:33.471 [me.event.ThingUpdatedEvent] - Thing ‘mqtt:broker:mosquitto’ has been updated.
2019-07-01 21:03:33.480 [hingStatusInfoChangedEvent] - ‘mqtt:topic:mosquitto:aquarium’ changed from OFFLINE (BRIDGE_OFFLINE) to ONLINE
Ok, we are close
Delete the mqtt.cfg from /etc/openhab2/services. This is a mqtt v1 configuration, you don’t need it.
The state topic on your .things file is short a bit. On mqtt.fx, you can see the topic, where the value arrives: aquarium/temperature/temperature_height . Change your .things file:
From:
Type string : temperature “Temperature in aquarium” [ stateTopic=“temperature_height”]
To:
Type string : temperature “Temperature in aquarium” [ stateTopic=“aquarium/temperature/temperature_height”]
Finally, change your .items file from:
Number AquariumTemperature “Aquarium temperature” { channel=“mqtt:topic:mosquitto:aquarium:temperature” }
to:
Number AquariumTemperature “Aquarium temperature [%.2f °C]” { channel=“mqtt:topic:mosquitto:aquarium:temperature” }
The short explanation (IMHO): Your thing sends the mqtt message to the longer topic, but you subscribe with OH to a short one. The two topics are different, that’s why your item remains empty. You have to use the same string as state topic, what your thing use to send the proper value. If you configure your sensor, you can set anything, as mqtt topic, but you have to use that full topic in your .things file.
For the final check, ssh to your OH, and type the command:
openhab-cli console
…and there issue the command:
items list
You’ll see your configured items, and it’s current value also. If everything works, the events.log will show you also, when your item gets the new value.
For some reason you’ve chosen to link a string type channel to a number type Item.
While you are investigating it would be best to link the channel to a String type Item - you can add one using the same channel without removing your existing number type.
I think you have to be more explicit here and give the full topic (the Thing topic is just making up an internal name for OH)
Type string : temperature “Temperature in aquarium” [ stateTopic=“aquarium/temperature/temperature_height”]
I apologize for the absence, unfortunately my wife forced me to a small renovation in our house ;). Then I completely reconfigured my network at home, created several VLAN’s, I launched the WPA Enterprise authentication in the part of WIFI and … the IKEA Tradfri has stopped working. Today I found topic on UBNT community ( https://community.ui.com/questions/USG-ikea-tradfri-connection-issues/efc09532-a808-4c43-86cf-2bb5e6573635 ).
As soon as I deal with Tradfri, I will return to MQTT. For now, thank you for your help, but please follow this topic - if I run MQTT, I will be proud of it, or I will continue to ask how to do it;)