MQTT mosquitto and external sensor

Hi! I have installed Home Assistant OS on a mini PC, connected it to the wifi and installed the mosquitto broker add-on.
I also have fall sensor that could to send messages to the Home Assistant via MQTT.
If they are in the same LAN, no problem. The fall sensor and Home Assistant connect to each other and can communicate.

But I would that the Home Assistant is into my house and the fall detector is into another one (which as another router and another internet connection) and it could send alarm to me if someone falls.

As I said, they can correctly communicate if they are in the same network and I set username, password, port and IP Address (192.168…) into sensor configuration.
I tried to set the public IP of my network but it’s not working and I think it’s not enough.

How can I set the sensor to send messages to Home Assistant from a network to another one? And have I to set something Home Assistant itself?

Thank you so much!

One option is to expose your local broker to the public Internet, but that would require many security considerations that’s likely best achieved if you have expert networking knowledge.

You can also use a cloud-based MQTT broker, but keep in mind that HA can only have one broker configured, so this will need to be your main and only broker for all MQTT traffic.

Another option is to bridge two brokers (one local and one remote), but see point 1.

It’s also possible to connect two HA instances to one another.

While I run mosquitto myself, I cannot help with the specifics of the HA add-on (“app”).

VPN connection across the two sites? Other options may unnecessarily expose you to security weaknesses and exploits across the Internetz.

Caution: Frequently this causes considerable grief setting this up for neophytes. Best avoid AI, LLMs such as ChatGPT, YouBoob and other third party outdated misinformation and go back to the actual vendor documentation, and follow it very closely.

At the end of the day, all you want is both HomeAssistant (your Mosquitto host) and the MQTT packet generator device (your fall sensor) to be able to communicate with each other. You have already established it works locally, and you challenge is to make it work remotely. A simple networking exercise, elegant (and free) if done well.

1 Like