Tabs
Split readings over tabs, remembering the chosen one in state.
<hd-tabs label="Room" selected="{{ state.tab }}" data-hd-on-change="setState('tab', event.value)"> <hd-tab name="now" label="Now"> <p class="big">{{ cap.measure_temperature.value | temp: 1 }}</p> <p class="sub">{{ device.name }}</p> </hd-tab> <hd-tab name="air" label="Air"> {% render 'value-row', label: 'Humidity', value: cap.measure_humidity.text, unit: cap.measure_humidity.unit %} {% render 'value-row', label: 'CO₂', value: cap.measure_co2.text, unit: cap.measure_co2.unit %} </hd-tab></hd-tabs>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
<hd-tabs label="Room" selected="{{ state.tab }}" data-hd-on-change="setState('tab', event.value)"> <hd-tab name="now" label="Now"> <p class="big">{{ cap.measure_temperature.value | temp: 1 }}</p> <p class="sub">{{ device.name }}</p> </hd-tab> <hd-tab name="air" label="Air"> {% render 'value-row', label: 'Humidity', value: cap.measure_humidity.text, unit: cap.measure_humidity.unit %} {% render 'value-row', label: 'CO₂', value: cap.measure_co2.text, unit: cap.measure_co2.unit %} </hd-tab></hd-tabs>:host { display: block;}.big { margin: 8px 0 0; font: var(--hd-number-weight) 48px / 1 var(--hd-font-display);}.sub { margin: 0; font: 13px var(--hd-font-ui); color: var(--hd-text-muted);}{ "id": "@your-handle/climate-tabs", "title": "Tabs", "summary": "Split readings over tabs, remembering the chosen one in state.", "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: Components · Actions