Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Introduction

This article mainly introduces how to install the Home Assistant smart home system on the Orange Pi Zero3 with the CasaOS light NAS system and easily achieve remote management of smart devices at home using the Cpolar internal network penetration tool, without the need for a public IP or complicated router settings.

Home Assistant is a smart home platform that can control devices such as Apple, Xiaomi, and MQTT. It can integrate smart home devices at home, allowing devices from different brands to connect to each other. A device, before connecting to HA, is a standalone device that can only interact within its own ecosystem. Once connected to HA, it becomes alive, capable of interacting across all connected platforms, achieving various automations.

Previously, I shared how to use VMware to create virtual machines and deploy using Docker on Synology NAS. Today, I will share how to install it on the power-efficient Orange Pi Zero3, which can stay connected like a router. The process is very simple, and I will demonstrate it in detail below.

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

1. Add Mirror Source

The environment I am demonstrating is the Orange Pi Zero3 small host that has already flashed CasaOS.

If you don’t know how to operate, you can check out this tutorial:How to Flash CasaOS Light NAS System on Orange Pi Zero3

First, we need to enter the Orange Pi IP address in the browser (check in the router for the one named orangepizero3), and enter the CasaOS management interface.

Then enter the terminal and log in using the root account password.

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

After entering the terminal, execute the command below:

nano /etc/docker/daemon.json

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

In the editor, enter the new mirror source address:

{
"registry-mirrors": [
 "https://docker.m.daocloud.io",
 "https://docker.1panel.live"
]
}

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Then press Ctrl+X to save this mirror source, exit the editor, and return to the terminal to execute the command below to restart the docker service:

systemctl restart docker

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

2. Deploy Home Assistant

After completing the above operations, we return to the CasaOS main interface and click on the built-in App Store application center.

After installing the CasaOS system, you will find that the applications inside are too few. To add more applications, just click on more applications in the current APP drop-down box.

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Then click the question mark, which will automatically open a page in the browser to add more applications:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Copy the addresses in this page, and then return to the CasaOS application center interface.

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Paste the copied addresses into the input box with the question mark, then click add. The system will automatically update more applications to the application center interface, increasing from dozens to hundreds.

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

When adding applications, you can search for Home Assistant in the app store and click install to automatically deploy:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

It takes some time, so please be patient. After installation, click the icon to open:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

You can see that the browser opens the Home Assistant initialization process interface, and the address is the Orange Pi host IP +8123 port:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

3. HA System Initialization Configuration

First, click to create my smart home button, which redirects to the user creation interface. Fill in the information and click create user:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Select the region, you can manually locate or choose automatic detection:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Click next:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Here it prompts that compatible devices have been found, you can click finish first, and set up later:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Now the initialization configuration is complete, and you have entered the HA system management interface:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

4. Adding Smart Devices to HA System

4.1 Adding Discovered Devices

First, click the settings in the lower left corner:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Select Devices and Services:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Here you can configure the discovered devices:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Taking my currently discovered Synology NAS as an example, first click configure

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Then enter your NAS login username and password, along with the port number used by the NAS, and click submit:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

After a moment, the HA system can automatically create the configuration, just click finish.

Now on the Home Assistant homepage, you can see the relevant information of the newly added Synology NAS device.

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

4.2 Adding HACS Plugin to Install Devices

If you want to configure undiscovered smart devices, we can add devices by installing the HACS plugin.

First, we click on the CasaOS terminal, still log in with the root account password:

Execute the command below to view all installed container information:

docker ps -a

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Copy the Home Assistant container ID

Then execute the command below

docker exec -it 容器ID bash

Then execute the command below to install the hacs plugin:

wget -O - https://get.hacs.xyz | bash -

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

After installation is complete, reopen the terminal and execute the command below to restart the docker service:

systemctl restart docker

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Then reopen the Home Assistant management interface, click settings:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Select Devices and Services:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Click the add integration in the lower right corner, enter HACS:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

After clicking HACS, in the pop-up prompt box, select all and click submit:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Then copy the string of characters in the pop-up prompt box and click the link in option 1 above:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Then log in to your account on the opened GitHub page, or register one if you don’t have an account, and paste this string of characters in there: click continue

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Then click Authorize hacs to grant authorization to hacs:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Finally, click finish:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Now in the Devices and Services interface, we can see the added HACS plugin:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

To configure undiscovered smart devices through the HACS plugin, I will demonstrate using Xiaomi’s Xiao Ai speaker.

First, we return to the Home Assistant management interface homepage and click on HACS in the sidebar to download the repository.

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

You can see that the first one, Xiaomi Miot Auto, is available. Click the icon to jump and click the download button in the lower right corner:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Continue to click download in the pop-up dialog:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

After completion, you will see a notification requesting to restart HA in the settings:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Click the prompt icon, then click submit:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

After a while, after HA restarts, the management interface will automatically refresh. Click HACS, and you will see that Xiaomi Miot Auto has been successfully installed:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Then click on the lower left corner settings – Devices and Services – lower right corner add integration:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Search for the Xiaomi Miot Auto installed earlier and click in:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Select account integration or LAN integration according to your situation, and click next:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Then enter the Xiaomi account password and click submit:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Then in the device list, select the Xiaomi speaker I want to add, click submit:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Click finish

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Now we can see the added Xiaomi speaker on the HA system homepage and manage it accordingly.

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

5. Install Cpolar Internal Network Penetration

At this point, we have successfully deployed the Home Assistant smart home system on the local CasaOS Orange Pi Zero3 host and installed the HACS plugin to achieve integration configuration for undiscovered devices. However, we can currently only use the HA system on the local area network, which has some limitations. If we want to remotely access the HA system at home while on a business trip, for example, to turn on the air conditioning before arriving home, what should we do?

It’s simple. Just install a Cpolar internal network penetration tool on the Orange Pi, and you can easily achieve remote access to the services deployed on the internal network host. Next, I will introduce how to install Cpolar internal network penetration.

First, click the upper left corner to enter the terminal:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Enter the root account password to log in: (If you don’t know how to get the password, you can refer to the flashing tutorial mentioned above)

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Then execute the command below in the terminal to install the Cpolar internal network penetration tool:

curl -fsSL https://get.cpolar.sh | sudo sh

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

After installation, you can execute the command below to check the service status:

systemctl status cpolar

The image below shows that the Cpolar internal network penetration service is running normally.

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

5.1 Configuring HA Public Address

Then we use the IP address of the CasaOS Orange Pi plus 9200 to open a new browser to log in to the Cpolar management interface:

PS: The IP address of the Orange Pi can be checked in the router, the one named orangepizero3 is it.

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

If you don’t have an account, you can click to register for free to access the Cpolar official website:https://www.cpolar.com

After entering the account password to log in to the Cpolar web UI management interface, click on the tunnel management in the left dashboard – create tunnel:

Tunnel name: customizable, be careful not to duplicate with existing tunnel names, in this example, I used: home assistant

Protocol: http

Local address: Orange Pi host IP + 8123 port

Domain type: random domain name

Region: select China Top

Click create

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

After the tunnel is created successfully, click on the status – online tunnel list on the left to view the generated public address, then copy the address

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Open the browser and use the public address obtained earlier to connect and access. At this point, a 400 error will appear. If not, you can skip this step:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

If there is an error, we need to check the logs to see the specific error prompt. Click the settings in the lower left corner, and click system:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Click logs:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

After opening the logs, we can see a problem, which roughly means: received a request from the reverse proxy from 192.168.x.x, but the HTTP integration is not set up for the reverse proxy. Therefore, we need to modify the configuration file:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

First, return to the CasaOS Orange Pi interface:

Click the file button:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Then enter the DATA-AppData-homeassistant folder:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Continue to enter the config folder:

Then click to open the configuration file named, and add the configuration below and save:

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 192.168.50.215 (replace with your Orange Pi host IP)

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Then enter the CasaOS terminal and execute the command below to restart the docker service:

systemctl restart docker

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

After restarting, we can now use the public address created earlier through Cpolar in the browser to successfully remote access the locally deployed Home Assistant smart home system:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Summary

For demonstration purposes, the public address generated by Cpolar in the above operations is randomly generated. The advantage of this random address is that it can be established quickly and used immediately. However, its disadvantage is that the URL is randomly generated and hard to remember, and this address will randomly change within 24 hours, making it more suitable for temporary testing.

If you have a long-term need for remote access to the local CasaOS Orange Pi’s Home Assistant smart home system or other local services, and do not want to reconfigure the public address every day, while also wanting the address to be good-looking and memorable, I recommend choosing to configure a fixed public address for remote access.

6. Configure Fixed Public Address

Log in to the Cpolar official website, click on the left reserve, select to reserve a secondary subdomain, choose the region China VIP, set a secondary subdomain name, and click reserve. After successful reservation, copy the reserved secondary subdomain name, here I filled in myha001, you can also customize your favorite name.

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

After successful reservation, copy the name of the reserved secondary subdomain:myha001, return to the Cpolar web UI management interface, click on the left dashboard’s tunnel management – tunnel list, find the tunnel to configure home assistant, click edit on the right:

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Modify the tunnel information, configuring the successfully reserved secondary subdomain into the tunnel

  • Domain type: select secondary subdomain

  • Sub Domain: fill in the successfully reserved secondary subdomain: myha001

  • Region: select China VIP

Click Update (Note, click update once is enough, no need to submit repeatedly)

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

After the update is complete, open the online tunnel list. At this point, you can see that the public address has changed from a random address name to two fixed secondary subdomains (fixed public address):

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Using any fixed public address in the browser, you can see access success. Thus, a fixed and permanent public address has been set up, allowing remote access to the CasaOS Orange Pi host’s Home Assistant smart home system anytime and anywhere!

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

The above is how to deploy the Home Assistant smart home system on the CasaOS light NAS system Orange Pi Zero3, install the HACS plugin, and use the Cpolar internal network penetration tool to configure a fixed public address with a secondary subdomain, achieving remote management of smart devices at home anytime and anywhere. Thank you for watching, and feel free to leave comments for any questions.

If you need to reprint, please indicate the source!

Installing Home Assistant on CasaOS Orange Pi Zero3 for Remote Management of Smart Devices

Leave a Comment

Your email address will not be published. Required fields are marked *