最近入手了Dreame L20 Ultra
也透過群內朋友們的方式加入了HA
在摸索了一陣之後把分區以及設定模式弄到NR裡面並傳到HK去執行
並將掃地訊息傳到Line通知
並透過TTS廣播
前置作業
-
先到Dreame GitHub安裝Beta v2.0.0b9版本,下載完後解壓縮放到/homeassistant/custom_components底下
然後重開HA到整合新增Dreame Vacuum ,Beta版本可以直接登入Dreame 的app帳號
HACS Line Notify 安裝申請Line Token 請參考
Line Notify Token + 攝影機截圖 Line訊息傳送 NR應用方法
Edge安裝方式請參考
Edge TTS Node-Red 亂數語音+亂數訊息分享 -
到助手新增按鈕,依照你的分區設定(N+1)*4個按鈕,以我的為例我分了4個區域所以我建了20個按鈕
按鈕依照 區域+模式分類
以我的來說是 全屋 房間1 房間2 房間3 房間4 每個房間4個模式 掃地 拖地 掃拖 先掃後拖分類
****************************
這邊說一個小賤招 不熟json的的請不要照這方法去弄
/config/.storage/input_button
這邊存放的是助手新增的按鈕資料,懶得一個一個新增的可以直接將下面設定貼進去
注意我下方圖片標示的游標位置 先將游標移到那邊再複製下方的設定再貼上去
不然可能會因為[ ]位置不對而造成問題
所以不熟的請不要這樣操作還是乖乖的一個一個手動新增
貼上後存檔 重開HA然後再去助手那邊確認是否有出現20個按鈕
****************************
},
{
"id": "all_room_sweeping",
"icon": "mdi:robot-vacuum",
"name": "All Room Sweeping"
},
{
"id": "all_room_mopping",
"icon": "mdi:robot-vacuum",
"name": "All Room Mopping"
},
{
"id": "all_room_sweeping_and_mopping",
"icon": "mdi:robot-vacuum",
"name": "All Room Sweeping And Mopping"
},
{
"id": "all_room_mopping_after_sweeping",
"icon": "mdi:robot-vacuum",
"name": "All Room Mopping After Sweeping"
},
{
"id": "room1_sweeping",
"icon": "mdi:robot-vacuum",
"name": "Room 1 Sweeping"
},
{
"id": "room1_mopping",
"icon": "mdi:robot-vacuum",
"name": "Room 1 Mopping"
},
{
"id": "room1_sweeping_and_mopping",
"icon": "mdi:robot-vacuum",
"name": "Room 1 Sweeping And Mopping"
},
{
"id": "room1_mopping_after_sweeping",
"icon": "mdi:robot-vacuum",
"name": "Room 1 Mopping After Sweeping"
},
{
"id": "room2_sweeping",
"icon": "mdi:robot-vacuum",
"name": "Room 2 Sweeping"
},
{
"id": "room2_mopping",
"icon": "mdi:robot-vacuum",
"name": "Room 2 Mopping"
},
{
"id": "room2_sweeping_and_mopping",
"icon": "mdi:robot-vacuum",
"name": "Room 2 Sweeping And Mopping"
},
{
"id": "room2_mopping_after_sweeping",
"icon": "mdi:robot-vacuum",
"name": "Room 2 Mopping After Sweeping"
},
{
"id": "room3_sweeping",
"icon": "mdi:robot-vacuum",
"name": "Room 3 Sweeping"
},
{
"id": "room3_mopping",
"icon": "mdi:robot-vacuum",
"name": "Room 3 Mopping"
},
{
"id": "room3_sweeping_and_mopping",
"icon": "mdi:robot-vacuum",
"name": "Room 3 Sweeping And Mopping"
},
{
"id": "room3_mopping_after_sweeping",
"icon": "mdi:robot-vacuum",
"name": "Room 3 Mopping After Sweeping"
},
{
"id": "room4_sweeping",
"icon": "mdi:robot-vacuum",
"name": "Room 4 Sweeping"
},
{
"id": "room4_mopping",
"icon": "mdi:robot-vacuum",
"name": "Room 4 Mopping"
},
{
"id": "room4_sweeping_and_mopping",
"icon": "mdi:robot-vacuum",
"name": "Room 4 Sweeping And Mopping"
},
{
"id": "room4_mopping_after_sweeping",
"icon": "mdi:robot-vacuum",
"name": "Room 4 Mopping After Sweeping"
- 確認按鍵有新增後就將按鈕傳過去HK
下面為homekit.yaml設定的內容 有用homekit.yaml的請直接複製貼上就好,
設定好存檔重開HA掃碼進HK
請注意Port有沒有跟你原本的重複有重複的請改掉Port
另外使用HomeKit Bridge的就自己傳過去吧
-
port: 51811
name: 掃地機
filter:
include_entities:
- input_button.all_room_sweeping
- input_button.all_room_mopping
- input_button.all_room_sweeping_and_mopping
- input_button.all_room_mopping_after_sweeping
- input_button.room_1_sweeping
- input_button.room_1_mopping
- input_button.room_1_sweeping_and_mopping
- input_button.room_1_mopping_after_sweeping
- input_button.room_2_sweeping
- input_button.room_2_mopping
- input_button.room_2_sweeping_and_mopping
- input_button.room_2_mopping_after_sweeping
- input_button.room_3_sweeping
- input_button.room_3_mopping
- input_button.room_3_sweeping_and_mopping
- input_button.room_3_mopping_after_sweeping
- input_button.room_4_sweeping
- input_button.room_4_mopping
- input_button.room_4_sweeping_and_mopping
- input_button.room_4_mopping_after_sweeping
entity_config:
input_button.all_room_sweeping:
name: "全屋掃地"
input_button.all_room_mopping:
name: "全屋拖地"
input_button.all_room_sweeping_and_mopping:
name: "全屋掃拖"
input_button.all_room_mopping_after_sweeping:
name: "全屋先掃後拖"
input_button.room_1_sweeping:
name: "房間1掃地"
input_button.room_1_mopping:
name: "房間1拖地"
input_button.room_1_sweeping_and_mopping:
name: "房間1掃拖"
input_button.room_1_mopping_after_sweeping:
name: "房間1先掃後拖"
input_button.room_2_sweeping:
name: "房間2掃地"
input_button.room_2_mopping:
name: "房間2拖地"
input_button.room_2_sweeping_and_mopping:
name: "房間2掃拖"
input_button.room_2_mopping_after_sweeping:
name: "房間2先掃後拖"
input_button.room_3_sweeping:
name: "房間3掃地"
input_button.room_3_mopping:
name: "房間3拖地"
input_button.room_3_sweeping_and_mopping:
name: "房間3掃拖"
input_button.room_3_mopping_after_sweeping:
name: "房間3先掃後拖"
input_button.room_4_sweeping:
name: "房間4掃地"
input_button.room_4_mopping:
name: "房間4拖地"
input_button.room_4_sweeping_and_mopping:
name: "房間4掃拖"
input_button.room_4_mopping_after_sweeping:
name: "房間4先掃後拖"
中文名稱可以依照自己喜好去做修改
- Dreame Vacuum設定檢查
這邊需要確認幾個設定是否正確
Cleaning Sequence 還有 Customized Cleaning 都需要打開才可以
如果沒有打開,設定模式的幾個會用到的實體會變成不可用 這點請注意
這邊是設定每個區域的清掃次數,請依照你的需求自己修改
這邊是設定拖地時用的拖布濕度,一樣依照你的需求自己修改
這邊是依照你的分區設定清掃順序設定後可以在地圖上面看到
這邊可以看到目前設定的清潔模式
以上這些在掃地機回到基站的時候都是可用狀態
如果掃地機開始清掃都會變成不可用為正常現象
- 到這邊前置作業都差不多了再來就是NR的設定方式
這是我的NR設定
下面的圖是我會分享給大家的完整流
Function內容如下
var roomMapping = new Map([
["input_button.all_room_sweeping", { roomid: 0, mode: "sweeping" }],
["input_button.all_room_mopping", { roomid: 0, mode: "mopping" }],
["input_button.all_room_sweeping_and_mopping", { roomid: 0, mode: "sweeping_and_mopping" }],
["input_button.all_room_mopping_after_sweeping", { roomid: 0, mode: "mopping_after_sweeping" }],
["input_button.room_1_sweeping", { roomid: 1, mode: "sweeping" }],
["input_button.room_1_mopping", { roomid: 1, mode: "mopping" }],
["input_button.room_1_sweeping_and_mopping", { roomid: 1, mode: "sweeping_and_mopping" }],
["input_button.room_1_mopping_after_sweeping", { roomid: 1, mode: "mopping_after_sweeping" }],
["input_button.room_2_sweeping", { roomid: 2, mode: "sweeping" }],
["input_button.room_2_mopping", { roomid: 2, mode: "mopping" }],
["input_button.room_2_sweeping_and_mopping", { roomid: 2, mode: "sweeping_and_mopping" }],
["input_button.room_2_mopping_after_sweeping", { roomid: 2, mode: "mopping_after_sweeping" }],
["input_button.room_3_sweeping", { roomid: 3, mode: "sweeping" }],
["input_button.room_3_mopping", { roomid: 3, mode: "mopping" }],
["input_button.room_3_sweeping_and_mopping", { roomid: 3, mode: "sweeping_and_mopping" }],
["input_button.room_3_mopping_after_sweeping", { roomid: 3, mode: "mopping_after_sweeping" }],
["input_button.room_4_sweeping", { roomid: 4, mode: "sweeping" }],
["input_button.room_4_mopping", { roomid: 4, mode: "mopping" }],
["input_button.room_4_sweeping_and_mopping", { roomid: 4, mode: "sweeping_and_mopping" }],
["input_button.room_4_mopping_after_sweeping", { roomid: 4, mode: "mopping_after_sweeping" }]
]);
var mappingResult = roomMapping.get(msg.topic) || { roomid: 0, mode: "sweeping_and_mopping" };
var entityIds = [];
var cleaningMode = mappingResult.mode;
var zhTWZone = "";
var zhTWMode = "";
if (mappingResult.roomid === 0) {
entityIds = ["select.dreamebot_l20_ultra_room_1_cleaning_mode", "select.dreamebot_l20_ultra_room_2_cleaning_mode", "select.dreamebot_l20_ultra_room_3_cleaning_mode", "select.dreamebot_l20_ultra_room_4_cleaning_mode"];
msg.payload_segments = {"segments": [1, 2, 3, 4]};
zhTWZone = "全屋";
} else {
entityIds = [`select.dreamebot_l20_ultra_room_${mappingResult.roomid}_cleaning_mode`];
msg.payload_segments = {"segments": mappingResult.roomid};
// Map roomid to corresponding zone
var roomidToZoneMap = {
1: "房間1",
2: "房間2",
3: "房間3",
4: "房間4"
};
zhTWZone = roomidToZoneMap[mappingResult.roomid] || "未知區域";
}
// Map cleaningMode to corresponding mode in zh-TW
var modeToZhTWMap = {
"sweeping": "掃地模式",
"mopping": "拖地模式",
"sweeping_and_mopping": "掃拖模式",
"mopping_after_sweeping": "先掃後拖"
};
zhTWMode = modeToZhTWMap[cleaningMode] || "未知模式";
msg.payload_target = {
"entity_id": entityIds
};
msg.payload_setroommode = {
"entity_id": msg.payload_target.entity_id,
"option": cleaningMode
};
msg.payload_tts = {
"message": `掃地機開始掃地,清掃區域 ${zhTWZone},模式為 ${zhTWMode}`,
"cache": true,
"options": {
"volume": "+100%",
"voice": "zh-TW-HsiaoChenNeural", // or use randomVoice if needed
"pitch": "+0Hz",
"rate": "+0%"
}
};
msg.payload_line = { "message": "掃地機開始掃地\n清掃區域為:" + zhTWZone + "\n模式為:" + zhTWMode};
return msg;
roomMapping 這邊對應的是input_button是哪個按鍵被按下
依照對應的按鍵取出 房間ID 以及 掃地模式
roomid=0 代表全屋, =1 代表房間1, 依此類推如果你的區域不是4個請自己增減相對應的
如果你的區域不是4個請修改這段裡面的
msg.payload_segments = {“segments”: [1, 2, 3, 4]};
if (mappingResult.roomid === 0) {
entityIds = ["select.dreamebot_l20_ultra_room_1_cleaning_mode", "select.dreamebot_l20_ultra_room_2_cleaning_mode", "select.dreamebot_l20_ultra_room_3_cleaning_mode", "select.dreamebot_l20_ultra_room_4_cleaning_mode"];
msg.payload_segments = {"segments": [1, 2, 3, 4]};
zhTWZone = "全屋";
roomidToZoneMap 這邊修改成你要的房間名稱
entityIds = [`select.dreamebot_l20_ultra_room_${mappingResult.roomid}_cleaning_mode`];
msg.payload_segments = {"segments": mappingResult.roomid};
// Map roomid to corresponding zone
var roomidToZoneMap = {
1: "房間1",
2: "房間2",
3: "房間3",
4: "房間4"
};
6.各節點設定內容
按鈕的共20個
執行掃地房間與模式選擇
執行掃地
喇叭音量設定
TTS設定
Line通知設定
因超出文章字數限制
完整Floww請到此查看
以上為本次分享
希望能幫到需要的朋友們