Skip to content

❄️Templatable Climate Device for Home Assistant, Supports Running Actions On Service Calls.

License

Notifications You must be signed in to change notification settings

jcwillox/hass-template-climate

Repository files navigation

Template Climate

hacs_badge

The climate_template platform creates climate devices that combine integrations and provides the ability to run scripts or invoke services for each of the set_* commands of a climate entity.

Configuration

All configuration variables are optional. The climate device will work in optimistic mode (assumed state) if a template isn't defined.

If you do not define a template or its corresponding action the climate device will not have that attribute, e.g. either swing_mode_template or set_swing_mode must be defined for the climate to have a swing mode.

Name Type Description Default Value
name string The name of the climate device. "Template Climate"
icon_template template Defines a template for the icon of the sensor.
entity_picture_template template Defines a template for the entity picture of the sensor.
availability_template template Defines a template to get the available state of the component. If the template returns true, the device is available. If the template returns any other value, the device will be unavailable. If availability_template is not configured, the component will always be available. true
current_temperature_template template Defines a template to get the current temperature.
current_humidity_template template Defines a template to get the current humidity.
swing_mode_template template Defines a template to get the swing mode of the climate device.
set_temperature action Defines an action to run when the climate device is given the set temperature command.
set_hvac_mode action Defines an action to run when the climate device is given the set hvac mode command.
set_fan_mode action Defines an action to run when the climate device is given the set fan mode command.
set_swing_mode action Defines an action to run when the climate device is given the set swing mode command.
modes list A list of supported hvac modes. Needs to be a subset of the default values. ["auto", "off", "cool", "heat", "dry", "fan_only"]
fan_modes list A list of supported fan modes. ["auto", "low", "medium", "high"]
swing_modes list A list of supported swing modes. ["on", "off"]
min_temp float Minimum set point available. 7
max_temp float Maximum set point available. 35
precision float The desired precision for this device. 0.1 for Celsius and 1.0 for Fahrenheit.
temp_step float Step size for temperature set point. 1

Example Configuration

climate:
  - platform: climate_template
    name: Bedroom Aircon
    modes:
      - "auto"
      - "dry"
      - "off"
      - "cool"
      - "fan_only"
    min_temp: 16
    max_temp: 30
    
    # get current temp.
    current_temperature_template: "{{ states('sensor.bedroom_temperature') }}"  
    
    # get current humidity.
    current_humidity_template: "{{ states('sensor.bedroom_humidity') }}"
    
    # swing mode switch for UI.
    swing_mode_template: "{{ states('input_boolean.bedroom_swing_mode') }}"
    
    # available based on esphome nodes' availability.
    availability_template: "{{ is_state('binary_sensor.bedroom_node_status', 'on') }}"

    # Example Action.
    set_hvac_mode:
    
      # allows me to disable sending commands to aircon via UI.
      - condition: state  
        entity_id: input_boolean.enable_aircon_controller
        state: "on"
        
      # send the climates current state to esphome.
      - service: esphome.bedroom_node_aircon_state  
        data_template:
          temperature: "{{ state_attr('climate.bedroom_aircon', 'temperature') | int }}"
          operation_mode: "{{ states('climate.bedroom_aircon') }}"
          fan_mode: "{{ state_attr('climate.bedroom_aircon', 'fan_mode') }}"
          swing_mode: "{{ is_state_attr('climate.bedroom_aircon', 'swing_mode', 'on') }}"
          light: "{{ is_state('light.bedroom_aircon_light', 'on') }}"
          
      # could also send IR command via broadlink service calls etc.

Use Cases

  • Merge multiple components into one climate device (just like any template platform).
  • Control optimistic climate devices such as IR aircons via service calls.

About

❄️Templatable Climate Device for Home Assistant, Supports Running Actions On Service Calls.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Languages