Cannot add MQTT thing

Hello,

I’m running openHAB v5.1.1 on my Raspberry Pi 4 using Docker. I’m trying to connect my vacuum robot (which runs on [Valetudo](https://valetudo.cloud/)) to openHAB via MQTT. For MQTT, I use Mosquitto. I can successfully connect my vacuum robot to Mosquitto, because when checking Mosquitto’s logs, I see a client connecting and disconnecting when starting and shutting down the robot. From within openHAB, I can also successfully create an MQTT bridge for Mosquitto - again, when checking Mosquitto’s logs, I see corresponding log statements when starting and pausing the MQTT bridge in openHAB.

However, when trying to create a thing for my vacuum robot using the MQTT bridge’s thing, no device can be found. I can also click on Scan all several times, but nothing happens. From outside the container using an MQTT client, I can successfully reach both Mosquitto and the vacuum robot via MQTT, even from another network device. Therefore, I assume something must be wrong in openHAB.

It’s worth mentioning that I migrated recently from openHAB v5.0.0 to v5.1.1 - before, everything was working properly, even the MQTT connection from openHAB to the vacuum robot. But after the migration, it does no longer work. I also tried to remove the vacuum robot thing within openHAB via Remove, but this never succeeds (it doesn’t fail either, the thing just never disappears and stays in Removing). I also deleted the MQTT bridge thing, but no luck.

Here’s my docker-compose.yml:

services:
  openhab:
    image: openhab/openhab:5.1.1
    container_name: openhab
    volumes:
      - ./data/deCONZ:/opt/deCONZ
      - ./data/openhab/addons:/openhab/addons
      - ./data/openhab/userdata:/openhab/userdata
      - ./data/openhab/conf:/openhab/conf
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    devices:
      - /dev/ttyACM0
    environment:
      - CRYPTO_POLICY=unlimited
      - GROUP_ID=884
      - USER_ID=889
    networks:
      - nginx_no_internet

  mosquitto:
    image: eclipse-mosquitto:2.0
    container_name: mosquitto
    ports:
      - "10883:1883"
    volumes:
      - ./settings/mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
    tmpfs:
      - /mosquitto/data
      - /mosquitto/log
    networks:
      - nginx_no_internet
      - mosquitto
    healthcheck:
      test: ["CMD", "mosquitto_sub", "-t", "$$SYS/#", "-C", "1", "-i", "healthcheck", "-W", "3"]
      interval: 60s
      timeout: 5s
      retries: 3

networks:
  nginx_no_internet:
    external: true
  mosquitto:
    driver: bridge

Any help would be appreciated. Thx! :folded_hands:t2:

I don’t have the exact same setup and not an expert, so don’t know if this will help. I have network_mode: host in my compose files (also have separate compose for OH, Mqtt, etc).

The other thing that is not clear from your post (to me anyway). There is a MQTT thing connected to the broker, but you also have to manually create a generic MQTT thing (unless your device uses a discovery protocol like HA). The channels then have to created. I use MQTT explorer to copy/paste. Example

version: 1
things:
  mqtt:topic:f06f8352c2:Doors: // generic thing
    bridge: mqtt:broker:253a91e196  // Broker thing
    label: Doors
    location: Doors
    channels:
      Basement_Door_Status_n:
        type: contact
        label: Basement Door Status
        config:
          stateTopic: zwave2/Basement_Door_Status/notification/endpoint_0/Access_Control/Door_state_simple
          transformationPattern:
            - JSONPATH:$.value∩MAP:door.map
      Office_Bath_Door_n:
        type: contact
        label: Office Bath Door Status
        config:
          stateTopic: zwave1/Door_-_72/notification/endpoint_0/Access_Control/Door_state_simple
          transformationPattern:
            - JSONPATH:$.value∩MAP:door.map

For the first channel from MQTT explorer

1 Like

Hero, that was the missing piece! :star_struck: When doing the integration for the very first time using v5.0.0openHAB automatically found all the Valetudo topics for my vacuum robot, probably due to the discovery protocol you were referring to. Although I changed nothing on the Valetudo side, this no longer works.

After running the MQTT Explorer locally via `docker run --rm -p 3000:3000 -e MQTT_EXPLORER_USERNAME=admin -e MQTT_EXPLORER_PASSWORD=your_secure_password Package mqtt-explorer · GitHub` and connecting to my MQTT broker, I could successfully see all the Valetudo topics and create the associated Generic MQTT Thing and related channels in openHAB.

Thank you for your help and have a nice weekend!

Glad it worked. I prefer generic things even if other options are available. However, based on your second message, I’ll add that the Mqtt home assistant was moved to a separate binding in 5.1. You could add that and see what happens.