No communication between OpenHAB2 and mosquitto MQTT

  • Platform information:
    • Hardware: Raspberry Pi 2 Model B Rev 1.1
    • OS: Raspbian GNU/Linux 8 (jessie)
    • Java Runtime Environment: 1.8.0_152
    • openHAB version: openHABian 2
  • Issue of the topic:

Hi there

I’m relatively new to openHAB, but I have some linux and coding experiences from some other projects. But not too much.

I had installed openHAB2 and mosquitto some months ago and played around with an WeMos D1 mini and my Android smartphone using MQTT Dash.
The binding between MQTT and OpenHAB worked fine. But one day my SDCard broke.
Now I reinstalled everything and configured openHAB2, mosquitto and also Node-RED.
Mosquitto and Node-RED works with the WeMos device, MQTT Dash and MQTT.fx.
But I for some reasons the binding between openHAB and mosquitto doesn’t exist, because when I toggle the switch in openHAB there is no reaction of mosquitto.
I tried and read a lot the last days, but I cannot find my mistake.
Do I need to edit the mqtt-eventbus.cfg? Or something else?

Hope someone of you can help…

Thanks
Holger

  • Please post configurations (if applicable):
    • Items configuration related to the issue
      home.item
      Switch D01R01In {mqtt=">[mosquitto:D01R01In:command:ON:1],>[mosquitto:D01R01In:command:OFF:0]"}
      String D01R01Out “Status [%s]” {mqtt="<[mosquitto:D01R01Out:state:default]"}

    • Sitemap configuration related to the issue
      home.sitemap
      sitemap Home label=“SmartHome”
      {
      Switch item=D01R01In label="Licht"
      Text item=D01R01Out

}

At the mqtt.cfg I just edited the following line
mosquitto.url=tcp://localhost:1883

  • If logs where generated please post these here using code fences:
    Errors of openhab.log
    2017-11-22 23:56:59.454 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘D01R01In’ for widget org.eclipse.smarthome.model.sitemap.Switch
    2017-11-22 23:56:59.457 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch
    2017-11-22 23:56:59.459 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch
    2017-11-22 23:56:59.462 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch
    2017-11-22 23:56:59.465 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘D01R01In’ for widget org.eclipse.smarthome.model.sitemap.Switch
    2017-11-22 23:56:59.469 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘D01R01In’ for widget org.eclipse.smarthome.model.sitemap.Switch
    2017-11-22 23:56:59.473 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘D01R01In’ for widget org.eclipse.smarthome.model.sitemap.Switch
    2017-11-22 23:56:59.476 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Text
    2017-11-22 23:56:59.481 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Text
    2017-11-22 23:56:59.484 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Text
    2017-11-22 23:56:59.486 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘D01R01Out’ for widget org.eclipse.smarthome.model.sitemap.Text
    2017-11-22 23:56:59.489 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘D01R01Out’ for widget org.eclipse.smarthome.model.sitemap.Text
    2017-11-22 23:56:59.491 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘D01R01Out’ for widget org.eclipse.smarthome.model.sitemap.Text
    2017-11-22 23:57:00.157 [INFO ] [thome.io.rest.core.item.ItemResource] - Received HTTP POST request at ‘items/D01R01In’ for the unknown item ‘D01R01In’.
    2017-11-22 23:57:00.823 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘D01R01In’ for widget org.eclipse.smarthome.model.sitemap.Switch
    2017-11-22 23:57:00.827 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘D01R01In’ for widget org.eclipse.smarthome.model.sitemap.Switch
    2017-11-22 23:57:00.830 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch
    2017-11-22 23:57:00.835 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘D01R01Out’ for widget org.eclipse.smarthome.model.sitemap.Text
    2017-11-22 23:57:00.838 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item ‘D01R01Out’ for widget org.eclipse.smarthome.model.sitemap.Text
    2017-11-22 23:57:00.843 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Text
    2017-11-22 23:57:01.524 [INFO ] [thome.io.rest.core.item.ItemResource] - Received HTTP POST request at ‘items/D01R01In’ for the unknown item ‘D01R01In’.
    2017-11-22 23:57:02.275 [INFO ] [thome.io.rest.core.item.ItemResource] - Received HTTP POST request at ‘items/D01R01In’ for the unknown item ‘D01R01In’.
    2017-11-22 23:57:03.030 [INFO ] [thome.io.rest.core.item.ItemResource] - Received HTTP POST request at ‘items/D01R01In’ for the unknown item ‘D01R01In’.

could be a typo: it should be home.items

Well, this could be the reason. I will check that later and geht back to you.

Thanks

Aaaaargh. I was so blind. This was the solution of the problem. Very simple…
Additional question: Why doesn’t exist the items and sitemap file, so the user has to create them and a typo could happen? Is there a reason for it?
Many thanks for your help.

Best regards
Holger

cause you can create multiple *.items and *.sitemap files
the openHAB2 distribution does not include templates of these files by default and the user should create them from scratch. This is needed for the sitemaps and for the items that are bound to 1.x version bindings (like MQTT). For 2.x bindings, you can use PaperUI to create items (but not sitemaps) and link them to the desired channel of a thing (2.x concept).

There is a demo package that includes these files and you can use it to see how stuff are defined.