I developed an app that communicates to HASS via MQTT.js, but I can’t get it to work on the HASS Mosquitto. It connects fine on a local Mosquitto server, but not on the one on HASS. The configuration on HASS is
Here my config in HA:
in configuration.yaml:
mqtt:
broker: !secret mqtt_url
port: !secret mqtt_port
client_id: home-assistant
discovery: true
discovery_prefix: homeassistant
in secrets.yaml:
mqtt_url: 192.168.1.45 (put here your mqtt server IP)
mqtt_port: 1883
What happens if you install a linux on a usb stick and then start that and install Mosquitto on that?
You can hen check that the setup is correct and that you an connect to that.
The hard part with Home Assistant and Mosquitto is that you are not really sure what the configuration actually is.
A connection to a local Mosquitto does not test making the connection over the network and a local Mosquitto is alot less restricted than a Mosquitto open to the network.
The note about not seeing anything in the logs on the remote Mosquitto could mean that there were either a setup issue or a network issue.
Connecting to a Mosquitto on a USB-stick with Linux would rule out the netowrk issue.
I did some tests with MQTTX, a desktop MQTT client. I can connect to both my local Mosquitto server and the HASS one on both 1883 and 1884, with MQTT.js, running on the exact same computer, I can connect to the local server only using websockets, and can’t connect at all to HASS. Seems like a MQTT.js problem to me.