1 Aidlux 安装

Index of /apk/ (aidlux.com)

基于debain 10.1,改不了内核参数用不了docker,用initd管理而不是systemd,阉割版系统很多安装依赖项要自己摸索补全。参考命令 

Aidlux官网说可以自己编译一个内核跑docker。不适用小内存老旧手机,故放弃。

service apache2 restart

/etc/init.d/nginx reload

/etc/init.d/nginx start

/etc/init.d/nginx status

 1 时区

# 1 由于您的系统使用的是 SysVinit 而不是 systemd,更改时区。
sudo cp /etc/localtime /etc/localtime.backup
sudo ln -sf /usr/share/zoneinfo/Asia/beijing /etc/localtime
date

2 额外附加更新源

sudo apt update
sudo apt-get install ca-certificates apt-transport-https software-properties-common -y
 
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
 
wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
 
sudo apt-get update -y

3 编译环境

GCC 编译需要以下依赖项

sudo apt update
sudo apt install -y build-essential gcc make pkg-config liblzma-dev uuid-dev \
   zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev \
    libreadline-dev libffi-dev libbz2-dev ffmpeg \
    libturbojpeg0 apt-utils libncursesw5-dev tk-dev libc6-dev liblzma-dev

sudo apt install wget build-essential libncursesw5-dev libssl-dev \
libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev  
apt update

apt install gcc make pkg-config build-essential liblzma-dev uuid-devzlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev libbz2-dev curl -y
sudo apt-get install make gcc openssl ffmpeg libturbojpeg0 apt-utils -y

# apt-cache policy sqlite3
# sudo apt-get install sqlite3 bluetooth bluez blueman -y

 4 sqlite3

wget https://www.sqlite.org/2022/sqlite-autoconf-3390100.tar.gz
tar -zxvf sqlite-autoconf-3390100.tar.gz
cd sqlite-autoconf-3390100
# wget https://www.sqlite.org/src/tarball/3b1b0c14/SQLite-3b1b0c14.tar.gz
# tar -zxvf SQLite-3b1b0c14.tar.gz
# cd SQLite-3b1b0c14.tar.gz

./configure --prefix=/usr/local$make

make && make install
 
# 把系统预装的旧版sqlite3移走:
mv /usr/bin/sqlite3 /usr/bin/sqlite3_old
 
# 为新版的sqlite3建立软链接:
ln -s /usr/local/bin/sqlite3 /usr/bin/sqlite3
 
# 配置运行环境库
echo "/usr/local/lib" > /etc/ld.so.conf.d/sqlite3.conf
ldconfig

5 安装python3.12

编译时关注报错,否则部分库不可用

APP手机端先安装应用里的python3.9.10 或能加快编译速度

wget https://mirrors.huaweicloud.com/python/3.12.4/Python-3.12.4.tgz
tar xzf Python-3.12.4.tgz
cd Python-3.12.4
rm -rf build
./configure --enable-optimizations --prefix=/usr/local/python3.12
make -j$(nproc) altinstall
#软连接
ln -s /usr/local/python3.12/bin/python3.12 /usr/bin/python3.12
#./configure --prefix=/usr/local/python3.12
# make altinstall

python3.12 --version 
#显示版本号,正确安装会显示
# 安装pip
wget https://bootstrap.pypa.io/get-pip.py
sudo python3.12 get-pip.py
python3.12 -m pip install --upgrade pip

2 HomeAssistant core 2024.6

查了HA官网,只有core可以装此aidlux环境。

#升级python3.12 的pip
mkdir /opt/homeassistant
cd /opt/homeassistant/
python3.12 -m venv .
source /opt/homeassistant/bin/activate

#更新pip国内源
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip3 install --upgrade pip
pip3 install zlib-ng
pip3 install --upgrade pydantic  # 解决HACS加载项 

#创建虚拟环境
python3.12 -m pip install wheel
python3.12 -m pip install homeassistant
hass

# 后续更新
pip3 install --upgrade homeassistant


# 退出环境
deactivate
source /opt/homeassistant/bin/activate && hass

装了蓝牙 USB也没有用,有搞定的大佬留言教我一下。

1 解决日志

tail -f -n 55 /root/.homeassistant/home-assistant.log

2 HACS

推荐 hacs-china: 🇨🇳 HACS 极速版 (gitee.com) 如果是haos/hassio/supervisor版本的HA,可直接在宿主机或Terminal & SSH加载项中执行上面的命令,如果是core/docker版本的HA,需要ssh登陆宿主机后,并cd进入到HA配置目录再执行安装命令

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

或 官方版

下面代码 vim /home/hacs.sh

后bash /home/hacs.sh

要先 pip install pydantic==1.10.16 解决兼容性问题

#!/bin/bash
# wget -O - https://get.hacs.xyz | bash -
set -e

RED_COLOR='\033[0;31m'
GREEN_COLOR='\033[0;32m'
GREEN_YELLOW='\033[1;33m'
NO_COLOR='\033[0m'

declare haPath
declare -a paths=(
    "$PWD"
    "$PWD/config"
    "/config"
    "/homeassistant"
    "$HOME/.homeassistant"
    "/usr/share/hassio/homeassistant"
)
declare currentVersion
declare currentYear
declare currentMonth
declare currentPatch
declare targetVersion
declare targetYear
declare targetMonth
declare targetPatch

function info () { echo -e "${GREEN_COLOR}INFO: $1${NO_COLOR}";}
function warn () { echo -e "${GREEN_YELLOW}WARN: $1${NO_COLOR}";}
function error () { echo -e "${RED_COLOR}ERROR: $1${NO_COLOR}"; if [ "$2" != "false" ]; then exit 1;fi; }

function checkRequirement () {
    if [ -z "$(command -v "$1")" ]; then
        error "'$1' is not installed"
    fi
}

checkRequirement "wget"
checkRequirement "unzip"

info "Trying to find the correct directory..."
for path in "${paths[@]}"; do
    if [ -n "$haPath" ]; then
        break
    fi

    if [ -f "$path/.HA_VERSION" ]; then
        haPath="$path"
    fi
done

if [ -n "$haPath" ]; then
    info "Found Home Assistant configuration directory at '$haPath'"
    cd "$haPath" || error "Could not change path to $haPath"
    if [ ! -d "$haPath/custom_components" ]; then
        info "Creating custom_components directory..."
        mkdir "$haPath/custom_components"
    fi

    info "Changing to the custom_components directory..."
    cd "$haPath/custom_components" || error "Could not change path to $haPath/custom_components"

    info "Downloading HACS"
    rm -f "$haPath/custom_components/hacs.zip"
    wget "https://github.moeyy.xyz/https://github.com/hacs/integration/releases/latest/download/hacs.zip"

    if [ -d "$haPath/custom_components/hacs" ]; then
        warn "HACS directory already exist, cleaning up..."
        rm -R "$haPath/custom_components/hacs"
    fi

    info "Creating HACS directory..."
    mkdir "$haPath/custom_components/hacs"

    info "Unpacking HACS..."
    unzip "$haPath/custom_components/hacs.zip" -d "$haPath/custom_components/hacs" >/dev/null 2>&1


    echo
    info "Verifying versions"
    targetVersion=$(sed -n -e '/^MINIMUM_HA_VERSION/p' "$haPath/custom_components/hacs/const.py" | cut -d '"' -f 2)
    currentVersion=$(cat "$haPath/.HA_VERSION")

    info "Current version is ${currentVersion}, minimum version is ${targetVersion}"

    targetYear=$(echo "${targetVersion}" | cut -d "." -f 1)
    currentYear=$(echo "${currentVersion}" | cut -d "." -f 1)

    if [ "${currentVersion}" == "2023.12.0" ]; then
        rm -R "$haPath/custom_components/hacs"
        rm -f "$haPath/custom_components/hacs.zip"
        error "HACS will not work on version 2023.12.0 of Home Assistant, upgrade to 2023.12.1 (or newer) before re-running this script."
    fi

    if [ "${currentYear}" -lt "${targetYear}" ]; then
        rm -R "$haPath/custom_components/hacs"
        rm -f "$haPath/custom_components/hacs.zip"
        error "Version ${currentVersion} is not new enough, needs at least ${targetVersion}"
    fi


    if [ "${currentYear}" == "${targetYear}" ]; then
        targetMonth=$(echo "${targetVersion}" | cut -d "." -f 2)
        currentMonth=$(echo "${currentVersion}" | cut -d "." -f 2)

        if [ "${currentMonth}" -lt "${targetMonth}" ]; then
            rm -R "$haPath/custom_components/hacs"
            rm -f "$haPath/custom_components/hacs.zip"
            error "Version ${currentVersion} is not new enough, needs at least ${targetVersion}"
        fi

        if [ "${currentMonth}" == "${targetMonth}" ]; then
            targetPatch=$(echo "${targetVersion}" | cut -d "." -f 3)
            currentPatch=$(echo "${currentVersion}" | cut -d "." -f 3)

            if [ "${currentPatch}" -lt "${targetPatch}" ]; then
                rm -R "$haPath/custom_components/hacs"
                rm -f "$haPath/custom_components/hacs.zip"
                error "Version ${currentVersion} is not new enough, needs at least ${targetVersion}"
            fi
        fi
    fi

    echo
    info "Removing HACS zip file..."
    rm -f "$haPath/custom_components/hacs.zip"
    info "Installation complete."
    echo
    info "Remember to restart Home Assistant before you configure it"

else
    echo
    error "Could not find the directory for Home Assistant" false
    echo "Manually change the directory to the root of your Home Assistant configuration"
    echo "With the user that is running Home Assistant"
    echo "and run the script again"
    exit 1
fi

升级

pip install --i https://mirrors.aliyun.com/pypi/simple/ homeassistant==2024.8.0

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐