Cannot start MQTT Addonb

Hi,

I’m just trying to follow the initial installation instructions for the mQTT addon. I have installed the addon, and started it.The second part of the instructions for configuration are -

  1. Navigate in your Home Assistant frontend to Configuration -> Integrations .
  2. Use the Add button and search for MQTT
  3. Configure the Broker, Port, Username, Password and Submit.

When I go to Configuration** -> **Integrations there is already MQTT: Mosquito Broker under “Configured”, so I cannot use the Add button, it says you can only have one. So, I select the existing one and under the blue header it says “This integration has no devices”, there seems to be no way that I can see to configure it.In the system options button it just pops up another window that doesn’t allow me to do anything.

Next I tried configuring the /configuration.yaml and adding the MQTT configs in there

mqtt:
broker: 192.168.88.66
username: myusername
password: mypassword
discovery: true
discovery_prefix: homeassistant
birth_message:
  topic: 'hass/status'
  payload: 'online'
will_message:
  topic: 'hass/status'
  payload: 'offline'

I did a reboot, and looked at the log file and I have this output -

2020-01-11 15:15:24 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=1 from 2020-01-04 08:25:49.190720)
2020-01-11 15:15:31 ERROR (MainThread) [homeassistant.config] Invalid config for [discovery]: expected a dictionary for dictionary value @ data[‘discovery’]. Got True. (See ?, line ?). Please check the docs at https://home-assistant.io/integrations/discovery/
2020-01-11 15:15:31 ERROR (MainThread) [homeassistant.setup] Setup failed for discovery: Invalid config.
2020-01-11 15:15:31 ERROR (MainThread) [homeassistant.setup] Setup failed for broker: Integration not found.
2020-01-11 15:15:31 ERROR (MainThread) [homeassistant.setup] Setup failed for will_message: Integration not found.
2020-01-11 15:15:31 ERROR (MainThread) [homeassistant.setup] Setup failed for password: Integration not found.
2020-01-11 15:15:31 ERROR (MainThread) [homeassistant.setup] Setup failed for birth_message: Integration not found.
2020-01-11 15:15:31 ERROR (MainThread) [homeassistant.setup] Setup failed for username: Integration not found.
2020-01-11 15:15:31 ERROR (MainThread) [homeassistant.setup] Setup failed for discovery_prefix: Integration not found.
2020-01-11 15:15:34 ERROR (MainThread) [hbmqtt.broker] Broker startup failed: [Errno 98] error while attempting to bind on address (‘0.0.0.0’, 1883): address in use
2020-01-11 15:15:34 ERROR (MainThread) [homeassistant.components.mqtt.server] Error initializing MQTT server

A couple of questions -

  1. do you configure the MQTT addon within the hassio web browser, or via the configuration.yaml?
  2. I have 2 config files, one in /root/config and one in /config. I’m using the hassio installer on a pi3, which is the correct config file to use?
  3. there is no mosquitto service running, should I see a separate service listed from ps?

Thanks for any suggestions

3 things

  1. You use the integrations to configure or you use the configuration.yaml.
  2. Indents are important in yaml
    Everything below
    mqtt:
    Needs to be indented. So it knows that everything under is is for the mqtt. Right now is see the discovery as not being for that and thats why is telling you about discovery as a separate configuration option.
  3. pay attention to things that are optional and what’s required in the docs.
    When you setting things up start with what’s required first then once it’s up if you need to overwrite defaults you add the options.

Hi Thanks for the reply. I’ve edited the config and done the correct indentation, restarted hassio and now the log gives me a different message -

WARNING (MainThread) [homeassistant.components.mqtt] Data in your config entry is going to override your configuration.yaml: {'broker': 'core-mosquitto.local.hass.io', 'discovery': True, 'password': 'ain1go1Ohxu5xeoya1fooquee3utohb8phiL5vaiX8BoaJ7Saech7uaphishugh0', 'port': 1883, 'protocol': '3.1.1', 'username': 'homeassistant'}

I’m trying to follow what is in the docs as you say, but there are several docs out there for the installation of MQTT. I tried to stick to the main doc which is on the addon page and thats where I ran into trouble trying to configure it using the web browser - When I go to Configuration** -> **Integrations there is already MQTT: Mosquito Broker under “Configured”, so I cannot use the Add button, it says you can only have one. So, I select the existing one and under the blue header it says “This integration has no devices”, there seems to be no way that I can see to configure it.In the system options button it just pops up another window that doesn’t allow me to do anything.

So when I got stuck with the editing from the web interface I looked elsewhere.

thanks

This is a screenshot of what I see in the configuration

Okay maybe i wasnt as clear before.
Comment out what you have in the configuration #configuration.
Remove the integration
Reboot
Install , configure and start the add-on, check add-on log all ok.
Add integration
Okay

thanks.

when you say “Comment out what you have in the configuration #configuration.” do you mean comment out my configuration.yaml?

you aren’t on discord by any chance are you?

No just instead of deleting it
mqtt:
Gghhjjk
Fhhjjj
Comment it out
#mqtt:
#Gghhjjk
#Fhhjjj

Easier to put back if you want later than typing it all again. :ok_hand:

ok, yes, I understand what you meant by commenting, its just that you described it as #configuration and I wasn’t sure what that was

i’ve uninstalled, commented, and just restarting now…

docs refer to what was before intergrations so if it in the intergrations list then you dont need to add it to your configuration.yaml. What’s showing in the intergrations is referring to your entry in the configuration.yaml.

Ok, I should have checked the dates on the various posts and github etc to see what came first. The part I seem to be having trouble with is actually doing the configuration in the web browser, I can’t see where to do it, thats why I went directly to the config file.

After I’ve restarted, I’ll install the addon again and show you a screenshot, hopefully you can’t point out what I’m missing.

still restarting… seems to take awhile.

I’ve got an error restarting, just checking the logs. must have done a bad edit, although the file looks fine. I just copied the one from /root/config and starting again.

Always check config :thinking:
Before you do a restart

dont worry, its restarted correctly this time.

back to installing mqtt addon… wont take long

I can’t do any more posts, the forum says I’ve used my maximum for the day as a new user, so hopefully you can see this edited post.

The problem is, those screenshots you posted, I can’t get those.

I never see the DISCOVERED part that you do

I don’t have any mqtt devices currently on the network. I was trying to setup the broker first, then just test with mosquitto_pub and mosquitto_sub
If I delete the settings I put in the config then it will just go back to the previous errors.

give me a minute, I’ll put some step by step screenshots so you can I what I see, and how its different to yours.

I also tried removing the integration as you suggested. After doing this, and restarting, MQTT was now listed in discovery and it allowed me to configure it. So I did, but it creates some sort of automatic config and does not allow me to enter the broker and username, like it does in your screenshots

edit - so some progress. rather than clicking on the discovered MQTT I used the ADD button, and now it shows me the configuration options

Did you say you didn’t start the add-on?

I had it configured via configurations.yaml
i commented out that
image
i removed the intergration
i still have the addon setup and running
rebooted
i go to integrations page and its there waiting to be configured
image
image
username and password must be a from a user thats in homeassistant
so only option you get to choose is if you want Discovery

if i don’t do that and instead click the + sign and add it manually
image
i then have to specify the ip and port of the broker, the usename and password and if i still want discovery.

i’m going to do the first one

look remove the configuration.yaml entry
don’t go there unless you need to add a non discovering device like a MQTT FAN or some thing
reboot
start the MQTT broker addon
make sure its working
all you need to do is as i did before

now i don’t have a lot of MQTT devices as i moved them all over to esphome so the only ones i do have are Sonoff RFbridges
and one has already appeared
image


i would have to go to the other ones and set the discovery option on
SetOption19 1
i did that
and up she popped