我试了不行,得set_hvac_mode
climate:
- platform: climate_template
name: miji_smart_water_heating
modes:
- "heat"
- "off"
unique_id: miji_smart_water_heating
min_temp: 25
max_temp: 55
temp_step: 1
precision: 1
current_temperature_template: "{{ states('sensor.xiaomi_mj2_9513_temperature') }}"
target_temperature_template: "{{ states('number.xiaomi_mj2_9513_target_temperature') }}"
hvac_mode_template: >
{% if is_state('switch.xiaomi_mj2_9513_electric_blanket', 'on') %}
heat
{% else %}
off
{% endif %}
set_temperature:
service: number.set_value
target:
entity_id: number.xiaomi_mj2_9513_target_temperature
data:
value: "{{ temperature }}"
set_hvac_mode:
- choose:
- conditions:
- condition: template
value_template: "{{ hvac_mode == 'off' }}"
sequence:
- service: switch.turn_off
target:
entity_id: switch.xiaomi_mj2_9513_electric_blanket
- conditions:
- condition: template
value_template: "{{ hvac_mode == 'heat' }}"
sequence:
- service: switch.turn_on
target:
entity_id: switch.xiaomi_mj2_9513_electric_blanket
- service: number.set_value
target:
entity_id: number.xiaomi_mj2_9513_target_temperature
data:
value: "{{ temperature }}"
|