Skip to content

Instantly share code, notes, and snippets.

@xangin
Created October 12, 2023 01:21
Show Gist options
  • Save xangin/d3eaa52d5caebcd6a072f54874f7f098 to your computer and use it in GitHub Desktop.
Save xangin/d3eaa52d5caebcd6a072f54874f7f098 to your computer and use it in GitHub Desktop.
blueprint:
name: 用耗電量來偵測電器已完成任務
description: >
使用任何的耗電量感測器來偵測電器(如洗衣機、烘衣機、洗碗機)
This is Chinese version of blueprint was original created by: [sbyx](https://gist.github.com/sbyx/6d8344d3575c9865657ac51915684696)
domain: automation
input:
power_sensor:
name: 電量感測器
description: 請選擇單位為W的電量感測器(必填)
selector:
entity:
domain: sensor
starting_threshold:
name: 啟動時的耗電量
description: 當電器啟動時會超過多少的耗電量
default: 5
selector:
number:
min: 1.0
max: 100.0
unit_of_measurement: W
mode: slider
step: 0.5
starting_hysteresis:
name: 啟動持續時間
description: 當啟動耗電量持續多久時間後才會視為真的在運作
default: 5
selector:
number:
min: 0.25
max: 60.0
unit_of_measurement: min
mode: slider
step: 0.25
finishing_threshold:
name: 完成時的耗電量
description: 當電器完成時會低於多少的耗電量
default: 5
selector:
number:
min: 1.0
max: 100.0
unit_of_measurement: W
mode: slider
step: 0.5
finishing_hysteresis:
name: 結束持續時間
description: 當結束的耗電量持續多久時間後才會視為真的完成
default: 5
selector:
number:
min: 0.25
max: 60.0
unit_of_measurement: min
mode: slider
step: 0.25
pre_actions:
name: 啟動執行動作
description: 當電器啟動時要執行哪些動作? (如推送通知、TTS廣播...等等)
selector:
action: {}
actions:
name: 完成執行動作
description: 當電器完成時要執行哪些動作? (如推送通知、TTS廣播...等等)
selector:
action: {}
trigger:
- platform: numeric_state
entity_id: !input 'power_sensor'
for:
minutes: !input 'starting_hysteresis'
above: !input 'starting_threshold'
condition: []
action:
- choose: []
default: !input 'pre_actions'
- wait_for_trigger:
- platform: numeric_state
entity_id: !input 'power_sensor'
below: !input 'finishing_threshold'
for:
minutes: !input 'finishing_hysteresis'
- choose: []
default: !input 'actions'
mode: single
max_exceeded: silent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment