MQTT: Working Mosquitto / CloudMQTT Bridge

@sffjunkie
Confirmed working with below.

1 Like

I wonder where is the certificate coming from. Is this something that can be downloaded from the cloudmqtt website? It’s from your own environment (meaning your own cert)?

I gave this a couple of tries but I can make it work.

The cert is not created or added by you.

I think it’s installed as part of HA…

Just looked at mine and it is dated 2/2/2017

Can you please share your /etc/mosquitto/mosquitto.conf file?

Cant get it to work. Keep getting the following

Connecting bridge cloudmqtt (instance.cloudmqtt.com:port)
1493539560: Connecting bridge cloudmqtt (instance.cloudmqtt.com:port)
1493539560: Bridge mosquitto-cloudmqtt-bridge sending CONNECT
1493539561: Socket error on client cloudmqtt, disconnecting.

ok, confirmed working with SSL port.

This is list of root CA’s. It’s a part of OS. It’s required to verify CouldMQTT cert which presented during connection establishment.

Now something else is wrong with my config.
Since getting this working I’ve pointed my device_tracker config to mqtt. Now the status doesn’t seem to be getting updated.

Instead i get the raw JSON as the state of the devices.

my MQTT settings are as below. Can you please tell me what i’m doing wrong?

mqtt:
broker: 127.0.0.1
port: 1883
client_id: home-assistant-1
username: pi
password: !env_var password_mqtt
discovery: true
protocol: 3.1
keepalive: 60

this is now fixed. All i had to do was change the device tracker to cloudmqtt platform.

Do you mean setting the platform to owntracks because I’m getting errors when using cloudmqtt as platform.

Yes, sorry. That’s what i meant.

platform: owntracks

Cloudmqtt in a broker. It receives a store messages from your owntracks app.

Thanks!
Although my ha location does not seem to update when using the local mosquitto mqtt(I’ve set up the bridge to cloudmqtt) server. I’m not getting any errors but it just doesn’t update.
My in my configuration.yaml I have:

mqtt:
  broker: 127.0.0.1
  port: 1883
  client_id: home-assistant-1
  username: mosquitto user name
  password: mosquitto password
  discovery: true
  keepalive: 60

And also:

device_tracker:
  - platform: owntracks
    max_gps_accuracy: 75

Then I have to following text in the cloudmqtt.conf file under /etc/mosquitto/conf.d:

connection couldmqtt
  address my cloudmqtt serveradress:my cloudmqtt SSL port
  topic # in
  try_private true
  notifications false
  start_type automatic
  remote_clientid ha
  remote_username cloudmqtt username
  remote_password cloudmqtt password
  keepalive_interval 300
  cleansession true
  bridge_protocol_version mqttv311
  local_clientid hass
  bridge_cafile /etc/ssl/certs/ca-certificates.crt
  bridge_insecure false

Does anyone know what I’m doing wrong?

How is your owntracks configured?

I’ve configured it to connect to to the cloudmqtt server with another user than the one I’m using to bridge mosquitto to cloudmqtt.
So when looking in the cloudmqtt console under websocket I can se the location is sent from owntracks but it does not update in ha. I’m thinking maybe somethings wrong with the bridge?

I think it’s working now! I hadn’t added “include_dir /etc/mosquitto/conf.d” in the mosquitto.conf

By default include_dir is commented.

If you mean it shouldn’t be necessary to add the “include_dir /etc/mosquitto/conf.d” than I don’t know what else could have fixed it. I’m pretty sure that all I did was scrolled down in the mosquitto.conf, added that line, saved and rebooted.

No, You done everything right. I’m saying that include dir is not enabled by default. It brought a lot fun for me some time ago.

I am using Owntracks with Cloudmqtt and use a local broker Mosquitto. Give me configuration file error if i use like:

 mqtt:
     broker: 192.168.1.145
     port: 1883
     client_id: home-assistant-1
     keepalive: 60
     username: *****
     password: ********
     protocol: 3.1
      
     broker: m21.cloudmqtt.com
     port: 10324
     client_id: Hass
     keepalive: 60
     username: hass1
     password: hass1

Is’t possible to solve with ColudMQTT Manage Bridges ? or any other methods.