Mini Climate Card

February 22, 2024 · View on GitHub

Last Version Build Status hacs_badge

A minimalistic yet customizable climate card for Home Assistant Lovelace UI.
Please ⭐️ this repo if you find it useful

card preview

Notice

v2 is only compatible from version 2022.11 onwards

Install

This card is available in HACS (Home Assistant Community Store)

Simple install

  1. Download and copy mini-climate-card-bundle.js from the latest release into your config/www directory.

  2. Add a reference to mini-climate-card-bundle.js inside your ui-lovelace.yaml.

resources:
  - url: /local/mini-climate-card-bundle.js?v=2.21
    type: module

CLI install

  1. Move into your config/www directory

  2. Grab mini-climate-card-bundle.js

$ wget https://github.com/artem-sedykh/mini-climate-card/releases/download/v2.2.1/mini-climate-card-bundle.js
  1. Add a reference to mini-climate-card-bundle.js inside your ui-lovelace.yaml.
resources:
  - url: /local/mini-climate-card-bundle.js?v=2.2.1
    type: module

Updating

  1. Find your mini-climate-card-bundle.js file in config/www or wherever you ended up storing it.

  2. Replace the local file with the latest one attached in the latest release.

  3. Add the new version number to the end of the cards reference url in your ui-lovelace.yaml like below.

resources:
  - url: /local/mini-climate-card-bundle.js?v=2.2.1
    type: module

You may need to empty the browsers cache if you have problems loading the updated card.

Using the card

Options

Card options

NameTypeDefaultSinceDescription
typestringrequiredv1.0.1custom:mini-climate
entitystringrequiredv1.0.1An entity_id from an entity within the climate domain
namestringoptionalv1.0.1Override the entities friendly name
groupbooleanoptionalv1.0.2Removes border, paddings, background color and box-shadow
iconstringoptionalv1.0.1Specify a custom icon from any of the available mdi icons
swap_temperaturesbooleanoptionalV2.1.1Swap the current and the target temperature in the card
hide_current_temperaturebooleanoptionalV2.1.2Hide the current temperature in the card
hide_current_temperaturefunctionoptionalV2.5.0Custom hide the current temperature in the card function
toggleobjectoptionalv1.0.2Show/hide bottom buttons toggle button
toggle: iconstringoptionalv1.0.2Custom icon, default value mdi:dots-horizontal
toggle: hidebooleanoptionalv1.0.2Hide toggle button, default value False
toggle: hidefunctionoptionalv2.5.0Custom hide toggle button function
toggle: defaultbooleanoptionalv1.0.2Default toggle button state, default value False
secondary_infoobjectoptionalv1.1.0secondary_info config. secondary info examples
secondary_info: typestringoptionalv1.1.0Available types: last-changed, last-updated (v2.2.0), fan-mode, fan-mode-dropdown, hvac-mode, hvac-action
secondary_info: iconstringoptionalv1.1.0Icon for types: fan-mode, fan-mode-dropdown, hvac-mode, hvac-action
secondary_info: hidebooleanoptionalv2.3.0Hide secondary_info, default value False
secondary_info: hidefunctionoptionalv2.5.0Custom hide secondary_info function.
secondary_info: sourceobjectoptionalv1.2.1Source available types: hvac-action
secondary_info: source:{item_name}objectoptionalv1.2.1Source item name
secondary_info: source:{item_name}:iconobjectoptionalv1.2.1Specify a custom icon from any of the available mdi icons
secondary_info: source:{item_name}:nameobjectoptionalv1.2.1Display name
temperatureobjectoptionalv1.0.1Current temperature configuration. temperature examples
temperature: unitstringoptionalv1.0.1Display unit, default °C
temperature: round or fixednumberoptionalv1.2.2Rounding or fixed value, default round: 1
temperature: sourceobjectoptionalv1.0.1Data source for target temperature
temperature: source:entitystringoptionalv1.0.1entity_id, default current climate entity_id
temperature: source:attributestringoptionalv1.0.1Default current_temperature
target_temperatureobjectoptionalv1.0.1Target temperature configuration. target_temperature examples
target_temperature: iconsobjectoptionalv1.0.1Icons for temperature change buttons
target_temperature: icons:upstringoptionalv1.0.1Up icon, default mdi:chevron-up
target_temperature: icons:downstringoptionalv1.0.1Down icon, default mdi:chevron-down
target_temperature: unitstringoptionalv1.0.1Display unit, default °C
target_temperature: minnumberoptionalv1.0.1Minimum temperature, the default value is taken from the attribute min_temp of the given entity
target_temperature: maxnumberoptionalv1.0.1Maximum temperature, the default value is taken from the attribute max_temp of the given entity
target_temperature: stepnumberoptionalv1.0.1Temperature change step, the default value is taken from the attribute target_temp_step of the given entity
target_temperature: sourceobjectoptionalv1.0.1Data source for target temperature
target_temperature: source:entitystringoptionalv1.0.1entity_id, default current climate entity_id
target_temperature: source:attributestringoptionalv1.0.1Default temperature
target_temperature: change_actionfunctionoptionalv1.0.1Custom temperature change function
hvac_modeobjectoptionalv1.0.1HVAC mode. hvac_mode examples
hvac_mode: stylefunctionoptionalv1.0.1Custom style
hvac_mode: change_actionfunctionoptionalv1.0.1Custom hvac_mode change function
hvac_mode: stateobjectoptionalv1.0.1Config to get hvac_mode state
hvac_mode: hidebooleanoptionalv1.2.3Hide hvac_mode, default value False
hvac_mode: hidefunctionoptionalv2.5.0Custom hide hvac_mode function
hvac_mode: state:entitystringoptionalv1.1.0hvac_mode entity_id
hvac_mode: state:attributestringoptionalv1.1.0hvac_mode attribute
hvac_mode: state:mapperfunctionoptionalv1.1.0State processing function
hvac_mode: activefunctionoptionalv1.1.0Active function
hvac_mode: sourceobjectoptionalv1.0.1Data
hvac_mode: source:__filterfunctionoptionalv1.1.0Filter function
hvac_mode: source:itemobjectoptionalv1.0.1item - mode name e.g. cool, heat, off, etc.
hvac_mode: source:item:iconstringoptionalv1.0.1Specify a custom icon from any of the available mdi icons
hvac_mode: source:item:namestringoptionalv1.0.1Display name
hvac_mode: source:item:hidebooleanoptionalv2.5.0Hide source, default value False
hvac_mode: source:item:ordernumberoptionalv1.2.5Sort order
fan_modeobjectoptionalv1.0.1Fan operation for climate device. fan_mode examples
fan_mode: iconstringoptionalv1.0.1Specify a custom icon from any of the available mdi icons
fan_mode: ordernumberoptionalv1.0.1Sort order, default value 0
fan_mode: locationstringoptionalv1.0.1Allows you to display buttons on the main panel, types main, bottom, default bottom
fan_mode: hidenumberoptionalv1.0.1Hide button, default value False
fan_mode: hidefunctionoptionalv2.5.0Custom hide button function
fan_mode: stylefunctionoptionalv1.0.1Style
fan_mode: disabledfunctionoptionalv1.0.1Disabled function
fan_mode: activefunctionoptionalv1.0.1Active
fan_mode: change_actionfunctionoptionalv1.0.1Custom fan_mode change function
fan_mode: stateobjectoptionalv1.0.1Config to get fan_mode state
fan_mode: state:entitystringoptionalv1.0.1fan_mode entity_id
fan_mode: state:attributestringoptionalv1.0.1fan_mode attribute, default fan_mode
fan_mode: sourceobjectoptionalv1.0.1Source for drop down list
fan_mode: source:itemstringoptionalv1.0.1item - mode name e.g. auto, low, medium...
fan_mode: source:__filterfunctionoptionalv1.0.1Source filter
indicatorsobjectoptionalv1.0.1Any indicators, examples
indicators: nameobjectoptionalv1.0.1The name of your indicator see examples
indicators: name:iconstringoptionalv1.0.1Specify a custom icon from any of the available mdi icons
indicators: name:iconobjectoptionalv1.0.1Icon object
indicators: name:icon:templatefunctionoptionalv1.0.1Icon template function
indicators: name:icon:stylefunctionoptionalv1.0.1Styles
indicators: name:valueobjectoptionalv1.0.1Value object
indicators: name:value:stylefunctionoptionalv1.0.1Styles
indicators: name:unitstringoptionalv1.0.1Display unit
indicators: name:unitstringoptionalv1.0.1Display unit
indicators: name:roundnumberoptionalv1.0.1Rounding number value
indicators: name:hidebooleanoptionalv2.5.0Hide indicator, default value False
indicators: name:hidefunctionoptionalv2.5.0Custom hide indicator function
indicators: name:sourcenumberoptionalv1.0.1Data source
indicators: name:source:entitystringoptionalv1.0.1Indicator entity_id
indicators: name:source:attributestringoptionalv1.0.1Entity attribute
indicators: name:source:mapperfunctionoptionalv1.0.1Value processing function
indicators: name:tap_actionaction objecttruev1.1.0Action on click/tap
buttonsobjectoptionalv1.0.1Any buttons, example
buttons: nameobjectoptionalv1.0.1The name of your button see examples
buttons: name:iconstringoptionalv1.0.1Specify a custom icon from any of the available mdi icons
buttons: name:typestringoptionalv1.0.1dropdown or button default button
buttons: name:ordernumberoptionalv1.0.1Sort order
buttons: name:locationstringoptionalv1.2.1Allows you to display buttons on the main panel, types main, bottom, default bottom
buttons: name:stateobjectoptionalv1.0.1Config to get button state
buttons: name:state:entitystringoptionalv1.0.1Button entity_id
buttons: name:state:attributestringoptionalv1.0.1Entity attribute
buttons: name:state:mapperfunctionoptionalv1.0.1State processing function
buttons: name:disabledfunctionoptionalv1.0.1Calc disabled button
buttons: name:hidebooleanoptionalv2.5.0Hide button, default value False
buttons: name:hidefunctionoptionalv2.5.0Custom hide button function
buttons: name:activefunctionoptionalv1.0.1For type dropdown
buttons: name:sourceobjectoptionalv1.0.1For type dropdown
buttons: name:source:itemstringoptionalv1.0.1Source item, format horizontal: horizontal
buttons: name:source:__filterfunctionoptionalv1.0.1Filter function
buttons: name:change_actionfunctionoptionalv1.0.1For type dropdown
buttons: name:toggle_actionfunctionoptionalv1.0.1For type button
buttons: name:stylefunctionoptionalv1.0.1Styles
tap_actionaction objecttruev1.0.4Action on click/tap, tap_action
scalenumberoptionalv1.0.1UI scale modifier, default is 1

temperature

Functions available:

NameTypeexecution contextargumentsreturn type
hide_current_temperaturefunctionvalue, entity, target_entity, climate_entity, hvac_modeboolean

value - temperature value
entity - temperature entity
target_entity - target temperature entity
climate_entity - climate entity hvac_mode - current hvac_mode

Configuration example for the temperature:

type: custom:mini-climate
entity: climate.my_ac
hide_current_temperature: >
  (value) => value < 20
temperature:
  unit: '°C'
  round: 1
  # use an external temperature sensor
  source:
    entity: sensor.temperature

target_temperature

Functions available for the target_temperature:

NameTypeexecution contextargumentsreturn type
change_actionfunctiontarget_temperature configvalue, entity, climate_entitypromise

value - target_temperature value
entity - target_temperature entity
climate_entity - climate entity

execution context methods:

Nameargumentsdescriptionreturn type
toggle_statestatetoggle state, example: this.toggle_state('on') => offstring
call_servicedomain, service, options,call Home Assistant servicepromise

Configuration example for the target_temperature:

type: custom:mini-climate
entity: climate.my_ac
target_temperature:
  icons:
    up: mdi:chevron-up
    down: mdi:chevron-down
  unit: '°C'
  min: 16
  max: 31
  step: 0.5
  change_action: >
    (value, entity) => this.call_service('climate', 'set_temperature', { entity_id: entity.entity_id, temperature: value })

hvac_mode

Functions available for the hvac_mode:

NameTypeexecution contextargumentsreturn type
state:mapperfunctionhvac_mode configstate, entity, climate_entityany
activefunctionhvac_mode configstate, entity, climate_entityboolean
change_actionfunctionhvac_mode configselected, entity, climate_entityany
stylefunctionhvac_mode configvalue, entity, climate_entityobject
source:__filterfunctionhvac_mode configsource, state, entity, climate_entityobject({ id..., name...,... }) array
hidefunctionhvac_mode configstate, entity, climate_entityboolean

state - current hvac state
selected - selected value
entity - hvac entity
climate_entity - current climate entity

execution context methods:

Nameargumentsdescriptionreturn type
toggle_statestatetoggle state, example: this.toggle_state('on') => offstring
call_servicedomain, service, options,call Home Assistant servicepromise

Configuration example for the hvac_mode:

type: custom:mini-climate
entity: climate.my_ac
hvac_mode:
  style: "(value, entity) => ({ color: 'black !important' })"
  hide: >
    (state) => state === 'dry'
  source:
    'off':
      icon: mdi:power
      name: 'off'
    heat:
      icon: mdi:weather-sunny
      name: heat
    auto:
      icon: mdi:cached
      name: auto
    cool:
      icon: mdi:snowflake
      name: cool
    dry:
      icon: mdi:water
      name: dry
    fan_only:
      icon: mdi:fan
      name: fan
  change_action: >
    (selected, entity) => this.call_service('climate', 'set_hvac_mode', { entity_id: entity.entity_id, hvac_mode: selected })

fan_mode

Functions available for the fan_mode:

NameTypeexecution contextargumentsreturn type
state:mapperfunctionbutton configstate, entity, climate_entity, hvac_modeany
source:__filterfunctionbutton configsource, state, entity, climate_entity, hvac_modeobject({ id..., name... }) array
activefunctionbutton configvalue, entity, climate_entity, hvac_modeboolean
disabledfunctionbutton configvalue, entity, climate_entity, hvac_modeboolean
stylefunctionbutton configvalue, entity, climate_entity, hvac_modeobject
change_actionfunctionbutton configselected_value, entity, climate_entity, hvac_modepromise
hidefunctionbutton configstate, entity, climate_entity, hvac_modeboolean

state - current button state value
entity - button entity
climate_entity - climate entity
hvac_mode - current hvac_mode
source - dropdown source object array: [ { id: 'id', name: 'name' }, ... ]
selected_value - selected dropdown value

execution context methods:

Nameargumentsdescriptionreturn type
toggle_statesatetoggle state, example: this.toggle_state('on') => offstring
call_servicedomain, service, options,call Home Assistant servicepromise

Configuration example for the fan_mode:

type: custom:mini-climate
entity: climate.my_ac
fan_mode:
  hide: >
    (state) => state === 'low'
  icon: mdi:fan
  order: 0
  active: (state, entity) => entity.state !== 'off'
  source:
    auto: auto
    low: low
    medium: medium
    high: high
    # filter usage example
    __filter: >
      (source, state, entity) => entity.attributes
        .fan_modes_al.map(fan_mode => source.find(s => s.id === fan_mode))
        .filter(fan_mode=>fan_mode)
  change_action: >
    (selected, state, entity) => this.call_service('climate', 'set_fan_mode', { entity_id: entity.entity_id, fan_mode: selected })

Indicators

The indicators display additional information on the card, for example, you can display humidity, consumption, etc.
Adding a simple indicator:

type: custom:mini-climate
entity: climate.my_ac
indicators:
  humidity:
    icon: mdi:water
    unit: '%'
    round: 1
    source:
      entity: sensor.humidity
indicator functions

Consider configuring an indicator using javascript Functions available for the indicator:

NameTypeexecution contextargumentsreturn type
source:mapperfunctionindicator configvalue, entity, climate_entity, hvac_modeany
icon:templatefunctionindicator configvalue, entity, climate_entity, hvac_modestring
icon:stylefunctionindicator configvalue, entity, climate_entity, hvac_modeobject
value:stylefunctionindicator configvalue, entity, climate_entity, hvac_modeobject
hidefunctionindicator configvalue, entity, climate_entity, hvac_modeboolean

value - current indicator value
entity - indicator entity
climate_entity - climate entity hvac_mode - current hvac_mode

source mapper

Using the mapper function, you can change the indicator value:

type: custom:mini-climate
entity: climate.my_ac
indicators:
  power:
    icon: mdi:power-plug
    source:
      values:
        'on': 'power is on!'
        'off': 'power is off!'
      entity: switch.ac_power
      # since the current execution context is an indicator config, we can use this.source.values to get values
      mapper: value => this.source.values[value]
      # example of using all function arguments
      # mapper: >
      #   (value, entity, climate_entity, hvac_mode) => {
      #     console.log(value);
      #     console.log(entity);
      #     console.log(climate_entity);
      #     console.log(hvac_mode);
      #     console.log(this);
      #     return ...
      #   }
icon template

The indicator icon can be calculated dynamically for example:

type: custom:mini-climate
entity: climate.my_ac
indicators:
  humidity:
    icon:
      template: >
        (value) => (value > 30 ? 'mdi:weather-rainy' : 'mdi:water')
    unit: '%'
    round: 1
    source:
      entity: sensor.humidity
icon style

You can also set custom styles. for example:

type: custom:mini-climate
entity: climate.my_ac
indicators:
  humidity:
    icon:
      template: () => 'mdi:water'
      style: >
        (value) => (value > 30 ? { color: 'red'} : {})
    unit: '%'
    round: 1
    source:
      entity: sensor.humidity
value style

You can also set custom styles. for example:

type: custom:mini-climate
entity: climate.my_ac
indicators:
  humidity:
    value:
      style: >
        (value) => (value > 30 ? { color: 'red'} : {})
    unit: '%'
    round: 1
    source:
      entity: sensor.humidity
Hide

You can also hide based on state. for example:

type: custom:mini-climate
entity: climate.my_ac
indicators:
  humidity:
    hide: >
      (value) => value < 20
    unit: '%'
    round: 1
    source:
      entity: sensor.humidity

Buttons

You can add various buttons, supported types: button and dropdown

buttons functions
NameTypeexecution contextargumentsreturn type
state:mapperfunctionbutton configstate, entity, climate_entity, hvac_modeany
source:__filterfunctionbutton configsource, state, entity, climate_entity, hvac_modeobject({ id..., name... }) array
activefunctionbutton configvalue, entity, climate_entity, hvac_modeboolean
disabledfunctionbutton configvalue, entity, climate_entity, hvac_modeboolean
stylefunctionbutton configvalue, entity, climate_entity, hvac_modeobject
toggle_actionfunctionbutton configstate, entity, climate_entity, hvac_modepromise
change_actionfunctionbutton configselected_value, entity, climate_entity, hvac_modepromise
hidefunctionbutton configstate, entity, climate_entity, hvac_modeboolean

state - current button state value
entity - button entity
climate_entity - climate entity
hvac_mode - current hvac_mode
source - dropdown source object array: [ { id: 'id', name: 'name' }, ... ]
selected_value - selected dropdown value

execution context methods:

Nameargumentsdescriptionreturn type
toggle_statesatetoggle state, example: this.toggle_state('on') => offstring
call_servicedomain, service, options,call Home Assistant servicepromise

Consider an example swing_mode configuration:

type: custom:mini-climate
entity: climate.my_ac
buttons:
  swing_mode:
    type: dropdown
    icon: mdi:approximately-equal
    state:
      attribute: swing_mode
    active: state => state !== 'off'
    source:
      'off': Off
      horizontal: On
    change_action: >
      (selected, state, entity) => this.call_service('climate', 'set_swing_mode', { entity_id: entity.entity_id, swing_mode: selected })
button

Consider the example of adding buttons:

type: custom:mini-climate
entity: climate.my_ac
buttons:
  power:
    icon: mdi:power-plug
    state:
      entity: switch.ac_power
# for the button type, if no toggle_action is specified, the switch.toggle method is called
type: custom:mini-climate
entity: climate.my_ac
buttons:
  turbo:
    icon: mdi:weather-hurricane
    hide: >
      (state, entity) => !entity.attributes.turbo_al
    state:
      attribute: turbo
      mapper: "state => (state ? 'on': 'off')"
    disabled: (state, entity) => !entity.attributes.turbo_al
    toggle_action: >
      (state) => this.call_service('mqtt', 'publish', { payload: this.toggle_state(state), topic: 'my_ac/turbo/set', retain: false, qos: 1 })

tap action object

NameTypeDefaultOptionsDescription
actionstringmore-infomore-info / navigate / call-service / fire-dom-event / url / noneAction to perform.
entitystringAny entity idOverride default entity of more-info, when action is defined as more-info.
servicestringAny serviceService to call (e.g. fan.turn_on) when action is defined as call-service
service_dataobjectAny service dataService data to include with the service call.
navigation_pathstringAny pathPath to navigate to (e.g. /lovelace/0/) when action is defined as navigate.
urlstringAny URLURL to open when action is defined as url.

tap action example

# toggle example
# call-service example
type: custom:mini-climate
entity: climate.my_ac
tap_action:
  action: call-service
  service: climate.set_hvac_mode
  service_data:
    entity_id: climate.my_ac
    hvac_mode: 'off'

# fire-dom-event + browser mod example
type: custom:mini-climate
entity: climate.my_ac
tap_action:
  action: fire-dom-event
  browser_mod:
    service: browser_mod.popup
    data:
      title: My title
      content: test

# navigate example
type: custom:mini-climate
entity: climate.my_ac
tap_action:
  action: navigate
  navigation_path: '/lovelace/4'

# navigate example
type: custom:mini-climate
entity: climate.my_ac
tap_action:
  action: url
  url: 'https://www.google.com/'

# none example
type: custom:mini-climate
entity: climate.my_ac
tap_action: none

# more-info for custom entity example
type: custom:mini-climate
entity: climate.my_ac
tap_action:
  action: more-info
  entity: sensor.humidity

secondary info

secondary info functions
NameTypeexecution contextargumentsreturn type
hidefunctionsecondary info configclimate_entity, hvac_modeboolean

climate_entity - climate entity
hvac_mode - current hvac_mode

type: custom:mini-climate
entity: climate.dahatsu
secondary_info: last-changed

type: custom:mini-climate
entity: climate.dahatsu
secondary_info:
  type: fan-mode
  icon: 'mdi:fan'
  hide: >
    (climate_entity) => !climate_entity.attributes.turbo_al

type: custom:mini-climate
entity: climate.dahatsu
secondary_info: hvac-mode

toggle

toggle functions
NameTypeexecution contextargumentsreturn type
hidefunctiontoggle configclimate_entity, hvac_modeboolean

climate_entity - climate entity
hvac_mode - current hvac_mode

type: custom:mini-climate
entity: climate.dahatsu
toggle:
  default: true
  icon: 'mdi:fan'
  hide: >
    (climate_entity) => !climate_entity.attributes.turbo_al
hvac-action type

By default, translations from ha frontend

type: custom:mini-climate
entity: climate.dahatsu
secondary_info:
  type: hvac-action

but you can customize your translations

type: custom:mini-climate
entity: climate.dahatsu
secondary_info:
  type: hvac-action
  source:
    cooling: Охлаждение

You can set your own icon for each hvac-action

type: custom:mini-climate
entity: climate.dahatsu
secondary_info:
  type: hvac-action
  source:
    cooling:
      icon: 'mdi:snowflake'
      name: Охлаждение

You can set your own icon for each hvac-action

type: custom:mini-climate
entity: climate.dahatsu
secondary_info:
  type: hvac-action
  source:
    cooling:
      icon: 'mdi:snowflake'
      name: Охлаждение

Or you can use one permanent icon

type: custom:mini-climate
entity: climate.dahatsu
secondary_info:
  type: hvac-action
  icon: 'mdi:cached'
fan-mode-dropdown
type: custom:mini-climate
entity: climate.dahatsu
secondary_info: fan-mode-dropdown

image

Theme variables

The following variables are available and can be set in your theme to change the appearence of the card. Can be specified by color name, hexadecimal, rgb, rgba, hsl, hsla, basically anything supported by CSS.

nameDefaultDescription
mini-climate-name-font-weight400Font weight of the entity name
mini-climate-info-font-weight300Font weight of the states
mini-climate-icon-color--mini-humidifier-base-color, var(--paper-item-icon-color, #44739e)The color for icons
mini-climate-button-color--mini-humidifier-button-color, var(--paper-item-icon-color, #44739e)The color for buttons icons
mini-climate-accent-colorvar(--accent-color)The accent color of UI elements
mini-climate-base-colorvar(--primary-text-color) & var(--paper-item-icon-color)The color of base text
mini-climate-background-opacity1Opacity of the background
mini-climate-scale1Scale of the card
mini-climate-card-box-shadowvar(--ha-card-box-shadow, none)The card shadow

My configuration

I originally wrote a plugin for my air conditioner implementation using esphome if interested, you can source esphome-mqtt-climate the following is a configuration example for my air conditioner

type: custom:mini-climate
entity: climate.dahatsu
name: Кондиционер
fan_mode:
  source:
    auto: Авто
    low: Слабый
    medium: Средний
    high: Сильный
    # for my implementation fan_modes_al is an array of available fan modes of the selected hvac mode
    __filter: >
      (source, state, entity) => entity.attributes
        .fan_modes_al.map(fan_mode => source.find(s => s.id === fan_mode))
        .filter(fan_mode => fan_mode)
buttons:
  swing_mode:
    type: dropdown
    icon: mdi:approximately-equal
    state:
      attribute: swing_mode
    # the drop-down list will remain active until swing_mode is off
    active: state => state !== 'off'
    source:
      'off': Выкл
      horizontal: Вкл
    change_action: >
      (selected, state, entity) => this.call_service('climate', 'set_swing_mode', { entity_id: entity.entity_id, swing_mode: selected })
  # turbo air conditioning button
  turbo:
    icon: mdi:weather-hurricane
    # control topic
    topic: 'dahatsu/turbo/set'
    state:
      attribute: turbo
      # for my device, the turbo attribute returns boolean type, convert it to on or off
      mapper: "(state, entity) => state ? 'on': 'off'"
    # turbo button is not available for all modes, block it when it is not available
    disabled: (state, entity) => !entity.attributes.turbo_al
    # when you click on the button, send the event to mqtt
    toggle_action: >
      (state) => this.call_service('mqtt', 'publish', { payload: this.toggle_state(state), topic: this.topic, retain: false, qos: 1 })
  # eco button configuration is the same as for turbo button
  eco:
    icon: mdi:leaf
    topic: 'dahatsu/eco/set'
    state:
      attribute: eco
      mapper: "(state, entity) => state ? 'on': 'off'"
    disabled: (state, entity) => !entity.attributes.eco_al
    toggle_action: >
      (state) => this.call_service('mqtt', 'publish', { payload: this.toggle_state(state), topic: this.topic, retain: false, qos: 1 })
  # health button configuration is the same as for turbo button
  health:
    icon: mdi:emoticon-happy-outline
    topic: 'dahatsu/health/set'
    state:
      attribute: health
      mapper: "(state, entity) => state ? 'on': 'off'"
    disabled: (state, entity) => !entity.attributes.health_al
    toggle_action: >
      (state) => this.call_service('mqtt', 'publish', { payload: this.toggle_state(state), topic: this.topic, retain: false, qos: 1  })
  # power off button
  power_switch:
    icon: mdi:power-plug
    state:
      entity: switch.air_conditioner_kitchen_switch_l1
indicators:
  # humidity indicator
  humidity:
    icon: mdi:water
    unit: '%'
    round: 1
    source:
      entity: sensor.sensor_temp_hum_pre_kitchen_humidity
  # power consumption indicator
  power_consumption:
    icon: mdi:flash
    unit: 'W'
    round: 1
    source:
      entity: sensor.dahatsu_power
  # power indicator
  power:
    icon: mdi:power-plug
    source:
      entity: switch.air_conditioner_kitchen_switch_l1
      values:
        'on': 'вкл'
        'off': 'выкл'
    # localization of values
    mapper: value => this.source.values[value]

Development

If you plan to contribute back to this repo, please fork & create the PR against the dev branch.

Clone this repository into your config/www folder using git.

$ git clone https://github.com/artem-sedykh/mini-climate-card.git

Add a reference to the card in your ui-lovelace.yaml.

resources:
  - url: /local/mini-humidifier/dist/mini-climate-card-bundle.js
    type: module

Instructions

Requires nodejs & npm

  1. Move into the mini-climate-card repo, checkout the dev branch & install dependencies.
$ cd mini-climate-card-dev && git checkout dev && npm install
  1. Make changes to the source

  2. Build the source by running

$ npm run build
  1. Refresh the browser to see changes

    Make sure cache is cleared or disabled

  2. (Optional) Watch the source and automatically rebuild on save

$ npm run watch

The new mini-climate-card-bundle.js will be build and ready inside /dist.

Getting errors?

Make sure you have javascript_version: latest in your configuration.yaml under frontend:.

Make sure you have the latest version of mini-climate-card-bundle.js.

If you have issues after updating the card, try clearing your browsers cache or restart Home Assistant.

If you are getting "Custom element doesn't exist: mini-climate" or running older browsers try replacing type: module with type: js in your resource reference, like below.

resources:
  - url: ...
    type: js

License

This project is under the MIT license.