Trying to install MQQT

I have been trying to install and get node_red working with MQQT for several days.

My set up is hassio installed on a pi4, with node_red installed as an add on and I’m trying to install MQQT as an addon.

My config file looks like

mqtt:
  broker: xx.xx.xx.xx 

where xx.xx.xx.xx is the ip assigned to the pi. I have tried both with and without this entry in the config file.

Node_Red is running but has no calls to MQQT.

When I start MQQT this is the log file looks like this

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[09:35:05] INFO: Setup mosquitto configuration
[09:35:05] WARNING: SSL not enabled - No valid certs found!
[09:35:05] INFO: No local user available
[09:35:06] INFO: Initialize Home Assistant Add-on services
[09:35:06] ERROR: Can't setup Home Assistant service mqtt
[09:35:06] INFO: Initialize Home Assistant discovery
[09:35:06] INFO: Start Mosquitto daemon
1615390506: mosquitto version 1.6.3 starting
1615390506: Config loaded from /etc/mosquitto.conf.
1615390506: Loading plugin: /usr/share/mosquitto/auth-plug.so
1615390506: |-- *** auth-plug: startup
1615390506:  ├── Username/password checking enabled.
1615390506:  ├── TLS-PSK checking enabled.
1615390506:  └── Extended authentication not enabled.
1615390506: Opening ipv4 listen socket on port 1883.
1615390506: Opening ipv6 listen socket on port 1883.
1615390506: Opening websockets listen socket on port 1884.
1615390506: Warning: Mosquitto should not be run as root/administrator.
1615390525: New connection from 172.30.32.1 on port 1883.
[09:35:26] INFO: [INFO] found homeassistant on local database
1615390526: New client connected from 172.30.32.1 as 1WEKFVZwDF7JMcve8v7aTc (p2, c1, k60, u'homeassistant').
1615390559: New connection from 172.30.32.1 on port 1883.
[09:36:00] WARNING: [WARN] Not found homeassistant on local database
1615390560: Socket error on client <unknown>, disconnecting.

I have seen other questions about the 172 address, and understand that is the docker address, but don’t know if having it show up in that log is and issue or not and if so what to do about it. I have carefully followed the instructions in the documentation. I have uninstalled and reinstalled the MQQT broker multiple times. Same with the MQQT integration. I’m not sure what else to try. I am at a standstill, and any help would really be appreciated.

mqtt:
  broker: xx.xx.xx.xx 

This is in config.yaml? I don’t believe it’s used anymore, at least I don’t have it in my config and have mqtt up and running. Did you change anything on the configuration page in the mqtt add-on?

Otherwise try removing everything integration and broker, restart, then reinstall the broker. I believe the homeassistant not found error is from reinstalling the broker without first removing the integrations. Once broker is up, then install the integration.

You also should delete the mqtt broker from node red before the above steps. Make a unique user for node-red if you haven’t already. Add it again after the above. You probably should delete any mqtt nodes deployed on a sketch as well.

1 Like

Thanks for your answer.

I have tried both with and without the configuration. I did not change anything on the configuration page in the mqtt add-on. I have tried all the reinstalls, but maybe not in the correct order, so will try again, ty. I tried the pallet to delete the broker from node_red. I don’t see it there and I didn’t add it in the node red configuration. So I don’t know how to delete the broker from node_red. Sorry, I am a noob to home assistant.

I assume in node red that you tried to set up a flow with one of these
Screenshot 2021-03-10 133902

when you double click on the node you get this dialog

That pencil click it and that will bring you to the pic I posted above, then just delete that and deploy. then do the reinstall steps. Dont forget the unique user, create one for each client connecting to mqtt in the future.

2 Likes

Thank you so much, everything is now working. For other people, I think I created the problem because I installed MQTT right when I brought up hassio for the first time, then when I was ready to use, I forgot about the integration and tried to fix everything in the actual installation.

Thanks again for the help

1 Like

Hi,

I’m having the exact same problem as you…when my Home Assistant Blue arrived I’ve installed almost all recommended add-ons including mosquito.

Now that I’m trying to effectively use MQTT with Tasmota, I’m having the same error “ERROR: Can’t setup Home Assistant service mqtt” as you. Also had the 172…IP address on the integration but was able to solve it.

Now, I think the Broker and Clients are running ok, because I can listen to all of then without problems, what is missing is the service in Home Assistant.

Like you I’ve tried already almost everything…install, unisntall, both broker and integration, with code and without code in the configuration.yaml…I’m running out of ideas…

Can you please detail a bit more what was the solution for you.

thanks,
Joao

Did you add the integration under configuration → integration page. This is separate from the mqtt addon. Check options that auto discovery is enabled if it is installed. Then follow the how to set discovery messages for anything that isn’t added automatically.

Yes I’ve installed the integration. I can listen to the mqtt clients…I see all…if I change the state of a tasmota socket from off to on it reports immediately.

I’ve installed and uninstalled the broker and the integration dozens of times, trying anything I remember! I’ve tried with the default user the mqtt integration creates, I’ve created o specific user in the config panel, with code in the configuration.yaml file, without the code…

The system log reports some error related with sockets «21-04-19 12:44:51 ERROR (MainThread) [supervisor.api.ingress] Ingress error: 400, message=‘Invalid response status’, url=URL(‘http://172.30.33.0:8099/socket.io/?EIO=4&transport=websocket&sid=pkh6DOOd6CN5Te63AAAi’)»

Also I shouldn’t the integration have an local IP, like 192.168.1.xx since it lives on the Home Assistant?

Thanks,

172 is internal as the the movie goes “the call is coming from inside the house”. In all seriousness ip’s starting with 172 is the default internal routing address for all computers pretty much. If you can see the messages in HA you need to set up the sensors that’s all.

If the discovery messages are too confusing then try writing the yaml yourself. You have to add the sensors in one way or the other. Discovery or adding yaml in your config file. This is a simple sensor I have set up for an example.

  - platform: mqtt
    name: Shop Motion
    state_topic: cameras
    value_template: "{{ 'ON' if value_json.code == 'VideoMotion' and value_json.action == 'Start' and value_json.index == '7' else 'OFF'}}"
    device_class: motion