For anyone that’s interested this is what I did after following Bruh’s’s excellent Owntracks / CloudMQTT guide to get my local Mosquitto instance talking to CloudMQTT.
Create a new mosquitto config in the /etc/mosquitto/conf.d/ directory, I used cloudmqtt.conf (it can be any name as long as it ends with .conf so mosquitto will read it) with the following info…
connection cloudmqtt
address <Instance Server>:<Instance Port>
remote_username <Instance User>
remote_password <Instance Password>
clientid <A cloudmqtt user with read access>
try_private false
start_type automatic
topic # in
Where the items between the <> brackets are from the CloudMQTT Console “Instance Info” page.
After restarting mosquitto topics from cloudmqtt should show up. For example the user I setup on cloudmqtt and owntracks nexus6p shows up as topic owntracks/<Instance User>/nexus6p
If you need to write values back out to CloudMQTT you will need to change the last line as described in the mosquitto.conf man page
my CLoudMQTT is using mqtts with an SSL port of 2xxxx.
What do I have to do to get Mosquito talking with encryption to cloudMQTT?
I got it working with using a 1xxxx port number but I would prefer SSL.
HA works fine talking to directly to cloudMQTT with a 2xxxx port without requiring a cert path.
Thank you for sharing, sffjunkie. This is what I am looking for. How do you specify mqtt: section in the configuration.yaml. Would I have to point to Cloudmqtt or Mosquitto? Thanks a lot.
I configured the bridge in your way, but the following error:
17-02-08 10:58:42 ERROR (MainThread) [homeassistant.bootstrap] component mqtt failed to initialize
17-02-08 10:58:42 ERROR (MainThread) [homeassistant.bootstrap] Component mqtt failed to setup
17-02-08 10:58:42 ERROR (MainThread) [homeassistant.bootstrap] Unable to prepare setup for platform switch.mqtt because dependency mqtt could not be initialized
17-02-08 10:58:42 ERROR (Thread-3) [homeassistant.components.mqtt] Can’t connect to the broker. Please check your settings and the broker itself
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/mqtt/init.py”, line 262, in setup
birth_message)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/mqtt/init.py”, line 351, in init
self._mqttc.connect(broker, port, keepalive)
File “/home/homeassistant/.homeassistant/deps/paho/mqtt/client.py”, line 686, in connect
return self.reconnect()
File “/home/homeassistant/.homeassistant/deps/paho/mqtt/client.py”, line 808, in reconnect
sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0))
File “/usr/lib/python3.4/socket.py”, line 509, in create_connection
raise err
File “/usr/lib/python3.4/socket.py”, line 500, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
17-02-08 10:58:42 ERROR (MainThread) [homeassistant.bootstrap] component mqtt failed to initialize
My configuration is as follows: #conf.d/cloud.conf#
connection cloudmqtt
address m13.cloudmqtt.com:14443
remote_username xxx
remote_password xxxxxx
clientid home
try_private false
start_type automatic
topic # in
Ive actually tried this, I think I am doing something wrong because I am not getting any devices showing up which have been setup with cloudmqtt.
I still have my local mqtt devices working. It seems I cant get this to work at all, despite playing around with different conf files.
Getting frustrating now, it would be nice to have a step by step guide from start to finish on setting up a mosquitto bridge. I have searched many sites and tried so many different methods. They all say its simple, and list all kinds of different conf files.
Hi,
tried it the same way and got stuck at some points - perhaps one of them is yours too:
mosquitto.conf
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
# For debugging
#log_type all
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
user mosquitto
allow_anonymous true
password_file /etc/mosquitto/pwfile
listener 1883 localhost
listener 8883 localhost
listener 1883 192.168.178.61
listener 8883 192.168.178.61
#include_dir /etc/mosquitto/conf.d
connection cloudmqtt
address <cloudmqtt-host>:<cloudmqtt-port>
topic # in // fetches all incoming topics from cloudmqtt
clientid HAhost // User with read access configured in cloudmqtt
#cleansession false
start_type automatic
username <user from the "instance info", "**remote_username" is outdated**>
password <pw from the "instance info", "**remote_password" is outdated**>
Sorry for this suggestion, you installed the “owntracks”-component in Home Assistant too?
Regards!
You can create bridge on your local MQTT Server and you do bot need port forwarding for it. Connection initiator will be local MQTT server not CloudMQTT