Home Assistant Voice Preview 根本不能用,爛得一塌糊塗
原文由 Shawn Wang 于 發布,訂閱此部落格
我最近剛入手一台Home Assistant Voice。當時超興奮,想說可以把它當成能自己寫程式的 Alexa 來玩。
第一個問題——HA Voice 根本沒辦法獨立運作,它還得另外搭配一個 Home Assistant 實例。
好吧,沒關係。我還算懂點技術,應該搞得定。於是前往 HA 安裝說明。
Home Assistant 的問題
一進去它就先想賣我一台 Home Assistant Green。算了,我是沒興趣,但你們盡量賺吧。
對了,你們的購買按鈕現在是壞的,或許該去看一下。
我實在懶得等 Raspberry Pi 寄來,所以繼續往下滑。我手邊就有四台閒置的 Mac,或許可以用其中一台?啊,有 Mac 的安裝指南!
在 Mac 上安裝 Home Assistant
它要我做的第一件事就是下載「適當的映像檔」。為什麼不是 Docker image?或是那種可以直接掛載的東西?結果卻要我搞什麼 VM 的鬼東西?算了,去他的,晚點再來研究。(我後來才知道 VirtualBox 是一種特定類型的 VM hypervisor,但當時我根本不知道,或許應該加個下載 VirtualBox 的說明……)
這不是開源的嗎?難道不能直接從原始碼執行?看起來還有一個版本叫 Home Assistant Core,不錯嘛。
嗯……新款 Mac 已經沒有 apt-get 了。
沒關係,改用 brew 就好。安裝倒是成功了,不錯。
下一步:建立一個帳號。
靠北,這他媽是 Linux 的指南吧?到底有沒有人真的為 Mac 客製化過啊?
事實上,這些看起來全都是 Linux 那一套。
去他媽的,爛透了。
接著我試了這個:假設你已經安裝了 uv:
# be in some folder you like
uv venv
uv pip install homeassistant==2025.1.2 --prerelease=allow
uv run hass第一次建置時我遇到了問題,顯然你得先執行「sudo softwareupdate --install "Command Line Tools for Xcode-16.2"」,否則就會出現這個錯誤
Unable to find configuration. Creating default one in /Users/shawnwang/.homeassistant
2025-01-19 16:33:27.267 WARNING (MainThread) [aiohttp_fast_zlib] zlib_ng and isal are not available, falling back to zlib, performance will be degraded.
2025-01-19 16:33:36.677 ERROR (SyncWorker_4) [homeassistant.util.package] Unable to install package pyspeex-noise==1.0.2: × Failed to download and build `pyspeex-noise==1.0.2`
╰─▶ Build backend failed to build wheel through `build_wheel` (exit status: 1)
[stdout]
running bdist_wheel
running build
running build_py
building 'speex_noise_cpp' extension
clang++ -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -arch arm64 -mmacosx-version-min=11.0 ...
[stderr]
/Users/shawnwang/.cache/uv/sdists-v6/pypi/pyspeex-noise/1.0.2/OiKAa5C3V4L1j77Pq6j5d/src/speex/preprocess.cc:921:14: warning: code will never be executed [-Wunreachable-code]
Compiling with an SDK that doesn't seem to exist: /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk
Please check your Xcode installation
clang++: warning: no such sysroot directory: '/Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk'
ld: library 'c++' not found
clang++: error: linker command failed with exit code 1
error: command '/usr/bin/clang++' failed with exit code 1
2025-01-19 16:34:07.135 ERROR (MainThread) [homeassistant.setup] Setup failed for 'cloud': Requirements for assist_pipeline not found: ['pyspeex-noise==1.0.2'].
2025-01-19 16:34:19.493 ERROR (MainThread) [homeassistant.setup] Error during setup of component conversation
Traceback (most recent call last):
File "/Users/shawnwang/Desktop/Work/homeassistant/.venv/lib/python3.12/site-packages/homeassistant/setup.py", line 416, in _async_setup_component
result = await task
File "/Users/shawnwang/Desktop/Work/homeassistant/.venv/lib/python3.12/site-packages/homeassistant/components/conversation/__init__.py", line 246, in async_setup
from homeassistant.components.assist_pipeline import ( # pylint: disable=import-outside-toplevel
File "/Users/shawnwang/Desktop/Work/homeassistant/.venv/lib/python3.12/site-packages/homeassistant/components/assist_pipeline/pipeline.py", line 55, in <module>
from .audio_enhancer import AudioEnhancer, EnhancedAudioChunk, MicroVadSpeexEnhancer
File "/Users/shawnwang/Desktop/Work/homeassistant/.venv/lib/python3.12/site-packages/homeassistant/components/assist_pipeline/audio_enhancer.py", line 8, in <module>
from pyspeex_noise import AudioProcessor
ModuleNotFoundError: No module named 'pyspeex_noise'
2025-01-19 16:34:19.497 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of 'assist_pipeline'. Setup failed for dependencies: ['conversation']
2025-01-19 16:34:19.497 ERROR (MainThread) [homeassistant.setup] Setup failed for 'assist_pipeline': Could not setup dependencies: conversation
2025-01-19 16:34:19.886 ERROR (MainThread) [homeassistant.setup] Setup failed for 'mobile_app': Requirements for assist_pipeline not found: ['pyspeex-noise==1.0.2'].
2025-01-19 16:34:19.886 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of 'default_config'. Setup failed for dependencies: ['assist_pipeline', 'cloud', 'conversation', 'mobile_app']
2025-01-19 16:34:19.886 ERROR (MainThread) [homeassistant.setup] Setup failed for 'default_config': Could not setup dependencies: assist_pipeline, cloud, conversation, mobile_app
2025-01-19 16:34:19.887 WARNING (MainThread) [homeassistant.bootstrap] Support for the running Python version 3.12.7 is deprecated and will be removed in Home Assistant 2025.2; Please upgrade Python to 3.13這樣讓我進展了不少。不過因為 HA 裡一堆相依套件的關係,我還是卡住了,無法繼續:
所以我就卡在那裡了。既然本地安裝又在老地方卡關,只好回到 VM 這條路(原則上我就是不肯裝那個爛到爆的 Xcode)。
Oracle VirtualBox
沒有人去 Oracle 旗下的東西會感到愉快的。裝好 VirtualBox 後,對著稍早下載的 .vdi 檔連點兩下……什麼反應都沒有
當然,HA 頁面上的說明
跟 VirtualBox 的設定頁面根本對不起來
我 Google 了老半天才發現,原來要在這裡載入 vdi 檔
網路選項也得設定
然後它終於跑起來了(在你搞定那堆螢幕控制/權限設定之後):
然而,連到 http://homeassistant.local:8123/ 卻什麼都沒有。我試著把它關掉,結果……當然就是彩虹球轉個不停。
重新啟動。
總之,看起來預設的 vdi 本身就帶有一些知名的 bug,而且現在還直接少了它預期要載入的 \EFI\BOOT\BOOTx64.efi 檔。我在這裡找到一個可以下載的檔案,也學到可以透過共用資料夾把它匯入到 VM 裡。
這樣總算有了一點進展……
但最後還是一條死路。
又多 Google 了一下,找到了這些:https://community.home-assistant.io/t/unable-to-boot-home-assistant-in-virtual-machine-starup-nsh-error/220267/27?page=2
用 Docker 跑 Home Assistant
偶然看到一則留言,才發現這鬼東西搞不好有 Docker 容器藏在 Linux 文件裡,所以就來試試看……
這個終於成功了!!
將手機 App 連上 HA 伺服器。
https://voice-pe.home-assistant.io/getting-started/ 說你得用手機 App 來找到 HA Voice 裝置。
當然,它就預設網路會自己通,但他媽的當然不會通
當然,這就是他們向你推銷 Nabu Cloud 的地方。
我試著用 ngrok 來建隧道,結果只得到一堆 400 Bad Request 錯誤。我最後還是註冊了 Nabu Cloud,但我一點也不開心。這反而更讓我想把整套東西丟掉、一把火燒了。
等這個遠端存取啟用後,再把連結(對,就是 UI 上那個連結)複製到你的手機上
如果成功的話,應該會看到這個
終於要搞語音了
回到https://voice-pe.home-assistant.io/getting-started/
幸好,這部分倒是跟宣傳的一樣正常運作。
當它要求「授權」時,其實就只是要你像照片那樣按一下按鈕
然後就在這裡碰上了這個問題 https://github.com/esphome/home-assistant-voice-pe/issues/265
幹。
但那失敗了。你必須輸入裝置的 WLAN IP。 如果你沒有手動指定其他埠號,裝置的埠號會自動是 6052。
我請 Vibhu 去翻路由器紀錄,找出已連線的 HA Voice 裝置的 IP。它是一個 192.168.x.x 的 IP,埠號是 6053(不是留言說的 6052)。把那個填進 ESPHome,試了第二次就成功了。
接著我跑了設定精靈……當然,這還不是我惡夢的終點。
https://github.com/esphome/home-assistant-voice-pe/issues/288
這個說明看起來最直接相關 https://community.home-assistant.io/t/home-assistant-voice-pe-tls-certificate-verification-failed/815768/3
試了一個小時左右之後,我放棄了。
隨機一篇部落格
留言
登入後參與討論