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

nclarknz/climatecustom

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

❄️ Template Climate

HACS Badge License Latest Release Size Code style

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"
unique_id string The unique id of the climate entity. None
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.
target_temperature_template template Defines a template to get the target temperature of the climate device.
target_temperature_high_template template Defines a template to get the target temperature high of the climate device.
target_temperature_low_template template Defines a template to get the target temperature low of the climate device.
hvac_mode_template template Defines a template to get the hvac mode of the climate device.
fan_mode_template template Defines a template to get the fan mode of the climate device.
swing_mode_template template Defines a template to get the swing mode of the climate device.
hvac_action_template template Defines a template to get the hvac action of the climate device.
set_temperature action Defines an action to run when the climate device is given the set temperature command. Can use temperature, target_temp_high, target_temp_low and hvac_mode variables.
set_hvac_mode action Defines an action to run when the climate device is given the set hvac mode command. Can use hvac_mode variable.
set_fan_mode action Defines an action to run when the climate device is given the set fan mode command. Can use fan_mode variable.
set_swing_mode action Defines an action to run when the climate device is given the set swing mode command. Can use swing_mode variable.
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:
          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.

Example action to control existing Home Assistant devices

climate:
  - platform: climate_template
    # ...
    set_hvac_mode:
      # allows you to control an existing Home Assistant HVAC device
      - service: climate.set_hvac_mode
        data:
          entity_id: climate.bedroom_ac_nottemplate
          hvac_mode: "{{ states('climate.bedroom_ac_template') }}"

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%