Skip to content

Instantly share code, notes, and snippets.

@xangin
Last active July 12, 2024 14:34
Show Gist options
  • Save xangin/0a724ad581c58e66fd899b2167eaf483 to your computer and use it in GitHub Desktop.
Save xangin/0a724ad581c58e66fd899b2167eaf483 to your computer and use it in GitHub Desktop.
blueprint:
name: 空調關閉先定時送風再關機
description: >
### 當空調要關機後<經過20秒>,會先切成"送風模式",並持續一定時間再關機
只要空調從"非"送風或暖氣模式變為"關閉"就會觸發此自動化
請注意!在送風期間HA請勿重啟或重新載入自動化,不然將無法自動關閉空調唷!!
**版本: V24.7.12**
domain: automation
input:
climate_entity:
name: 冷氣實體(必填)
description: 選擇要控制的冷氣
selector:
entity:
domain: climate
multiple: false
keep_time:
name: 送風模式的持續時間(小時)
description: 送風要吹多少小時再關閉?
default: 1
selector:
number:
min: 0.5
max: 5.0
unit_of_measurement: hour
mode: slider
step: 0.5
pre_actions:
name: 啟動執行動作,可選多個動作(選填)
description: >
當轉為送風模式時要執行哪些動作?
(如推送通知、開電扇協助通風、開窗...等等)
default: []
selector:
action: {}
finish_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
to: "fan_only"
for:
hours: !input keep_time
id: "finish"
action:
- choose:
- alias: "開啟送風模式"
conditions:
- condition: trigger
id: "start"
sequence:
- service: climate.set_hvac_mode
data:
hvac_mode: fan_only
target:
entity_id: !input climate_entity
- choose: []
default: !input pre_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