Skip to content

App Device Capabilities

Arie J. Godschalk edited this page Nov 15, 2026 · 6 revisions

Device Capabilities and Advanced Virtual Devices

Supported apps · Examples

Device Capabilities supports BLL coding in the Set Text and Set List from text arguments, and offers Set Expression with Better Logic Library and AVD Reflection. An Advanced Virtual Device (AVD) is provided by Device Capabilities; it is not a separate BLL app.

See the Device Capabilities BLL guide for supported fields, expression formats and a first test.

Choose the right input

Where you enter code Syntax
Set Text / Set List from text argument Text containing {[ ... ]}.
Set Expression with Better Logic Library A bare expression, without {[ ]}.
Reflection's BLL expression A bare expression using the reflected context.
Calculation BLL expression for several reflected devices A bare expression using $values.

Reflection can update a field when its selected source changes, instead of requiring a separate Flow for every update. Configure the AVD through its maintenance/repair screen; labels depend on the app version.

The examples below link to their original community posts. Screenshots come from those posts and show the versions and languages used there. Code explicitly marked adaptation is a wiki example, not a quotation from the post.

Show a date on an AVD

  1. Install BLL and Device Capabilities, create an AVD and save a Text field.
  2. In a Flow, add the AVD's Set Text action and select that field.
  3. Enter Today: {[ date("dddd") ]} in Text and run the Flow.
  4. The field should display the resulting weekday. Its language depends on the locale used for formatting.

Another supported text field can display Last update: {[ date("HH:mm") ]}. The output is updated when the Flow runs, not continuously by itself.

Show a shutter's position as a percentage

In this Shelly example, the reflected position ranges from 0 (closed) to 1 (open). The AVD presents it as a percentage:

  1. Add a status indicator field.
  2. Set Reflect to Devices, select the Shelly and its Position number property.
  3. Enter $value * 100 in BLL expression.
  4. Choose zero decimals and set the percentage unit.
  5. Select this field as the device's status indicator.

For example, 0.35 becomes 35. In a BLL expression (Unit) field, use the JavaScript string expression "%", including the quotes. A literal percent sign alone is not a valid JavaScript expression. The post mentions the percent unit, but the screenshot leaves that field unfilled.

Shelly position reflection with the expression $value * 100

Community screenshot: a reflected Shelly position is multiplied by 100 for display as a percentage.

The post also explains adding push buttons and Flows to control the shutter. Displaying the position and controlling the shutter are separate steps.

Display a lock state as readable text

This dashboard example uses a reflected boolean to select between locked and unlocked status text. The demonstration uses a contact sensor to simulate the state.

An ASCII adaptation of the post's expression is:

$value === true ? "Locked" : "Unlocked"

The original uses icons as well as text. Reflect the appropriate source capability and place the expression in the status field's BLL expression. Check the meaning of true for your actual device; a contact alarm does not necessarily mean that a physical lock is secured.

Community example of a custom lock status on Homey tiles

Community screenshot: custom reflected status text is shown on Homey device tiles.

Reflection configuration for the lock status example

Community screenshot: reflection and expression settings for the lock-status example.

The post reports increased resource use with many such reflected statuses and shows a Flow-based alternative. Treat this as a reported experience, not a fixed limit on how many expressions you can use.

Show a Chronograph countdown or stopwatch

This Chronograph example shows an AVD text field reflecting Chronograph → Remaining duration. Install Chronograph and BLL, select your chronograph, and use:

time("M:ss")

This displays total minutes and the remaining seconds component. For an hours/minutes/seconds display, use time("H:mm:ss").

AVD text field reflecting Chronograph remaining duration with time('M:ss')

Community screenshot: the reflected remaining duration is formatted as minutes and seconds.

Here Device Capabilities supplies the reflected duration to BLL, so the expression can omit the duration argument. In an ordinary BLL expression card there is no reflected duration: supply it explicitly, for example time("H:mm:ss", 3723000), which produces 1:02:03. To show elapsed time, select the corresponding Chronograph property. See time for total-versus-component format codes and zero-value caveats.

Show stopwatch seconds and formatted text side by side

The stopwatch reflection walkthrough demonstrates two AVD fields reflecting the same Chronograph stopwatch:

  • A number field reflects its elapsed duration without a BLL expression. Device Capabilities converts the duration to seconds. The example uses zero decimals and the unit seconds.
  • A text field uses a BLL expression to format the elapsed duration as readable time, rather than a plain number of seconds.

Stopwatch example: numeric elapsed-time field configuration

Community screenshot: Device Capabilities reflects the stopwatch duration as seconds in a number field.

Stopwatch example: text field using BLL to format the same stopwatch

Community screenshot: the companion text field uses BLL to format the same duration.

Stopwatch example: stopwatch shown as seconds and formatted text

Community screenshot: the device displays both the numeric and formatted stopwatch values.

The post demonstrates updates after pausing or resuming without an extra Flow. Numeric duration display is a Device Capabilities feature; BLL adds the formatting for the text field.

Show days, hours and minutes

This AVD forum answer gives this expression for a reflected duration:

time("DD:hh:mm", $value)

For 90061000 milliseconds, the result is 01:01:01: one day, one hour and one minute. Uppercase DD is total days; lowercase hh and mm are the hour and minute components. This is useful for longer running activities where a total-seconds display is difficult to read.

Reflect a variable or a chronograph's running state

The original reflection announcement shows both BLL variable reflection and a button reflecting a Chronograph's running state.

Select Better Logic Library as the source, then the variable and property. You can mirror the value directly; a BLL expression is only needed when you want to transform or format it:

Selecting a Better Logic Library variable for AVD reflection

Community screenshot: choose Better Logic Library as the reflection source, then select a variable and property.

For a running-state indicator, select Chronograph and its Running property. The announcement shows a reflected button:

AVD button reflecting the running state of a Chronograph

Community screenshot: an AVD button reflects Chronograph's running state.

This state reflection does not itself require a formatting expression. Use BLL when transforming the value or formatting a duration; do not assume every reflection feature requires custom code.

Make a slider for a BLL variable

The BLL users discussion recommends an AVD number field when a percentage slider is inconvenient for entering a duration. You can choose a meaningful minimum, maximum, step and title instead.

  1. Create a BLL number variable, for example FanMinutes.
  2. Create an AVD number field displayed as a slider, with a suitable range and step.
  3. Reflect the BLL variable's Value into the field.
  4. Add a Flow: when this AVD number field changes, set the BLL variable to the card's numeric value tag.

Reflection handles variable-to-AVD updates; the Flow handles slider-to-variable updates. The name FanMinutes is an adaptation for this guide. Test changes from both sides, and use a change trigger rather than repeatedly writing the same value through a set trigger.

Simulate power values while testing Flows

This virtual power example uses a BLL number variable called test_power_value and an AVD slider. The field reflects that variable and provides a convenient test input.

The screenshot configures a range of -500 to 3500 with step 5; choose values appropriate to your own test. It enables a real field and Flow cards, and creates a tag.

AVD test-power slider reflecting a BLL number variable

Community screenshot: an AVD slider is used to change a test-only BLL number variable.

The illustrated Flow sends a notification containing the changed slider value to check the test output:

Flow sending the changed test-power value in a message

Community Flow screenshot: a change trigger sends the slider value in a message.

To also write slider changes back into BLL, add the variable-setting Flow described above. Keep these simulated values separate from real power measurements, especially if your Flows control equipment or calculate costs.

Combine hour and minute pickers for Timey

In this picker example, an AVD text field combines two reflected picker values using Calculation BLL expression:

$values.join(":")

Select the hour and minute sources in that order. The post demonstrates 22 and 10 producing 22:10; the resulting AVD text tag is then used in a Timey trigger, and the post reports the Flow triggering at 22:10.

AVD text field combining two picker values using a BLL calculation

Community screenshot: hour and minute picker values are joined into a time string.

Using the AVD text tag as the timestamp in a Timey Flow

Community screenshot: the resulting text tag is selected as Timey's trigger time.

The same text can be selected as the tile's status indicator:

AVD tile displaying the selected time

Community screenshot: the same reflected text is visible on the AVD tile.

Ensure minute picker values have two digits, including 00 through 09. Joining 7 and 5 would produce 7:5, not the required 7:05. See Timey for accepted time formats.

Adaptations: round a value or show a variable's last-set time

These are additional examples based on the reflection inputs supported by Device Capabilities, rather than quotations from a forum post:

Reflection setup Bare BLL expression Purpose
Reflect a numeric device capability math.round($value, 1) Keep a numeric result rounded to one decimal.
Reflect a numeric capability into a text field number($value, 1, "en-US") Display localized text with one decimal.
Reflect a BLL variable into a text field date("HH:mm", $variable.lastChanged) Show its last-set time, using the configured time zone.
Calculate from multiple numeric device properties math.mean($values) Calculate an average.

$value is the reflected value; $values contains selected device values for a multi-source calculation. BLL variable reflection also supplies $variable, while Chronograph reflection supplies $chronograph. These names are provided by Device Capabilities: they are not automatically available in an ordinary BLL expression card. Match the result to the target field's type; number(...) and date(...) return text.

More help

See the BLL supported-app list, Device Capabilities topic and AVD guide.

Clone this wiki locally