I am wondering if there is a chat program that works locally when the internet is out but still be connected to from the internet. I know this will be something that is self hosted.
Bonus points if I can set it up on the raspberry pi that is running Home Assistant.
Not really. You need to use a domain (correct me, if I’m wrong, but I think IP adresses don’t work) to connect to the homeserver.
In theory you could setup a DNS server in your nezwork, which resolves this domain with the local adress and then it might work, but I’m not sure if the homeserver would like that.
Also I want to add, that I use TeamSpeak, which works perfectly globally and locally, but it’s for voice chat.
Aah, yes. You’re right there. You will require a domain for it to work. Although, you could still have it work with a local DNS server for internet outages. You would still be able to chat locally in that case. But yeah, this does not seem like what OP is looking for.
That should work fine, actually. As long as the domain resolves (whether through an upstream DNS resolver or through a DNS entry in your router’s DNS table), Synapse users can exchange messages between each other.
I have read of several people who have set up synapse on ships that don’t see stable internet for weeks at a time.
There are some sync issues with multi server chatrooms if the connection drops out intermittently, but how much of a problem that is depends on how long the internet goes out.
One big challenge is maintaining TLS certificates without internet. Let’s Encrypt will give you certificates valid for three months, but if you’re offline for longer you’ll need to spend money on a certificate.
You don’t need HTTPS to talk to the server (HTTP works fine if you accept the risks), you need it for when your internet comes back if you’re talking to other servers. If you only use Matrix as an internal chat server without any external chat (i.e. for your home network, for a company, etc.) you don’t need to bother with HTTPS unless you want to.