Skip to content

Instantly share code, notes, and snippets.

@xangin
Last active July 23, 2024 03:26
Show Gist options
  • Save xangin/25c9ff319ed2dfb18b3397950a56f6e7 to your computer and use it in GitHub Desktop.
Save xangin/25c9ff319ed2dfb18b3397950a56f6e7 to your computer and use it in GitHub Desktop.
update V24.7.23: 1. 新增取消時的動作,可發通知。 2. 執行送風後等待20秒,如當下非送風,再設定一次送風
blueprint:
name: 空調關閉定時送風再關機(計時器版)
description: >
### 當空調要關機後<等待20秒>,會先切成"送風模式",並持續一定時間再關機
### 請先至設定>裝置與服務>助手>新增計時器>記得勾選"回復"並填上想要送風多久的時間再來新增此自動化!
只要空調從"非"送風或暖氣模式變為"關閉"就會觸發此自動化,轉為送風並開始倒數
當倒數結束就會關閉空調,如果在倒數期間切換其他模式,將停止倒數不會繼續
建議一台空調新增一個計數器,避免同時關閉多台空調被影響
**版本: V24.7.23**
domain: automation
input:
climate_entity:
name: 冷氣實體(必填)
description: 選擇要控制的冷氣
selector:
entity:
domain: climate
multiple: false
timer_helper:
name: 計時器實體
description: 請選擇已建立好的計時器實體
selector:
entity:
domain: timer
multiple: false
pre_actions:
name: 啟動執行動作,可選多個動作(選填)
description: >
當轉為送風模式時要執行哪些動作?
(如推送通知、開電扇協助通風、開窗...等等)
default: []
selector:
action: {}
finish_actions:
name: 完成執行動作,可選多個動作(選填)
description: >
當時間到關閉空調時要執行哪些動作?
(如推送通知、關閉協助通風的電扇、關窗...等等)
default: []
selector:
action: {}
cancel_actions:
name: 取消時執行動作,可選多個動作(選填)
description: >
當送風中變更模式消倒數時要執行哪些動作?
(如推送通知、關閉協助通風的電扇、關窗...等等)
default: []
selector:
action: {}
mode: single
trigger:
- alias: "從非送風或暖氣狀態變為關機"
platform: state
entity_id: !input climate_entity
not_from:
- "fan_only"
- "heat"
- "unavailable"
to: "off"
for: "00:00:20"
id: "start"
- alias: "送風中變更模式取消倒數"
platform: state
entity_id: !input climate_entity
from: "fan_only"
not_to: "off"
for: "00:01:00"
id: "timer_cancel"
- alias: "倒數完成關閉冷氣"
platform: event
event_type: timer.finished
event_data:
entity_id: !input timer_helper
id: "finish"
action:
- choose:
- alias: "開啟送風模式"
conditions:
- condition: trigger
id: "start"
sequence:
- service: timer.start
entity_id: !input timer_helper
- service: climate.set_hvac_mode
data:
hvac_mode: fan_only
target:
entity_id: !input climate_entity
- choose: []
default: !input pre_actions
- delay: "00:00:20"
- if:
- not:
- condition: state
entity_id: !input climate_entity
state: 'fan_only'
then:
- service: climate.set_hvac_mode
data:
hvac_mode: fan_only
target:
entity_id: !input climate_entity
- alias: "送風中變更模式取消倒數"
conditions:
- condition: trigger
id: "timer_cancel"
sequence:
- service: timer.cancel
entity_id: !input timer_helper
- choose: []
default: !input cancel_actions
- alias: "送風模式結束並關機"
conditions:
- condition: trigger
id: "finish"
sequence:
- service: climate.turn_off
entity_id: !input climate_entity
- choose: []
default: !input finish_actions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment