How to Set Up Home Assistant on an M1 Mac Mini
3 Minute Read
By: Kenny Blake
Published: November 12th, 2024 at 3:45 AM EST
Introduction
Home Assistant is a powerful, open-source platform for controlling and automating devices in your smart home. It provides a central hub to manage everything from lights and thermostats to security systems and entertainment setups. One of its biggest advantages is that it runs locally, ensuring your data stays private and within your network, without reliance on cloud services.
To run Home Assistant effectively, we’ll use Podman, a container management tool similar to Docker. Containers allow you to run applications in isolated environments, making them easy to deploy and maintain without complex installations or dependencies. Podman is particularly well-suited for Linux setups because it doesn’t need a background daemon and can be run without root permissions, enhancing security and simplicity.
Asahi Linux is a unique Linux distribution developed specifically to bring the Linux experience to Apple Silicon Macs, like the M1 Mac Mini. Since Apple’s M1 hardware was designed to run macOS, getting Linux on it requires specific adaptations. Asahi Linux enables a full Linux experience on Apple Silicon, and it’s compatible with popular distributions, including Fedora Linux. This guide will use the Fedora Linux Asahi Remix, chosen for its seamless integration with the M1 and Fedora’s renowned stability and support.
By the end of this tutorial, you'll have a robust setup where you can run Home Assistant on an M1 Mac Mini, with the flexibility and power of a Linux-based containerized environment.
Installation Process
Here’s a rundown of the Asahi Linux installation process, along with some extra steps to set up Home Assistant with Podman.
- SSD Space Preparation: I freed up space on my SSD, deleted caches, and removed unneeded files. Afterward, I ran the installation script as per the Asahi Linux guide.
- Configuring SSH Access: I set up SSH for remote access, which took some trial and error. Here’s what finally worked:
- Manually copied my SSH key using a USB drive.
- Actually, I'd recommend using
ssh-copy-id
. But because I kept getting this error for like, 2 days:I did this manually. It ended up being the next step that fixed it, but oh well. The key was there regardless.Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
- Ran
setenforce 0
to temporarily disable SELinux. - SSH’d into the machine using said key, then restored SELinux with
setenforce 1
.
Afterward, I could SSH into my Asahi Linux instance without issues.
Setting Up Home Assistant with Podman
With Asahi Linux up and running, the next step was to set up Home Assistant using Podman, a container engine compatible with Docker commands. Fedora Linux, which is the distro I used, comes with podman. So installing podman was literally a no-brainer.
- Installing Home Assistant: Following Red Hat’s installation guide, I pulled the official Home Assistant image:
podman pull docker.io/homeassistant/home-assistant:stable
- Setting up the Config Directory: Using that same guide, Just run this command to create your config directory:
mkdir ~/hass_config
- Customizing the Run Command: Instead of using the script provided on that RedHat article, I configured my Podman container to allow login from other devices on my network:
podman run -d --name homeassistant -p 8123:8123 homeassistant/home-assistant:latest
Networking and Remote Access
Once Home Assistant is running, accessing the web interface is simple:
- Local Network Access: If connected locally, access Home Assistant by typing the IP address of the M1 Mac with port
:8123
appended. For example:http://192.168.x.x:8123
- Remote Access with Tailscale: I use Tailscale to securely connect my devices across different networks. With Tailscale, I can access Home Assistant from anywhere using the unique IP provided by Tailscale.
Security Considerations
Even though Home Assistant operates locally, it’s essential to secure your instance. Here are a few tips:
- Network Segmentation: If possible, place your Home Assistant instance on a separate IoT subnet to limit exposure.
- Firewall Rules: Configure firewall rules to control access to Home Assistant’s port (8123) based on IP address.
- Regular Updates: Keep Home Assistant and Podman up to date to ensure you have the latest security patches.
Challenges and Troubleshooting
- SELinux Issues: Disabling SELinux temporarily with
setenforce 0
resolved my SSH setup issues, but I later restored it withsetenforce 1
for enhanced security. - Remote Access: Integrating Tailscale made remote access straightforward, but it’s essential to secure any remote connection to avoid exposing your network.
Conclusion
Setting up Home Assistant on Asahi Linux with Podman on an M1 Mac Mini was an educational experience that bridged my love for Fedora and my smart home setup. Asahi Linux opens up exciting possibilities for Apple hardware, and Podman’s flexibility made container management on Linux seamless. If you’re looking for a secure, self-hosted solution for your smart home, this setup is worth exploring.
I hope this guide helps others setting up their own Home Assistant instances on Asahi Linux. Feel free to leave a comment or reach out if you have questions!