Trouble configuring MQTT with owntracks

I’m trying to use owntracks on my android to track my presence and make rules when I get home. I am using the default mqtt broker but I am having trouble getting Owntracks to connect

My mqtt settings in configuration.yaml:

#MQTT 
    mqtt:

My Owntracks settings are:

Mode: Private MQTT
Host: example.duckdns.org
port: 8883
Username: MY_USERNAME
Password: MY_PASSWORD
“mqttProtocolLevel”: 4

I have port 8883 forwarded in my router to my HASSIO IP.

If my phone is on the same network as my HASSIO and I change the host to 192.168.1.111 and port to 1883 it will work and connect. But I need it to connect while on my mobile network.

Can anyone point me in the right direction? Do I need to change the security settings in owntracks?

This is the error I’m getting

Thanks!

In your owntracks setting you have port 8883 instead of 1883, why?

the port in owntracks and broker need to be the same.

I wanted to use a secure port, from what I read I should use 8883 for a secure port. I have tried it with 1883 and, when on the local network it connects, but on the mobile network the endpoint state on the status screen just stays at “connecting”

The port number isn’t the secure part it’s whether its using tls/ssl.

Follow the instructions for dual ports.
8883 nonsecure local
1883 secure open port

open 1883 on the router, check it’s open.

to be honest though you should just use http it works just as well unless you want the mqtt only features of forcing updates through mqtt. https://www.home-assistant.io/components/device_tracker.owntracks_http/