Device State Table

The Device State Table allows you to display attribute data from one or more devices.

Device State Table

Configuration

Configuration for the Device State Table takes several properties.

Duration

To view only the current state of your device(s), select “Last received data point”. To view device states reported over a longer period, select any other option. This defaults to the global dashboard duration.

Device State Table Duration

Select Devices

Here you choose which devices are queried for data for the block in the form of a device query. Each reported state for each device is given a separate row in the table, and if a duration other than “Last received data point” is selected, a device displayed only if it has state reported within the the selected duration.

Device State Table Devices

Configure Table

Once you have selected the devices, you can now configure which columns to display in the block. You may add as many columns as you would like, and columns may be rearranged by dragging and dropping the headers of each column’s configuration panel.

Rendering Cells

Each column accepts a Header Template for rendering the table column header, and a Cell Template for rendering the contents of each cell in the column. Both inputs accept string templates and support limited Markdown.

In addition to the default dashboard render context and context variable values, the following variables are exposed to both the Header Template and Cell Template …

  • {{block.width}}: The current width, in pixels, of the block.
  • {{block.theme}}: The block’s theme (“light” or “dark”). This value matches the value of {{dashboard.themeName}}.
  • {{block.height}}: The current height, in pixels, of the block.
  • {{name}}: The value of the “Source” input from the column configuration. This is either the name of the selected attribute or the column type.

The following values are also exposed to the Cell Template …

  • {{deviceId}}: The WEGnology ID of the device represented by this row.
  • {{deviceName}}: The name of the device represented by this row.
  • {{deviceTags.TAG_NAME}}: The value of a device tag for the device represented by this row, where TAG_NAME can be replaced with the key of any tag on the device.
  • {{time}}: The timestamp of the attribute(s) being displayed in this row. This value is often used in conjunction with a {{formatDate}} helper.
  • {{value}}: The raw value for the column / device combination. This value varies depending on the column type.

Device State Table Column Configuration

Column Types

The following column types are available …

  • Attribute: Displays the value of a given attribute for a specific device at a specific timestamp. Your table must include at least one Attribute column.

    • {{value}} in these columns is the raw reported attribute value. It is often used in conjunction with other Format Helpers to produce a more human-readable result.
  • Timestamp: Displays the timestamp at which one or more of your table’s attributes were reported. A Timestamp column is automatically added to the table by default, though you may remove it if desired.

    • {{value}} in these columns is the timestamp at which the attribute(s) represented in the row were reported. It is often used in conjunction with a {{formatDate}} helper.
  • Device Name: Displays the name of the device being represented by this row. A Device Name column is automatically added to the table by default, though you may remove it if desired.

    • {{value}} is the name of the device represented by this row. It matches the value of {{deviceName}}.
  • Device ID: Displays the ID of the device being represented by this row.

    • {{value}} is the name of the ID represented by this row. It matches the value of {{deviceId}}.
  • Device Tags: Displays the value of a tag from the device being represented by this row.

    • {{value}} is a map of the row’s device’s tags; rendering the value of a tag requires referencing the name of the tag in the string template (i.e. {{value.TAG_NAME}}). The object matches the value of the {{deviceTags}} object.

When adding a new column, the Header Template defaults to {{name}} and the Cell Template defaults to {{format value}}, though additional values, format helpers, and Markdown may be applied as described above.

Default Table Sorting

After all columns have been added to your table, you have the option of setting a default sort method from the block editing screen. In the block preview, click on a column header to select it as the default column to sort by. Click the column a second time to switch the order from ascending to descending.

When viewing the block on the dashboard, you may sort by the other columns at any time by clicking the appropriate column header. However, should you refresh the page, the block’s sort order will revert to the default method that was set while editing the block.

Device State Table Sort

Download As CSV

You can download the contents of your table in CSV format. Click the gear icon on the top right of the table and select “Download As CSV”.

Device State Table Download As CSV

Only visible columns are included in the export, and formatting rules applied to the table also apply to the exported CSV.

Was this page helpful?


Still looking for help? You can also search the WEGnology Forums or submit your question there.