Room climate: finished
{%- assign temperature = cap.measure_temperature.value -%}<p class="name">{{ settings.label | default: device.name }}</p>{% if device.available == false %} <p class="state">Unavailable</p>{% elsif temperature == nil %} <p class="state">No reading yet</p>{% else %} <button class="reading" data-hd-on-click="openHistory('measure_temperature', '24h')"> {{ temperature | temp: 1 }} </button> {% if cap.measure_humidity.value != nil %} <p class="extra">{{ cap.measure_humidity.text }}{{ cap.measure_humidity.unit }} humidity</p> {% endif %}{% endif %}The preview runs on a made-up sensor.climate device, so you don’t need a Homey. Edit the template or style to try something; actions don’t reach a device here.
Files
{%- assign temperature = cap.measure_temperature.value -%}<p class="name">{{ settings.label | default: device.name }}</p>{% if device.available == false %} <p class="state">Unavailable</p>{% elsif temperature == nil %} <p class="state">No reading yet</p>{% else %} <button class="reading" data-hd-on-click="openHistory('measure_temperature', '24h')"> {{ temperature | temp: 1 }} </button> {% if cap.measure_humidity.value != nil %} <p class="extra">{{ cap.measure_humidity.text }}{{ cap.measure_humidity.unit }} humidity</p> {% endif %}{% endif %}:host { display: grid; align-content: center; gap: 4px; padding: 12px; container-type: size;}p { margin: 0;}.name { font: 600 13px var(--hd-font-ui); color: var(--hd-text-muted);}.reading { font: var(--hd-number-weight) clamp(24px, 40cqh, 56px) / 1 var(--hd-font-display); color: var(--hd-text); /* A button that looks like the number it shows. */ justify-self: start; padding: 0; text-align: start; background: none; border: 0; cursor: pointer;}.extra { font-size: 13px; color: var(--hd-text-muted);}.state { font: 600 17px var(--hd-font-ui); color: var(--hd-text-muted);}.reading:focus-visible { outline: 2px solid var(--hd-accent); outline-offset: 4px; border-radius: 4px;}/* A small tile keeps the temperature and drops the rest. */@container (height < 110px) { .extra { display: none; }}{ "id": "@your-handle/room-climate", "title": "Room climate", "summary": "A Tiledash developer example.", "version": "1.0.0", "licence": "MIT", "tags": [], "kind": "widget", "widget": { "kind": "device", "match": { "requires": [ "measure_temperature" ], "optional": [ "measure_humidity", "measure_co2", "measure_battery", "alarm_battery" ] }, "size": { "default": [ 3, 4 ], "min": [ 1, 1 ], "max": [ 6, 8 ] }, "align": { "y": "end" }, "settings": [ { "name": "label", "label": "Label", "required": false, "group": "content", "type": "text", "default": "", "maxLength": 80, "multiline": false } ], "basedOn": "sensor.climate" }}Use it
In the editor, start from the widget it’s based on and paste the template and style; or unzip the package, replace your-handle with your name in the Community and publish it. Build your first widget walks through both.