Skip to content

Temperature Chip

Description

example-image

This chip is to display a weather icon together with the outside and inside temperature, where the latter is optional.

Variables

Variable Default Required Notes
ulm_chip_temperature_outside This is the sensor that provides your outside temperature. If you want to use eg. a temperature value from your weather provider, you'd need to setup a template sensor first. The state of this sensor should represent a numeric value (°C or °F doesn't matter).
ulm_chip_temperature_inside This is the sensor that provides your inside temperature. The state of this sensor should represent a numeric value (°C or °F doesn't matter).
ulm_chip_temperature_weather This is the sensor for your weather entity for showing current weather conditions

Usage

- type: 'custom:button-card'
  template: chip_temperature
  variables:
    ulm_chip_temperature_inside: sensor.my_temperature_sensor_inside
    ulm_chip_temperature_outside: sensor.my_temperature_sensor_outside
    ulm_chip_temperature_weather: weather.my_weather_provider
Template Code
chip_temperature.yaml
---
### Chip Temperature ###
chip_temperature:
  template:
    - "chips"
    - "ulm_actions_card"
  variables:
    ulm_card_weather_enable_popup: false
  triggers_update:
    - "[[[ return variables.ulm_chip_temperature_weather ]]]"
    - "[[[ return variables.ulm_chip_temperature_outside ]]]"
    - "[[[ return variables.ulm_chip_temperature_inside ]]]"
  label: |
    [[[
      var state = states[variables.ulm_chip_temperature_weather].state;
      var icon = {
        "clear-night": "🌙",
        "cloudy": "☁️",
        "exceptional": "🌞",
        "fog": "🌫️",
        "hail": "⛈️",
        "lightning": "⚡",
        "lightning-rainy": "⛈️",
        "partlycloudy": "⛅",
        "pouring": "🌧️",
        "rainy": "💧",
        "snowy": "❄️",
        "snowy-rainy": "🌨️",
        "sunny": "☀️",
        "windy": "🌪️",
        "default": "🌡️"
        }
      function convertTemperature(temp) {
        if (parseFloat(temp) == temp && Math.floor(temp) != temp) {
            return parseFloat(temp).toFixed(1);
        }
        return temp;
      }
      var outside_temp = states[variables.ulm_chip_temperature_outside].state;
      var inside_temp = null;
      if (variables.ulm_chip_temperature_inside) {
        inside_temp = states[variables.ulm_chip_temperature_inside].state;
      }
      var label = (icon[state] || icon["default"]) + " " + convertTemperature(outside_temp) + "°";
      if (inside_temp) {
        label = label + " / " + convertTemperature(inside_temp) + "°";
      }
      return label;
    ]]]