I’m fairly new to HA and i really need some help now. I’m trying to set up mosquitto. I have installed it via hass.io add-ons and it seems to be running fine, however when i try to subscribe to something via SSH, it says: “Error: Address not available”.
First, probably wouldn’t post your DDNS address publicly unless it’s just not something you wanna worry about.
Second, your broker is pointing to your DDNS address and you’ve given out your user/pass combo on the 1883 port. This is usually the open non-TLS port used without certs. If you’re going to use mqtt outside of your home consider using certs please
Third. your mqtt config is pointing to your DDNS address on the 1883 port. If you’re running a local broker on the SAME machine just use 127.0.0.1. HA is probably having issues resolving the address, or maybe it isn’t. Who knows.
Fourth, run a ‘ps -A | grep mosquitto’ to see if the service is actually running. if you run ‘ps -A | grep mosquitto’ and it doesn’t return anything then mosquitto isn’t running and you won’t be able to connect.
But most importantly. Fix the gaping security hole you have now!
You’re right. Thanks for pointing that out. Guess i was just trying a bunch of things, while troubleshooting I have changed it back to the local ip now. Both hass.io and the broker are running on the same Raspberry pi
the “ps -A | grep mosquitto” returns: 1504 root 0:00 grep mosquitto
The reason is because your local device can’t resolve the DDNS address from the lan on itself. Easy explanation would be … pick up your phone and dial your number. You can’t answer it because you’re on it.
also, if you’re hosting your mqtt broker and HA on the same machine use
I have also installed Mosquitto via the add-on option on Hassio. I am probably trying to follow along the Bruh video that the original poster was and I got to the point where I used SSH/Putty to get command line access on the raspberry pi running Hassio. I needed to enter the command
mosquitto_sub -d -u -P -t dev/test
I got the same “Error: Address not available” message. Adding the -h <hassio_ip_address> option worked for me as well. I never would have figured that out, not even sure where you got it from since I don’t see it on the home assistant documentation.
My question is on yaml file entries. Following the home assistant docs I have this:
Should this point to my duckdns address instead? Will my duckdns address be my MQTT host? Ultimately I want to try Zanzito, but that has been a total failure, so I figured I would see if I could get OwnTracks running with MQTT first. That has led me to here.
I got the same “Error: Address not available” message. Adding the -h <hassio_ip_address> option worked for me as well. I never would have figured that out, not even sure where you got it from since I don’t see it on the home assistant documentation.
You probably wouldn’t see this anywhere in the HA documentation because it’s just generic. You’d see it via man mosquitto_sub or mosquitto_sub --help or googling manpage mosquitto_sub
as for your questoin
There’s no need to point to your DuckDNS address unless you’re hosting your MQTT broker externally at that address. Most of the time it’s on the same system as your HA installation so you can either use your HA ip or just the localhost ip 127.0.0.1 or whatever the ip is on your lan. Owntracks is dead simple to set up.
I am using putty on my windows machine to SSH into the raspberry pi running Hassio. I like the idea of using the local host ip address in case the ip address of my raspberry pi changes. Any idea why that wouldn’t work?
Also, you really should be using static IP’s anytime you’re doing home automation/networking/admining. It makes it easier to fix problems, find problems, trace problems.
If none of those work then you’ll need to use the IP of your home assistant instance. I’m not sure why it wouldn’t work, it’s what I use when debugging, but it may have something to do with hass.io. I’m running a debian distro with MQTT, HA, and a few other things so there could be some differences.
If you’re worried about IP changing just set it up statically in your router. In the long run it’s a smarter move.