MQTT Issues with Vacuum and Room Assistant

I am having continuing issues trying to get MQTT to work with both my vacuum and room assistant. Hoping someone can shed some light on what I am doing wrong. I am fairly new to HA and despite the nice gui, everything seems to require manual configuration.

I have installed Mosquitto as an add on. Set up the user for mqtt to use. I can go to dev tools and publish a packet while listening and I see the message. I can also use MQTT Explorer to connect and publish. So I am fairly certain that MQTT is working and packets are getting to HA my RPi.

Task #1 was to get my Roborock S5 connected up. It is running Valetudo. Works fine via the web page but HA integration would be cool. I have enabled MQTT on the vac. The config.json has:

 "mqtt": {
    "enabled": true,
    "identifier": "rockrobo",
    "topicPrefix": "valetudo",
    "autoconfPrefix": "homeassistant",
    "broker_url": "mqtt://USER:[email protected]:1883",
    "provideMapData": true,
    "caPath": "",
    "qos": 0
  },

In my config.yaml for HA I have this based on a post I found here. I changed the topics from vacuum/XXXX to valetudo/XXX because that was the topic prefix in the vacuum config. Am I reading this incorrectly?? Still fuzzy on the mqtt functions. Under entities I have roborock with ID of vacuum.roborock and Vacuum as Integration. Clicking in there I have vacuum commands, however running any of those will produce a message in mqtt but the vac does nothing. Tailing the log on the vac, I see nothing.

vacuum:
  - platform: mqtt
    name: "roborock"
    supported_features:
      - turn_on
      - turn_off
      - pause
      - stop
      - return_home
      - battery
      - status
      - locate
      - clean_spot
      - fan_speed
      - send_command
    command_topic: "valetudo/command"
    battery_level_topic: "valetudo/state"
    battery_level_template: "{{ value_json.battery_level }}"
    charging_topic: "valetudo/state"
    charging_template: "{{ value_json.charging }}"
    cleaning_topic: "valetudo/state"
    cleaning_template: "{{ value_json.cleaning }}"
    docked_topic: "valetudo/state"
    docked_template: "{{ value_json.docked }}"

Example Command:
Message 0 received on valetudo/command at 9:43 AM:
turn_on

Task #2 was to set up room assistant which I did using this guide. Aside from the locale issues on install all seems to be ok. However when I start room assistant I don’t see any MQTT connection being made. I do see an error connecting to local host or the correct port. Log and config below. The intent was to watch for my phone on BT. Per instructions I am supposed to get a new integration? I have nothing there.

7/3/2020, 9:31:36 AM - info - IntegrationsModule: Loading integrations: home-assistant, bluetooth-classic
7/3/2020, 9:31:39 AM - info - NestFactory: Starting Nest application...
7/3/2020, 9:31:41 AM - info - InstanceLoader: AppModule dependencies initialized
7/3/2020, 9:31:41 AM - info - InstanceLoader: ConfigModule dependencies initialized
7/3/2020, 9:31:41 AM - info - InstanceLoader: NestEmitterModule dependencies initialized
7/3/2020, 9:31:41 AM - info - InstanceLoader: IntegrationsModule dependencies initialized
7/3/2020, 9:31:41 AM - info - InstanceLoader: HttpModule dependencies initialized
7/3/2020, 9:31:41 AM - info - InstanceLoader: DiscoveryModule dependencies initialized
7/3/2020, 9:31:41 AM - info - InstanceLoader: HomeAssistantModule dependencies initialized
7/3/2020, 9:31:41 AM - info - InstanceLoader: ClusterModule dependencies initialized
7/3/2020, 9:31:41 AM - info - InstanceLoader: TerminusModule dependencies initialized
7/3/2020, 9:31:41 AM - info - InstanceLoader: ScheduleModule dependencies initialized
7/3/2020, 9:31:41 AM - info - InstanceLoader: EntitiesModule dependencies initialized
7/3/2020, 9:31:41 AM - info - InstanceLoader: BluetoothClassicModule dependencies initialized
7/3/2020, 9:31:41 AM - info - InstanceLoader: StatusModule dependencies initialized
7/3/2020, 9:31:44 AM - info - RoutesResolver: EntitiesController {/entities}:
7/3/2020, 9:31:44 AM - info - RouterExplorer: Mapped {/entities, GET} route
7/3/2020, 9:31:44 AM - info - RoutesResolver: StatusController {/status}:
7/3/2020, 9:31:44 AM - info - RouterExplorer: Mapped {/status, GET} route
7/3/2020, 9:31:45 AM - error - HomeAssistantService: Error: connect ECONNREFUSED 127.0.0.1:1883
7/3/2020, 9:31:46 AM - info - ConfigService: Loading configuration from /opt/nodejs/lib/node_modules/room-assistant/dist/config/definitions/default.js, config/local.yml
7/3/2020, 9:31:46 AM - info - ClusterService: Starting mDNS advertisements and discovery

Room Assistant Config.

global:
  integrations:
    - homeAssistant
    - bluetoothClassic
  homeAssistant:
    mqttUrl: 'mqtt://XX.XX.XX.XX:1883'
    mqttOptions:
      username: USER
      password: PW
  bluetoothClassic:
    addresses:
      - XX:XX:XX:XX:X:XX

So what am I doing incorrectly in my config?? Sorry for the long post, been a few days of troubleshooting. Thanks for the help.

Can’t help with the vacuum, but maybe with room-assistant.
First, which version of HA are you running and how did you install HA (from your post I assume it’s a supervised install but I just wanna make sure)?

Did you install room-assistant on the same machine as home-assistant? What IP did you put in the configuration? Just for your info, you don’t need to hide internal IP adresses like 192.168.0.5 from your posts, we can’t use them to access your system.

I installed the Hassio OS on SD card running on RP4. Version is 0.111.4. Not sure if this is called OS or just Core. Whatever they want to call the OS.

Room assistant is installed on an RPi Zero W, (.4). The IP in the config.json is the IP of my RPi running HA, (.42). They are on the same network, connectivity between is confirmed. My laptop (.214) can connect to MQTT on the HA Pi using MQTT Explorer. So I can confirm the ip/port configuration seems to be working. On the HA Config, I did not add any IPs of the vac (.3) or the Room Assistant Pi, (,4), both are configured with IP of the HA Pi (.42).

It’s strange that the error shows connection refused to IP 127.0.0.1, it should be the IP of the that runs the MQTT broker.

The indentation in your room-assistant is slightly wrong, try this one (substituting in your real values again of course):

global:
  integrations:
    - homeAssistant
    - bluetoothClassic
homeAssistant:
  mqttUrl: 'mqtt://XX.XX.XX.XX:1883'
  mqttOptions:
    username: USER
    password: PW
bluetoothClassic:
  addresses:
    - XX:XX:XX:XX:X:XX

room-assistant is failing to connect to MQTT since it’s trying to connect to localhost, not your Pi 4 running Home Assistant. It does that because it can’t find the other IP you configured and localhost is the default.

Ah see I knew I was doing something wrong. Thanks. Changing the Room Assistant config got it up and running. I can see it in HA now. So what did I screw up on the vacuum??

I have a same issue besides the vacuum part, however the indentation is correct.

I would check your MQTT using the MQTT explorer app. I am not too familiar with all this yet but that helped to confirm that MQTT was indeed working on my HA. I could publish generic and see it come up in the logs on Developer > MQTT. Listening to # which is ALL messages. Once I knew that was working it had to be on the Room Assistant side. Indent found and all is working there. Of course that did not help out my vacuum issue. Still sorting that out.

Hi thanks, not sure what to check with MQTT explorer, but the cluster seems to show in HA, and not the bluetooth entities itself, It’s weird because I can connect the MQTT with no issues.

I mainly confirmed that I could publish from my laptop to HA and see it in the MQTT logs. That confirmed that my user/pass was working and eliminated any routing/port issues. I only have one Room Assistant node. So once I fixed my indent issue I was able to see a single entry in Devices as well as 4 entries under Entities with either the phone or hostname of the Room Assistant Node. Keep in mind I only have one RA node. They are: sensor.PHONE_NAME_room_presence, sensor.RA_HOSTNAME_cluster_size,sensor.RA_HOSTNAME_cluster_leader, and switch.RA_HOSTNAME_bluetooth_inquiries
Not sure if that helps but that is what I have. Beyond getting MQTT to connect, I did not do anything else other than make sure the BT mac was on the RA node.

1 Like