• Stars
    star
    743
  • Rank 61,046 (Top 2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 6 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A different take on the thermostat card for Home Assistant ♨️

Lovelace simple thermostat card

hacs_badge

A different take on the thermostat card for Home Assistant Lovelace UI. The aim is to provide a card with simpler interactions that are easier to use and take up less space, as well as provide more modularity to tweak the card. For example the abiltity to embed sensor values that are relevant to your thermostat (like humidity, energy usage, hours on +++).

Example thermostat

Compact mode

Compact configuration

Hide everything but sensors and temperature control:

type: custom:simple-thermostat
entity: climate.hvac
layout:
  step: row
header: false
control: false

Note about 2.0 release

The 2.0 release is most likely a breaking change for the majority of users. Make sure you read the release notes and inspect the new configuration format. It offers more flexibility and features as well as a number of bug fixes.

Requirements

Home Assistant 0.84 or higher

Installation

  1. Install via HACS.
  2. Add to resources:
    url: /hacsfiles/simple-thermostat/simple-thermostat.js
    type: module
Manual install 1. Download the `simple-thermostat.js` from the [latest release](https://github.com/nervetattoo/simple-thermostat/releases/latest) and store it in your `configuration/www` folder. _Previously you could download the source file from Github but starting from the 0.14 release that is no longer possible. If you try to do so it will crash_ 2. Configure Lovelace to load the card:
resources:
  - url: /local/simple-thermostat.js?v=1
    type: module

Available configuration options:

  • entity string: The thermostat entity id required
  • header false|Header object: See section about header config
  • setpoints false|Setpoints object: See section about setpoints config
  • layout Layout object:
    • step row|column: Where to render the setpoint up/down buttons
    • mode object: Disable elements for all modes
      • names boolean
      • icons boolean
      • headings boolean
    • sensors: object
      • type: list|table: How to render the sensors
      • labels: boolean: Whether to show labels/headings or not. Hiding here overrides hiding under root level sensors config
  • service object: Must specify both domain+service if overriding
    • domain string: Override the service call domain
    • service string: Override the service call name
    • data object: Send extra data with the service call
  • unit string|bool: Override the unit to display. Set to false to hide unit
  • decimals number: Specify number of decimals to use: 1 or 0
  • fallback string: Specify a text to display if a valid set point can't be determined. Defaults to N/A
  • step_size number: Override the default 0.5 step size for increasing/decreasing the temperature
  • label object: Override untranslated labels
    • temperature: string Override Temperature label
    • state: string Override State label
  • hide object: Control specifically information fields to show. Defaults to showing everything
    • temperature: bool (Default to false)
    • state: bool (Default to false)
  • control object|array (From 0.27)
    • hvac|fan|preset|swing object|bool: The key of the mode type (hvac, preset, fan, swing)
      • _name string: Override the name of the mode type
      • _hide_when_off bool: Hides the mode type selection row when the entity is off. Defaults to false shown
      • {mode} string: Name of mode type to control
        • name string|bool: Specify a custom name or set to false to show only the icon
        • icon string|bool: Specify a custom icon or set to false to not show icon
  • sensors array|false
    • entity string: A sensor value entity id
    • name string: Specify a sensor name to use instead of the default friendly_name
    • icon string: Specify an icon to use instead of a name
    • attribute string: The key for an attribute to use instead of state. If this sensor has no entity it will use the main entity's attributes
    • unit string: When specifying an attribute you can manually set the unit to display
    • decimals number: If you know your sensors has a numeric value you can round it to a number of decimals.
    • type relativetime: Special data types that result in special handling.

Header config

New in 2.0. Old ways of defining toggle_entity, faults, name and icon are no longer supported

Hiding the entire header is done with header: false If you pass an object you can pass any of the following keys. Example:

header:
  name: Overriden name
  icon: mdi:sofa
  toggle:
    entity: switch.light
    name: Light
  faults:
    - entity: switch.light

Full header config spec:

  • name string: Override the card name. Default is to use the friendly_name of the thermostat provided
  • toggle object: An entity id to create a toggle in the header for. This gives the option to control a separate entity which can be related to the thermostat entity (like a switch, or input_boolean)
    • entity string: The entity id to create the header for
    • name string|bool: Set the label to be shown to the left of the toggle. Set to true to show the friendly name of the toggle_entity
  • faults array|false: Show fault conditions as active/inactive icons in the header
    • entity string: A binary sensor entity id
    • icon string: Override the entity icon
    • hide_inactive bool: Hide the fault icon when inactive (Default to false)
  • icon string|object: Show an icon next to the card name. You can also pass an object to specify specific icons. Current value is taken from attributes.hvac_action when available, or state as fallback.
    • auto: string Use this icon for hvac_action auto. Default mdi:radiator
    • cooling: string Use this icon for hvac_action cooling. Default mdi:snowflake
    • fan: string Use this icon for hvac_action fan. Default mdi:fan
    • heating: string Use this icon for hvac_action heating. Default mdi:radiator
    • idle: string: Use this icon for hvac_action idle. Default mdi:radiator-disabled
    • "off": string Use this icon for hvac_action off. Default mdi:radiator-off
    • auto: string Use this icon for state auto. Default hass:autorenew
    • cool: string Use this icon for state cooling. Default hass:snowflake
    • dry: string: Use this icon for state dry. Default hass:water-percent
    • fan_only: string Use this icon for state fan. Default hass:fan
    • heat: string Use this icon for state heat. Default hass:autorenew
    • heat_cool: string: Use this icon for state heat_cool. Default hass:fire
    • "off": string Use this icon for state off. Default hass:power

Setpoints config

New in 2.0. Old ways of hiding setpoints is deprecated

If you specify setpoints manually you must include all setpoints you want included. Normally there are only two possibilities here; temperature or target_temp_high + target_temp_low. Single or dual thermostats. But, theoretically there could be multiple setpoints and this aims to support any permutation. The new feature in 2.0 is the ability to hide one of the two setpoints for dual thermostats.

To manually specify to use the temperature attribute as a setpoint you do:

setpoints:
  temperature:

For dual thermostats:

setpoints:
  target_temp_low:
  target_temp_high:

To hide one of the dual setpoints:

setpoints:
  target_temp_low:
    hide: true
  target_temp_high:

For climate devices supporting more setpoints you can include as many as you like. Automatic detection of set points only work for the single/dual cases.

Usage of the control config

In 0.27, in order to both support changes in the climate domain and to support controlling all modes like hvac, preset, fan and swing modes the old modes configuration have been removed and replaced with a control config.

The control config is most easily explained using a few examples as it supports both a simplified definition using just an array to list the types of modes to control. By default, with no config, it will show hvac and preset (if the entity supports it). You can replicate the default manually like this:

control:
  - hvac
  - preset

This will list all modes for both types. You can get more fine grained control by switching to an object format and taking control of specific modes:

control:
  preset:
    away: true
    none:
      name: Not set

What is worth noticing is that there is no merging of the default any more, so with this config you will not get hvac_mode displayed. If you still want it to display like default you need to set:

control:
  preset:
    away: true
    none:
      name: Not set
  hvac: true

Please note that you need to quote off/on mode keys to not have them interprented as true/false.

control:
  hvac:
    off: will not work
    "off": works

Example usage:

cards:
  - type: 'custom:simple-thermostat'
    entity: climate.my_room
    step_size: 1
    sensors:
      - entity: sensor.fibaro_system_fgwpef_wall_plug_gen5_energy
      - entity: sensor.fibaro_system_fgwpef_wall_plug_gen5_power
        name: Energy today
      - attribute: min_temp
        name: Min temp
    header:
      faults:
        - entity: binary_sensor.my_room_communications_fault
        - entity: binary_sensor.my_room_low_battery_fault
          icon: mdi:battery-low
      toggle:
        entity: switch.pump_relay
    control:
      hvac:
        some_mode: false
        another_mode: false
        'off':
          name: Make it cold
          icon: false
        'on':
          name: false
          icon: mdi:whitewalker
cards:
  - type: 'custom:simple-thermostat'
    entity: climate.my_room
    step_size: 1
    sensors:
      - entity: sensor.fibaro_system_fgwpef_wall_plug_gen5_energy
    header:
      toggle:
        entity: switch.pump_relay
        name: Control the pump

CSS vars for theming

The card uses the following CSS variables:

Var name Default value Usage
--st-font-size-xl var(--paper-font-display3_-_font-size) Used for target temperature
--st-font-size-l var(--paper-font-display2_-_font-size) Unused at the moment
--st-font-size-m var(--paper-font-title_-_font-size) Used for target temperature unit
--st-font-size-title var(--ha-card-header-font-size, 24 Font size for card heading
--st-font-size-sensors var(--paper-font-subhead_-_font-size) Font size for sensors
--st-spacing 4px Base unit for spacing. Used in multiples many places
--st-mode-active-background var(--primary-color) Background color for active mode button
--st-mode-active-color var(--text-primary-color, #fff) Text color for active mode button
--st-mode-background #dff4fd Background color for inactive mode button
--st-toggle-label-color var(--text-primary-color) Text color for toggle label
--st-font-size-toggle-label var(--paper-font-subhead_-_font-size) Font size for toggle label
--st-fault-inactive-color var(--secondary-background-color) Icon color for inactive faults
--st-fault-active-color var(--accent-color) Icon color for active faults

These variables can be changed globally in the current theme or on each card via card-mod.

Example using custom theme

Example that makes everything smaller and more compact except sensors that gets blown up completely.

example-theme:
  st-font-size-xl: 24px
  st-font-size-m: 20px
  st-font-size-title: 20px
  st-font-size-sensors: 30px
  st-spacing: 2px

Example using card-mod

Same example as above, but will only apply to a single card.

type: 'custom:simple-thermostat'
style: |
  ha-card {
    --st-font-size-xl: 24px;
    --st-font-size-m: 20px;
    --st-font-size-title: 20px;
    --st-font-size-sensors: 30px;
    --st-spacing: 2px;
  }
  ...

More Repositories

1

banner-card

A fluffy banner card for Home Assistant 🥰
JavaScript
607
star
2

elasticsearch

Simple PHP client for ElasticSearch
PHP
342
star
3

jquery-autosave

JavaScript
154
star
4

backbone.touch

Enable faster click events on touch devices for Backbone views
JavaScript
147
star
5

backbone.keys

Backbone.keys brings the keyboard to your views
JavaScript
49
star
6

themable-grid

🀹 Lovelace responsive grid card that can be tweaked in your theme definition.
Svelte
30
star
7

aether

Modular PHP framework
PHP
11
star
8

li3_start

Quickstart repo for LIthium apps. jQuery, backbone, underscore and reset.css included
JavaScript
9
star
9

react-knit

Join arrays of data like a pro in React
JavaScript
9
star
10

tracker-json

Easily generate a tracker.json file for your Home Assistant custom cards on new releases
JavaScript
7
star
11

li3_twig

Fork of the Lithium Twig integration
PHP
5
star
12

sanity-plugin-mermaid

Add a Mermaid graph input type for Sanity CMS
JavaScript
5
star
13

node-handlebars-twig

Transpile Handlebars templates to Twig templates
JavaScript
4
star
14

li3_backbone

Dev/Testing blog site for Lithium
PHP
4
star
15

keymonitor

A simple php monitoring and logging system
PHP
4
star
16

no-humbug-es6

JavaScript
2
star
17

li3-request-signing

Lithium request signing tutorial code
PHP
2
star
18

teewatch

raymondjulin.com/teewatch
Ruby
2
star
19

aether-orm

Experimental ORM
PHP
2
star
20

jslides

jQuery slideshow/presentation plugin
JavaScript
2
star
21

rutetid

Rutesøk for Bergen
JavaScript
2
star
22

uib

All my obligatory school projects
Java
2
star
23

svineinfluensa

Little tool for reporting on swineflu stuff in Norway
Ruby
1
star
24

codekata

CodeKatas
PHP
1
star
25

Bergenbudsjett

PHP
1
star
26

KeySMS-PHP

PHP Client for KeySMS API
PHP
1
star
27

li3_apps

Manage Lithium apps on a server
PHP
1
star
28

ez-minimal

Just a simple minimal-design for ez publish that also shows some building off eZ Exceed
PHP
1
star