Comfort with details
Tap the number to swap a sparkline for more readings.
{% let temp = cap.measure_temperature.value %}{% let humidity = cap.measure_humidity.value %}{% let tone = temp < 19 ? 'cool' : temp > 24 ? 'warm' : 'ok' %}<header class="head"> <hd-icon name="device.temperature"></hd-icon> <span class="name">{{ device.name }}</span> <span class="feel" data-tone="{{ tone }}"> {% if tone == 'cool' %}Cool{% elsif tone == 'warm' %}Warm{% else %}Comfortable{% endif %} </span></header><button class="now" data-hd-on-click="toggleState('air')" aria-expanded="{% if state.air %}true{% else %}false{% endif %}"> <span class="big">{{= round(temp, 1) }}°</span> <span class="sub"> {{ humidity | round }} % humidity {% if humidity > 60 and temp > 22 %}· muggy{% endif %} </span></button>{% if state.air %} {% render 'value-row', label: 'CO₂', value: cap.measure_co2.text, unit: cap.measure_co2.unit %} {% render 'value-row', label: 'Humidity', value: cap.measure_humidity.text, unit: cap.measure_humidity.unit %}{% else %} <hd-sparkline variant="area"> <hd-series bind="{{ cap.measure_temperature }}"></hd-series> </hd-sparkline>{% 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
{% let temp = cap.measure_temperature.value %}{% let humidity = cap.measure_humidity.value %}{% let tone = temp < 19 ? 'cool' : temp > 24 ? 'warm' : 'ok' %}<header class="head"> <hd-icon name="device.temperature"></hd-icon> <span class="name">{{ device.name }}</span> <span class="feel" data-tone="{{ tone }}"> {% if tone == 'cool' %}Cool{% elsif tone == 'warm' %}Warm{% else %}Comfortable{% endif %} </span></header><button class="now" data-hd-on-click="toggleState('air')" aria-expanded="{% if state.air %}true{% else %}false{% endif %}"> <span class="big">{{= round(temp, 1) }}°</span> <span class="sub"> {{ humidity | round }} % humidity {% if humidity > 60 and temp > 22 %}· muggy{% endif %} </span></button>{% if state.air %} {% render 'value-row', label: 'CO₂', value: cap.measure_co2.text, unit: cap.measure_co2.unit %} {% render 'value-row', label: 'Humidity', value: cap.measure_humidity.text, unit: cap.measure_humidity.unit %}{% else %} <hd-sparkline variant="area"> <hd-series bind="{{ cap.measure_temperature }}"></hd-series> </hd-sparkline>{% endif %}:host { display: flex; flex-direction: column; gap: 6px;}.head { display: flex; align-items: center; gap: 8px; font: 500 11px var(--hd-font-mono); letter-spacing: var(--hd-label-tracking); text-transform: var(--hd-label-transform); color: var(--hd-text-muted);}.name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}.feel { font: 600 12px var(--hd-font-ui); text-transform: none; letter-spacing: 0; color: var(--hd-text);}.feel[data-tone='cool'] { color: var(--hd-cool);}.feel[data-tone='warm'] { color: var(--hd-warn);}.now { display: flex; flex-direction: column; align-items: flex-start; margin-top: auto; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer;}.big { font: var(--hd-number-weight) 52px / 1 var(--hd-font-display);}.sub { font: 13px var(--hd-font-ui); color: var(--hd-text-muted);}hd-sparkline { height: 40px;}{ "id": "@your-handle/room-comfort", "title": "Comfort with details", "summary": "Tap the number to swap a sparkline for more readings.", "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": "tileTap", "label": "The tile", "required": false, "group": "tap", "type": "tap", "gesture": "tap", "default": { "type": "none" }, "hold": { "type": "device" }, "double": { "type": "none" }, "allow": [ "toggle", "device", "dashboard", "flow", "mood", "variable", "request" ] }, { "name": "temperatureTap", "label": "Temperature", "required": false, "group": "tap", "type": "tap", "gesture": "tap", "default": { "type": "none" }, "hold": { "type": "none" }, "double": { "type": "none" }, "allow": [ "toggle", "device", "history", "dashboard", "flow", "mood", "variable", "request" ], "capability": "measure_temperature" }, { "name": "humidityTap", "label": "Humidity", "required": false, "group": "tap", "type": "tap", "gesture": "tap", "default": { "type": "none" }, "hold": { "type": "none" }, "double": { "type": "none" }, "allow": [ "toggle", "device", "history", "dashboard", "flow", "mood", "variable", "request" ], "capability": "measure_humidity" } ], "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.
Read more: Expressions · Actions · Components