本帖最后由 lidicn 于 2017-11-6 20:31 编辑
input_number:
fan_timer:
name: fan timer
initial: 0
min: 0
max: 120
step: 10
input_boolean:
ven_fan_switch:
name: fan switch
initial: off
icon: mdi:fan
automation:
- alias: fan start
trigger:
platform: numeric_state
entity_id: input_number.fan_timer
above: '1'
action:
service: input_boolean.turn_on
entity_id: input_boolean.ven_fan_switch
- alias: fan end
trigger:
platform: numeric_state
entity_id: input_number.fan_timer
below: '1'
action:
service: input_boolean.turn_off
entity_id: input_boolean.ven_fan_switch
- alias: fan countdown
trigger:
platform: time
minutes: '/10'
seconds: 0
condition:
condition: numeric_state
entity_id: input_number.fan_timer
above: '1'
action:
service: input_number.set_value
entity_id: input_number.fan_timer
data_template:
value: '{{ states("input_number.fan_timer") | int -10 }}'
|