我有一個已經在使用的自動化, 給你參考一下
#################################################################################
# 送出紅外線指令
- alias: when input_boolean.mod_send_ir_code turn on
hide_entity: true
trigger:
- platform: state
entity_id: input_boolean.mod_send_ir_code
from: 'off'
to: 'on'
action:
- service: script.turn_on
data_template:
entity_id:
- script.mod_remote_{{ states('input_number.mod_ch_x00') | int }}
- delay:
milliseconds: 1500
- service: script.turn_on
data_template:
entity_id:
- script.mod_remote_{{ states('input_number.mod_ch_0x0') | int }}
- delay:
milliseconds: 1500
- service: script.turn_on
data_template:
entity_id:
- script.mod_remote_{{ states('input_number.mod_ch_00x') | int }}
- service: input_boolean.turn_off
entity_id: input_boolean.mod_send_ir_code
|