Synchronize climate and switch entity

Sync state of switch and a climate entity. Used to control climate from a remote switch and reflect the climate state on the switch LED indicator.

Click the badge to import this Blueprint: (needs Home Assistant Core 2021.3 or higher)

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Or import this Blueprint by using the forum topic URL:

blueprint:
  name: Sync climate with a switch entity
  description: |
      Sync states of a climate entity and a switch.

      Useful when you want to track the state of the climate entity on, for example, a switch with a LED indicator and control the heater from the same switch.
  domain: automation
  input:
    switch:
      name: Choose switch device
      selector:
        entity:
          domain: switch
    climate:
      name: Choose climate device
      selector:
        entity:
          domain: climate
mode: single
max_exceeded: silent
variables:
  climate: !input climate
  switch: !input switch
trigger:
  - platform: state
    entity_id: !input climate
  - platform: state
    entity_id: !input switch
condition:
  - condition: template
    value_template: >-
      {{ states(climate | replace("idle", "on") | replace("heat", "on") | replace("cool", "on") | replace("dry", "on")) !=
      states(switch) }}
action:
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ trigger.entity_id == climate }}'
        sequence:
          - service: >-
              switch.turn_{{ "on" if trigger.to_state.state != "off" else "off" }}
            target:
              entity_id: !input switch
      - conditions:
          - condition: template
            value_template: '{{ trigger.entity_id == switch }}'
        sequence:
          - service: 'climate.turn_{{ trigger.to_state.state }}'
            target:
              entity_id: !input climate

Hello,
Thank you for the blueprint, I currently use it.
I just have one minor issue and don’t know how to solve it. My wall switch sometimes goes unavailable for a couple of seconds. Is there a way so that when it goes from unavailable to on or from unavailable to off that a sync doesn’t happen? Like it ignores that as a sync? Thanks

Probably but not using this blueprint.

It would need to be separate automations with state trigger using from: on and to: off and vice versa