Skip to content

Temperature Chip

Description

example-image

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

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"
  triggers_update: "all"
  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 = states[variables.ulm_chip_temperature_inside].state;
      return (icon[state] || icon["default"]) + " " + convertTemperature(outside_temp) + "° / " + convertTemperature(inside_temp) + "°" ;
    ]]]