Skip to content

Every reading in a list

Loop over all of a device’s capabilities.

all-readings.liquid
<h2 class="title">{{ device.name }}</h2><ul class="list">  {% for entry in cap %}    {% assign reading = entry[1] %}    <li>      {% render 'value-row', label: reading.title, value: reading.text, unit: reading.unit %}    </li>  {% endfor %}</ul>

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

Download the package

template.liquid
<h2 class="title">{{ device.name }}</h2><ul class="list">  {% for entry in cap %}    {% assign reading = entry[1] %}    <li>      {% render 'value-row', label: reading.title, value: reading.text, unit: reading.unit %}    </li>  {% endfor %}</ul>
style.css
:host {  display: flex;  flex-direction: column;  gap: 8px;}.title {  margin: 0;  font: 600 15px var(--hd-font-ui);}.list {  display: grid;  gap: 6px;  margin: 0;  padding: 0;  list-style: none;}
tiledash.json
{  "id": "@your-handle/all-readings",  "title": "Every reading in a list",  "summary": "Loop over all of a device’s capabilities.",  "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: Liquid · Partials