Home assistant可以使用兩種方式控制塗鴉智能家電的產品,
雲端或是本地區網控制。
我原本是使用雲端控制捲簾,
參考之前的文章:
但目前HA連接雲端出現了問題,
所以這篇來教如何使用local tuya的方式來控制。
以下方法查找local key的方法僅適用windows,參考來源為https://www.youtube.com/watch?v=YKvGYXw-_cE。
首先要先準備以下的東西
BSTWEAKER - https://bstweaker.tk/
Bluestacks - https://www.bluestacks.com/download.html
Smart Life APK https://www.apkmirror.com/apk/volcano-technology-limited/smart-life-smart-living/smart-life-smart-living-3-6-1-release/smart-life-smart-living-3-6-1-android-apk-download/
首先用手機安裝smartlife並連接設備,
然後安裝模擬器Bluestacks 並打開安裝smart life3.6.1版本,
點擊右側apk舊可以選擇smart life的app來安裝,
安裝完創建帳號加入智能家居產品,
然後關掉這個smart life app,
將BlueStacks 5縮小到工具列但不要關掉。
打開BSTweaker6的BlueStacksTweaker.exe
點擊file manager
按順序點擊data/data
拉到最底下選擇com.tuya.smartlife
選擇shared_prefs
將prefrences_global_keyxxxxxxxxxxxxxxxxxxx.xml拉到左側你想放的電腦資料夾
用word打開這個檔案
就可以找到localkey
然後是Home assistant安裝的部分
將https://github.com/rospogrigio/localtuya下載,
將 localtuya 文件夾及其所有內容複製到Home Assistant 的 custom_components 文件夾中,
可參考:將Boardlink萬用遙控器加入Home assistant,拷貝紅外線碼,並顯示於Homekit控制空調(Samba share的使用)
或使用HACS加入: Home assistant 安裝第三方HACS商店,快速加入整合
重開機後到整合/新增整合/LocalTuya integration 加入產品
將Friendly name跟Local key填入
按照以下選擇就可以了
Invert 0-100 position (for *position* mode only)
如果加入Homekit發現開關相反的話這個要打勾。
在總覽的部分假如是用type: picture-glance就可以加入,
會有bar可以拉位置,
窗簾就會跟著連動。
程式碼
type: picture-glance
image: /local/pic/livingroom.jpeg #想放的圖片路徑
entities:
- entity: cover.cover
icon: 'mdi:blinds'
要寫自動化腳本也可以work,
執行服務選set postition
最新版的Local tuya已經修改好,
加入Homekit使用正常。
如果我的文章對你有幫助,歡迎送我喝杯咖啡喔