#I'm trying to follow this but I don't

1 messages · Page 1 of 1 (latest)

keen shadow
#

I'm using the mosquitto MQTT Add-on. I'm trying to bridge it to an external MQTT service

outer sail
#

As the screenshot of the forum topic shows, the mosquitto.conf file has to be in the /share/mosquitto directory

#

And you have to configure Mosquitto to use customizations in the mosquitto directory

keen shadow
#

I do but there is not indication in the logs that it uses it.
I want it to sub but not pub to the remote

Maybe there is something obvious here:

➜  mosquitto pwd     
/share/mosquitto
➜  mosquitto cat mosquitto.conf 
connection hivemq
address XXXXXXXXXXXXXXX.s1.eu.hivemq.cloud:8883
bridge_attempt_unsubscribe true
cleansession true
remote_username XXXXXXXXX
remote_password XXXXXXXXX
remote_clientid main_hass
try_private true
allow_anonymous false

topic # in 0 "" ""
outer sail
#

Did you activate customization in Mosquitto?

keen shadow
#

🤦 you mean this should be set to true?
active: false

outer sail
#

Correct

keen shadow
#

Thank you! I'm silly like that.

#

I'm not seeing the pubs from hiveHQ
is this part right in the config?
topic # in 0 "" ""

outer sail
#

You want hiveHQ to Mosquitto?

keen shadow
#

yes

#

I see this repeating in the logs every 20 sec.

2024-05-07 09:30:22: Connecting bridge hivemq (XXXXXXXXXXXXXXX.s1.eu.hivemq.cloud:8883)
2024-05-07 09:30:22: Client local.hivemq closed its connection.
outer sail
#

Does topic # in 0 work?

keen shadow
#

I thought that was a catch-all

outer sail
#

It is

keen shadow
#

that would be both directions? I can test that.

outer sail
#

No. That should subscribe to all topics from the remote broker

keen shadow
#

err.. yeah..

outer sail
#

in = subscribe
out = publish
both = subscribe and publish

#

The "" stuff is used for remapping topics

keen shadow
#

I think I need to setup the acl stuffs.. I'll try that.

#

in the /share/mosquitto/accesscontrollist do I put the remote username?

outer sail
#

I don't think that would help, as HA's Mosquitto connects to the remote broker. The ACL from the remote broker would apply afaik.

keen shadow
#

lol... yeah that killed access for the local user..

outer sail
#

Likely not present in the ACL shksKEKW

keen shadow
#

how do I turn on debug level logging in the add-on?

outer sail
#

Use the "hide unused config" switch in the add-on's settings and you can enable debug (after saving and an add-on restart)

keen shadow
#

Where's the log file? If I download it from the gui I only get the tail

outer sail
#

You can access it via a terminal with ha addons logs core_mosquitto

#

Otherwise I guess you would have to access the Docker container

keen shadow
#

I think it's not connecting to hivemq correctly. I'm still fuzzy on how encryption works with this thing. do I need to make a client cert and key?

#

I think it may be on hivemq side at this point.. Thanks for your help! I'll update this if I fail or succeed.

keen shadow
#

okay.. to connect using MQTT explorer I need to set the ca cert and enable tls. How do I get the bridge to do that? I copied the ca cert to /ssl

according to this: http://www.steves-internet-guide.com/mosquitto-bridge-encryption/
I shouldn't need to do anything special.. but it disconnects as soon as it connects.

also adding log_type all to /share/mosquitto/mosquitto.conf show more message but still nothing about why it dissconnected

keen shadow
#

got it working!!!1
I think I needed to stop and then start the service not sure..
I also did chmod 600 /ssl/isrgrootx1.pem
here is my /share/mosquitto/mosquitto.conf for anyone who finds this.

connection hivemq
address XXXXXXXXXXXXX.hivemq.cloud:8883
bridge_attempt_unsubscribe true
cleansession true
remote_username XXXXXXXX
remote_password XXXXXXXXXXXXXXXXX
remote_clientid hivemq_client
bridge_cafile /ssl/isrgrootx1.pem

try_private false
allow_anonymous false

topic # in 0