Skip to content

A reusable partial

Draw a labelled reading with the built-in value-row partial.

Reusable reading row
{% render 'value-row', label: 'Temperature', value: cap.measure_temperature.text, unit: cap.measure_temperature.unit %}

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.

How it works

render puts a partial in the template with its own parameters. value-row is built in; your own partials go in the package’s partials folder and are rendered the same way.

A partial sees only the parameters you pass it, not the widget’s whole context.

Files

Download the package

template.liquid
{% render 'value-row', label: 'Temperature', value: cap.measure_temperature.text, unit: cap.measure_temperature.unit %}
style.css
:host {  display: flex;  flex-direction: column;  gap: 12px;  padding: 12px;}p {  margin: 0;}.reading {  font: var(--hd-number-weight) 36px var(--hd-font-display);}button {  color: var(--hd-text);  background: var(--hd-surface);  border: 1px solid var(--hd-border);  padding: 10px;  border-radius: var(--hd-control-radius);}
tiledash.json
{  "id": "@your-handle/partial-reading",  "title": "A reusable partial",  "summary": "Draw a labelled reading with the built-in value-row partial.",  "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: Partials · Liquid