I wanted to test it with the online-broker of test.mosquitto.org first. Before digging into just another integration…
It will be difficult to connect to an external MQTT broker even for testing, as you then have to deal with port forwarding, firewall, and networking issues. You will spend more time trouble shooting and configuring external access for it then you would just installing mosquito somewhere locally.
Mosquitto is fairly light weight and installs quickly. How are you running Home Assistant? if HAOS, ideally use the Mosquitto addon - addons/DOCS.md at 174f8e66d0eaa26f01f528beacbde0bd111b711c · home-assistant/addons · GitHub which is the recommended method.
Other options include running Mosquitto on the “bare metal” of a machine (that’s how mine is on Ubuntu), or Mosquitto in docker -
installed mosquitto now, but still no luck. I think i should use “core-mosquitto” as a hostname, but it can´t connect. I also tried localhost or the ip adresses.
If using the addon, in the MQTT integration it should be “core-mosquitto” as host, 1883 as port, but also be sure to configure your MQTT username and password.
See this documentation for configuration
Or this video is helpful (just jump to around 5 minutes in)
Been there, done that, but for me it already fails at around 6:40
If i click on “Configure”, the MQTT integration immediately asks for the Server, Port and credentials.
And whatever i enter, it will fail.
Unfortunately you did not answer:
If you run HA Supervised on Debian make sure you have the file:
/etc/mosquitto/conf.d/mosquitto.conf
with the content of:
allow_anonymous false
password_file /etc/mosquitto/conf.d/pwfile
port 1883
Also make sure you have run:
sudo mosquitto_passwd -c /etc/mosquitto/conf.d/pwfile whateverusername
Make a note about the username and password you chose.
Now run:
sudo service mosquitto restart
Also make sure you have nothing mqtt-related inside
/usr/share/hassio/homeassistant/configuration.yaml
because configuration of MQTT is done through the HA Integration when first added to HA.
Sorry, i was a little frustrated yesterday.
This is my system so far:
System Health
version | core-2022.4.7 |
---|---|
installation_type | Home Assistant OS |
dev | false |
hassio | true |
docker | true |
user | root |
virtualenv | false |
python_version | 3.9.9 |
os_name | Linux |
os_version | 5.10.103-v7 |
arch | armv7l |
timezone | Europe/Berlin |
Home Assistant Supervisor
host_os | Home Assistant OS 7.6 |
---|---|
update_channel | stable |
supervisor_version | supervisor-2022.05.0 |
docker_version | 20.10.9 |
disk_total | 109.3 GB |
disk_used | 10.3 GB |
healthy | true |
supported | true |
board | rpi3 |
supervisor_api | ok |
version_api | ok |
installed_addons | Custom deps deployment (1.3.1), File editor (5.3.3), Samba share (9.6.1), deCONZ (6.13.0), PSA Car Controller (v2.6.0), Terminal & SSH (9.4.0), Zigbee2mqtt (1.25.1-1), Mosquitto broker (6.1.1) |
This was very helpful! There was a setting, remaining from a former try. After i deleted it, i was able to configure the MQTT integration like shown in the video. Thank you!
core-mosquitto
worked, do you have any idea why is it not mentioned anywhere in the docs?
It definitely should be mentioned in the documentation…
Many thanks for that video-link. My fault was to recognize that MQTT clients like in ESP8266 have to be a user of Home assistant. Just create as a user one and it works fine. Thanks again.
I’ve got hours and hours invested trying to get mosquitto running locally. Seems the HA project owners have seen fit to deprecate a working automatic install to sell more units of hardware. The only instructions I can presently find all reference something that’s not present in the current version of HA.
If you share some info about where it goes wrong, someone might help you to get it running.
Not so much so far.
Your topic was created only 23 hours ago!
So you expect from volunteers (in case you didn’t know: that’s what we all are here) that your issue is solved immediately!?!
I understand that, you being a system admin, want issues that you cannot solve yourself get solved and might get frustrated/disappointed/fill_in_yourself but to assure you: bashing will not get you anywhere.
I’m not bashing anybody. If you look at the thread I’m making progress towards getting it working.
Yes, I’m frustrated. Imagine you’re new to HA and trying to follow the mosquitto instructions on this site but you’re installed on docker. Imagine buying hardware because you read the documentation and saw it was one click to get this working and you’ve now got eight hours and counting in trying to re-invent a wheel?! Yeah, I’m frustrated. Knowing it works on something you can buy, and only works with one click on that something you can buy yet this thing is open-source? 40% of HA installs use MQTT.
This is a huge gap that should be in the native documentation and should not require a forum post at all.
For the sake of the argument:
FYI: HA is not owned by anybody, check: https://www.openhomefoundation.org/
That’s the logo that you see in your HA
Everyone can edit the documentation so if you get it working: go ahead!
I have it working. Thank you for your welcome.
There you go, good that it works!
You’re welcome to add the missing info in the documentation.
The thing about contributing to an open-source project is it’s a work commitment. If I do it, it won’t be one off. More green flags than red meeting the team, but it’s a relationship of sorts.
You will not be a point person for starting that relationship. The person who hits me with that volunteers line and then uses a strong word like bashing isn’t getting a sign-up. It’s an open source project and you came for me like I insulted your mother. I’m not fishing for an apology, I have a fully-formed first impression of you that won’t change.
I checked the solution box on the post that helped. Anybody that searches will find it. I’ve told you where you stand and I’m not coming back to this thread.