[Solved] I´m getting crazy, Openhab3 with Mqtt

  • OS: Debian 10.0 with java 11.0
  • openHAB version:Last, downloaded Satarday.

Hello all, I’ve worked with Openhab 1 then migrated to 2 and now Im in the process to upgrade to 3 and there the problems start. My plan is to develop the Openhab enviroments in a file-based basis (like as I used in 1 and 2)but Im having This stupid error when setting MQTT. (I always used MQTT 1.0 in all my projects until now… not a bug fan of Things :frowning: .
Below My example:

addons.cfg
"
package = standard
remote = true
binding =astro,mqtt,exec,telegram
#persistence=jdbc-mysql
transformation =xslt,map,regex,javascript,jsonpath,exec
ui =basic
"

Things:
"Bridge mqtt:broker:MyMQTTBroker “Mosquitto” @ “System” [ host=“192.168.1.51”, secure=false, username=“myuser”, password=“mypass”] {

Thing topic CPE_Pe “test lamp” [ availabilityTopic=“testopic/LWT”, payloadAvailable=“Online”, payloadNotAvailable=“Offline”] {
Channels:
Type switch : CPE_Pe_SW “test lamp” [ commandTopic=“testopic” , on=“ON”, off=“OFF”]
}
}"

Items:
“Switch Sala_CPE “Test Light” { ga=“Light”, channel=“mqtt:topic:myMQTTBroker:CPE_Pe:CPE_Pe_SW” }”

sitemap:
"sitemap test {
Frame {
Switch item=Sala_CPE label=“Test Switch”
}
}
"

What in the hell am I doing wrong? the Broker connects fine, I have no errors but no messages are published to mqtt, also when I press the switch to ON it returns to the OFF imediatly and in the events.log I have the warning:
"
2021-05-31 15:36:09.423 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘Sala_CPE’ received command ON
2021-05-31 15:36:09.429 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item ‘Sala_CPE’ predicted to become NULL
"
Some help please :slight_smile:

You have s typo

Thing : MyMQTTBroker
Item : myMQTTBroker

Watch your capitals!

:tired_face: :tired_face: :triumph: :triumph: :triumph:
Thanks guys, I cannot believe that I lost around 5 hours with this… I’m going to go cry to a corner now…

Thanks and congratulations to all the Openhab community for the good and fast response to our problems.

1 Like