Custom-chip Tesla Temperature
¶
Information¶
Custom-chip Tesla Temperature
is a chip showing the status of set temperature and current inside temperature.
Changelog¶
1.0.0
Initial releaseUsage¶
- type: "custom:button-card"
template: custom_chip_tesla_temperature
variables:
ulm_chip_hvac: climate.tesla_hvac_climate_system
Requirements¶
Variables¶
Variable | Default | Required | Explanation |
---|---|---|---|
ulm_chip_hvac | Yes | Tesla hvac entity |
Template code¶
---
custom_chip_tesla_temperature:
template:
- "chip_icon_label"
- "ulm_translation_engine"
variables:
ulm_card_enable_popup: false
triggers_update: "all"
label: |
[[[
function convertTemperature(temp) {
if (parseFloat(temp) == temp && Math.floor(temp) != temp) {
return parseFloat(temp).toFixed(1);
}
return temp;
}
var set_temp = states[variables.ulm_chip_hvac].attributes.temperature;
var inside_temp = states[variables.ulm_chip_hvac].attributes.current_temperature;
var label = "Set " + convertTemperature(set_temp) + "°" + " / Current " + convertTemperature(inside_temp) + "°";
return label;
]]]
icon: |
[[[
var preset = states[variables.ulm_chip_hvac].attributes.preset_mode.toLowerCase();
var icon = {
"normal": "mdi:thermometer",
"defrost": "mdi:snowflake-melt",
"keep on": "mdi:heat-wave",
"dog mode": "mdi:dog-side",
"camp mode": "mdi:campfire",
"default": "mdi:thermometer"
}
return (icon[preset] || icon["default"]);
]]]