请教下楼主,这个在HA有温度传感器的情况下怎么实现自动化开关?看看下边的能实现不?
automation:
- alias: "自动开"
trigger:
- platform: numeric_state
entity_id: sensor.温度传感器
above: 27.2
for:
minutes: 10
- platform: state
entity_id: input_number.remote_temp_bedroom
- platform: state
entity_id: input_number.remote_fanspeed_bedroom
condition:
- condition: state
entity_id: sun.sun #日照时间
state: below_horizon #仅在晚上
action:
service: remote.send_command
data_template:
entity_id: remote. #红外ID
command: >
{% if states.input_select.remote_fanspeed_bedroom.state == "自动" %}ir_{{ states('input_number.remote_temp_bedroom') | int }}00
{% elif states.input_select.remote_fanspeed_bedroom.state == "小" %}ir_{{ states('input_number.remote_temp_bedroom') | int }}01
{% elif states.input_select.remote_fanspeed_bedroom.state == "中" %}ir_{{ states('input_number.remote_temp_bedroom') | int }}02
{% elif states.input_select.remote_fanspeed_bedroom.state == "大" %}ir_{{ states('input_number.remote_temp_bedroom') | int }}03
{% endif %}
- alias: "自动关"
trigger:
- platform: numeric_state
entity_id: sensor.温度传感器
below: 25.1
for:
minutes: 10
action:
- service: remote.send_command
data:
entity_id: remote. #红外ID
command: ir_1000
|