Climate toggle switch - possible?

Hi everyone,

I’m trying to create a switch I can use to toggle Eco mode on my Nest thermostat. I can then expose that switch to Alexa via emulated_hue and have Alexa toggle eco mode that way.

I’ve looked into template switches but I can’t get it to work. I’d really appreciate any input anyone has on this.

  - platform: template
switches:
  nest_eco_on:
    value_template: "{{ true }}"
    turn_on:
      service: climate.set_operation_mode
      data:
        entity_id: climate.thermostat
        operation_mode: eco
    turn_off:
      service: climate.set_operation_mode
      data:
        entity_id: climate.thermostat
        operation_mode: heat
1 Like

Very easy:

 - service_template: >
      {%- if (states.climate.bedroom.state == 'off') -%}
        climate.turn_on
      {%- else -%}
        climate.turn_off
      {%- endif -%}
    data:
      entity_id: climate.bedroom
1 Like

Did this work?
I have this switch, but after I turn it on, it goes back to off state after 3 seconds? Do you know what is the problem?

- platform: template
    switches:
      aerconditionat_on_off:
        value_template: "{{ is_state('climate.mideaac', 'off') }}"
        turn_on:
          - service: climate.turn_on
            entity_id: climate.mideaac
        turn_off:
          - service: climate.turn_off
            entity_id: climate.mideaac

Try changing this to 'on' ?

actually this:
value_template: "{{not is_state('climate.daikinap55906', 'off') }}"

1 Like

Thanks for this. I got it working on the latest hassio in 2022 by adding this to my config:

switch:
  - platform: template
    switches:
      ac_toggle:
        friendly_name: "Air Conditioning"
        value_template: "{{ not is_state('climate.fujitsu_ac', 'off') }}"
        turn_on:
          service: climate.turn_on
          target:
            entity_id: climate.fujitsu_ac
        turn_off:
          service: climate.turn_off
          target:
            entity_id: climate.fujitsu_ac
3 Likes

Need some help here. Here is what I have.

switch:
  - platform: template
    switches:
      dayroom_ac_toggle:
        friendly_name: "Dayroom AC Toggle"
        value_template: "{{ not is_state('climate.dayroom_ac', 'cool') }}"
        turn_on:
          service: climate.turn_on
          target:
            entity_id: climate.dayroom_ac
        turn_off:
          service: climate.turn_off
          target:
            entity_id: climate.dayroom_ac

This is what developer tools is showing for climate.dayroom_ac

  - 'off'
  - heat_cool
  - cool
  - heat
  - dry
  - fan_only
min_temp: 320
max_temp: 1652
target_temp_step: 1
swing_modes:
  - 'off'
  - horizontal
current_temperature: 1346
temperature: 1310
swing_mode: 'off'
friendly_name: Dayroom AC
supported_features: 33```

The toggle created isn't doing anything.  When I add the toggle to the dashboard, it comes on for three seconds and then goes back off.  Does not actually cycle the AC unit.