Paper UI: Extensions-->bindings--> add MQTT Broker
Create/edit the file /opt/openhab2/conf/Services/mqtt.cfg
Sample mqtt.cfg
adafruit.url=tcp://io.adafruit.com:1883:1883
//client ID - unique string - anything
adafruit.clientId=48c70a89dbf3eff670d6db18bc804504
//username - your ADAFRUIT IO username
adafruit.user=myusername
//password is your AIO KEY
adafruit.pwd=1234567834567dfghjrtyuvb
//other items can be left alone
Sample ITEM definition, for a NUMBER feed from the Adafruit feed key "templogger1"
Number temperaturelog "temperature [%.1f]" {mqtt="<[adafruit:myusername/feeds/templogger1:state:default]"}
note that compared to the demo in the documentation, there is no leading / on the topic. This caused me a big headache!
Sample SITEMAP
Text item=temperaturelog label="Adafruit temperature feed"
There is an issue with the system remembering old MQTT broker settings. You can clear out all previous MQTT settings via the openhab2 Karaf console:
Adjust your mqtt.conf as needed, then in the console
config:edit org.openhab.mqtt
config:property-list
config:delete
restart openhab2