Advertisement
xangin

Vacuum X10+ Sweeping than Mopping HA Script

Apr 16th, 2024 (edited)
1,088
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.51 KB | None | 1 0
  1. # 掃地機先掃後拖腳本:
  2. # 1. 複製所有內容,放在script.yaml的最後面
  3. # 2. 更改以下三個ID改成自己的
  4. # 3. 存檔後>開發工具>檢查設定內容>確認沒問題>下方重新載入YAML設定>選腳本
  5. # 4. 去設定>自動化與場景>腳本有出現"掃地機先掃後拖"且前面圖示不是紅色表示正常
  6. # 5. 右邊三點>執行即可,日後呼叫服務"script.vacuum_sweeping_than_mopping"即可執行此腳本
  7. # 6. 有問題時,點進腳本>右上角紀錄>看是哪一步出了問題再提出
  8. vacuum_sweeping_than_mopping:
  9.   alias: "掃地機先掃後拖"
  10.   variables:
  11.     vacuum_id: vacuum.xiaomi_x10 #更換成你的掃地機實體ID
  12.     notify_service: notify.home_notify #更換成你的通知服務名稱
  13.     clean_mode: select.xiaomi_x10_cleaning_mode #更換成你掃地機的Cleaning Mode的實體ID
  14.    
  15.   sequence:    
  16.     - alias: "開始掃地程序: 1.調整吸力最強"
  17.       service: vacuum.set_fan_speed
  18.       data:
  19.         entity_id: "{{ vacuum_id }}"
  20.         fan_speed: 'Turbo'
  21.    
  22.     - alias: "2.選擇單掃地模式"
  23.       service: select.select_option
  24.       data:
  25.         option: sweeping
  26.       target:
  27.         entity_id: "{{ clean_mode }}"
  28.        
  29.     - alias: "3.Line通知"
  30.       service: "{{ notify_service }}"
  31.       data:
  32.         message: "開始掃地"
  33.                  
  34.     - alias: "4.掃地機開始清理"
  35.       service: vacuum.start
  36.       target:
  37.         entity_id: "{{ vacuum_id }}"
  38.  
  39.     - alias: "5.等待掃地機回家"
  40.       wait_template: "{{ is_state(vacuum_id, 'returning') }}"      
  41.  
  42.     - alias: "6.等待掃地機充電"
  43.       wait_template: "{{ is_state(vacuum_id, 'docked') }}"    
  44.          
  45.     - alias: "7.Line通知"
  46.       service: "{{ notify_service }}"
  47.       data:
  48.         message: "掃地完成"                    
  49.    
  50.  
  51.     - alias: "開始拖地程序: 1.調整吸力最弱"
  52.       service: vacuum.set_fan_speed
  53.       data:
  54.         entity_id: "{{ vacuum_id }}"
  55.         fan_speed: 'Silent'
  56.        
  57.     - alias: "2.選擇單拖地模式"
  58.       service: select.select_option
  59.       data:
  60.         option: mopping
  61.       target:
  62.         entity_id: "{{ clean_mode }}"
  63.          
  64.     - delay:
  65.         seconds: 1
  66.        
  67.     - alias: "3.Line通知"
  68.       service: "{{ notify_service }}"
  69.       data:
  70.         message: "開始拖地"
  71.          
  72.     - alias: "4.掃地機開始清理"
  73.       service: vacuum.start
  74.       target:
  75.         entity_id: "{{ vacuum_id }}"                                  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement