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.
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.
Click on the tab for the console.
Input the ID.
Click connect.
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.
HACS official documentation
https://hacs.xyz/docs/setup/download/
The documentation describes the installation method and scripts for HACS in a Docker container.
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
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.
Exit the homeassistant container environment by inputting:
exit;
Then press enter to return to the OpenWrt terminal.
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:
-
Using exec (recommended)
-
Using SSH
-
Using docker attach
-
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).
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.
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.
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.
Before submitting,
check the box to acknowledge and agree to the content.
Click Submit.
You will be prompted to open the corresponding GitHub website.
Input the authorization code.
Open the GitHub website and log in.
You will see a verification code page. Enter the verification code.
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…
Setup successful.
You will see a prompt page.
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.
You can see that HACS has been integrated into homeassistant.
This article summarizes the steps to install HACS integration:
-
Use the command line to enter the homeassistant container environment (terminal).
-
Use the official script to install HACS.
-
After successfully installing HACS, restart the homeassistant container (if you don’t know how, restarting the OpenWrt soft router will work too).
-
In homeassistant, you need to add the HACS integration again and set the configuration.
-
Follow the steps to agree to the GitHub authorization.
-
Resolve the issue of not being able to click agree for GitHub authorization (modify the DOM attributes in the browser console).
-
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 *