Installing HACS in Home Assistant on OpenWrt Soft Router (NanoPi For NAS All In One R4S)

NO.1
Introduction to HACS

What is HACS?

HACS stands for Home Assistant Community Store, which can be understood as an application store.

It can enhance plugin functionality and supplement features that are not implemented by the official version.

NO.2
Installing HACS

First, you need to enter the Docker container (in terminal form).

Click on the menu, then Docker -> Containers -> copy the corresponding ID of homeassistant -> click on homeassistant.

Installing HACS in Home Assistant on OpenWrt Soft Router (NanoPi For NAS All In One R4S)

Click on the tab for the console.

Input the ID.

Click connect.

Installing HACS in Home Assistant on OpenWrt Soft Router (NanoPi For NAS All In One R4S)

Note:

This article cannot enter the corresponding Docker container environment.

The page keeps loading, but there are no results, and entry is not possible.

If you successfully enter or have a solution, feel free to leave a message.

Enter the terminal via command line.

Click on the menu, then Services -> Terminal.

Input your account and password to enter the OpenWrt terminal.

Installing HACS in Home Assistant on OpenWrt Soft Router (NanoPi For NAS All In One R4S)

HACS official documentation

https://hacs.xyz/docs/setup/download/

The documentation describes the installation method and scripts for HACS in a Docker container.

Installing HACS in Home Assistant on OpenWrt Soft Router (NanoPi For NAS All In One R4S)

Input the following command in the terminal:

docker exec -it homeassistant bash

You can directly enter the homeassistant Docker container environment.

If you cannot enter, check if the name parameter in your docker-compose.yml configuration is homeassistant, or if the name defined by other Docker methods is homeassistant.

Installing HACS in Home Assistant on OpenWrt Soft Router (NanoPi For NAS All In One R4S)

Installing HACS

Execute the following command in the homeassistant container:

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

You should see a prompt that the installation was successful.

And remember to restart homeassistant before configuring.

Installing HACS in Home Assistant on OpenWrt Soft Router (NanoPi For NAS All In One R4S)

Exit the homeassistant container environment by inputting:

exit;

Then press enter to return to the OpenWrt terminal.

Installing HACS in Home Assistant on OpenWrt Soft Router (NanoPi For NAS All In One R4S)

The following content is a general method to enter the container environment.

Use this when docker exec -it homeassistant bash is ineffective or when entering other container environments (still using homeassistant as an example).

There are four ways to enter a Docker container:

  1. Using exec (recommended)

  2. Using SSH

  3. Using docker attach

  4. Using nsenter

First, get the CONTAINER ID of the container you want to enter.

Input the command in the terminal:

docker ps -a

You can see information about all current Docker containers.

Find the container corresponding to homeassistant, as shown in the red box below.

CONTAINER ID is e817b37c486d (which is consistent with the ID seen in the Docker panel above; you can also use the ID copied from there).

Installing HACS in Home Assistant on OpenWrt Soft Router (NanoPi For NAS All In One R4S)

Enter the homeassistant container:

docker exec -it e817b37c486d /bin/bash

Remember to replace e817b37c486d in the command above with your own ID.

You can see that you have entered the homeassistant container, and using ls will show the current directory.

Installing HACS in Home Assistant on OpenWrt Soft Router (NanoPi For NAS All In One R4S)

Then execute the HACS installation and exit using exit;.

Restart the Docker image.

Since this article starts with Docker Compose,

you need to first enter the corresponding project folder.

Then execute the restart Docker command:

docker-compose restart

Restart successful.

Installing HACS in Home Assistant on OpenWrt Soft Router (NanoPi For NAS All In One R4S)

NO.3
Using HACS

Visit IP: Port to enter the homeassistant homepage.

Click on Configuration, then click Add Integration.

Input HACS in the filter, and click on the corresponding result.

Installing HACS in Home Assistant on OpenWrt Soft Router (NanoPi For NAS All In One R4S)

Before submitting,

check the box to acknowledge and agree to the content.

Click Submit.

Installing HACS in Home Assistant on OpenWrt Soft Router (NanoPi For NAS All In One R4S)

You will be prompted to open the corresponding GitHub website.

Input the authorization code.

Installing HACS in Home Assistant on OpenWrt Soft Router (NanoPi For NAS All In One R4S)

Open the GitHub website and log in.

You will see a verification code page. Enter the verification code.

Installing HACS in Home Assistant on OpenWrt Soft Router (NanoPi For NAS All In One R4S)

Agree to the authorization.

If the green button is grayed out and cannot be clicked,

note that some people say it’s a network issue; try switching networks or clearing the cache.

However, in this article, the green button for agreeing to the authorization is always gray and cannot be clicked.

So I used a little frontend trick, opened the console with F12, found the DOM of the green button, and removed the disabled attribute from the corresponding tag.

Then I could click agree…

Installing HACS in Home Assistant on OpenWrt Soft Router (NanoPi For NAS All In One R4S)

Setup successful.

You will see a prompt page.

Installing HACS in Home Assistant on OpenWrt Soft Router (NanoPi For NAS All In One R4S)

At the same time, you will see that the original homeassistant verification code pop-up prompt has become fillable.

Select a region and click Finish.

Installing HACS in Home Assistant on OpenWrt Soft Router (NanoPi For NAS All In One R4S)

You can see that HACS has been integrated into homeassistant.

Installing HACS in Home Assistant on OpenWrt Soft Router (NanoPi For NAS All In One R4S)

NO.4
Tips

This article summarizes the steps to install HACS integration:

  1. Use the command line to enter the homeassistant container environment (terminal).

  2. Use the official script to install HACS.

  3. After successfully installing HACS, restart the homeassistant container (if you don’t know how, restarting the OpenWrt soft router will work too).

  4. In homeassistant, you need to add the HACS integration again and set the configuration.

  5. Follow the steps to agree to the GitHub authorization.

  6. Resolve the issue of not being able to click agree for GitHub authorization (modify the DOM attributes in the browser console).

  7. Complete the HACS plugin integration.

Currently, I haven’t used any scenarios for HACS; I just tried to install HACS and it was successful.

Additionally, it took me two days to solve the issue of pm2 not being able to auto-start in OpenWrt, which facilitates subsequent deployment of services and keeps background processes running.

END.

Recommended Reading

“OpenWrt Soft Router (NanoPi For NAS All In One R4S): Installing Home Assistant with Docker”

“OpenWrt Soft Router (NanoPi For NAS All In One R4S): Installing Node.js, npm, pm2, Auto-start, etc.”

Leave a Comment

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