# \[APP\]\[Pro\] Advanced Virtual Device (Device Capabilities App) with Unique Text Status Indicator

**URL:** <https://community.homey.app/t/app-pro-advanced-virtual-device-device-capabilities-app-with-unique-text-status-indicator/68198>\
**Category:** Apps\
**Tags:** app, tools, virtual-device, device-capabilities, avd\
**Created:** [August 30, 2022, 7:24pm UTC](https://community.homey.app/t/app-pro-advanced-virtual-device-device-capabilities-app-with-unique-text-status-indicator/68198 "2022-08-30T19:24:40Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [August 30, 2022, 7:24pm UTC](https://community.homey.app/t/app-pro-advanced-virtual-device-device-capabilities-app-with-unique-text-status-indicator/68198/1 "2022-08-30T19:24:40Z")

</div>

- If you have questions about the App Device Capabilities or seek help with an Flow or with the Flow Exchanger, please see the [Device Capabilities Topic](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287).

- **If you have questions about the Advanced Virtual Device or seek help with the Exchanger File, please see the [Advanced Virtual Devices Topic](https://community.homey.app/t/app-pro-device-capabilities-addendum-fully-customisable-advanced-virtual-device-with-unique-text-status-indicator/68198).**  
**This topic!**

- If you want to post a AVD as a Template for others to use, please post it on [Share Your Device! - Advanced Virtual Devices](https://community.homey.app/t/share-your-device-advanced-virtual-devices-from-device-capabilities/68676).

- If you want to post a Flow(s) as a Template for others to use, please post it on [The Flow Exchange(r) - Exchange Your Flows with Others!](https://community.homey.app/t/the-flow-exchange-r-exchange-your-flows-with-others/68981).

## Thanks!

* * *

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/d/bdc4842bcfcc19bbb3407f7244f67c263922f479.png) ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/9/895c62633e99452c3808f31e722d903a3e207c50.png) ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/c/cc5605876c9966bcfb52f2c1b2a8a348aedf7058.png)

If you also want a status text on your device tile, please continue reading!

* * *

**[Device Capabilities 2.0 App voor Homey | Homey](https://homey.app/nl-nl/app/nl.qluster-it.DeviceCapabilities/Device-Capabilities/)**  
**It’s live!**

This Addendum to [Device Capabilities (Forum topic)](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/) is for explanation on, and examples, for the newly created free fully customisable virtual device.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/a/6a89be9eebdedbbcc15ae46702b63eecfe2b2873.png)

Fully Customisable **Advanced Virtual Device** with Unique **Text Status Indicator** for Device Tile.

**You yourself can completely customise these virtual devices, the way you want!**

Also allows for the creation of Insights for capabilities of existing devices that have no insights.  
  
  
  
To explain how far this goes and how this works, i will create a Livingroom Device, which i will configure to accommodate multiple devices in my livingroom.

I will be using the Web App for this example and Advanced Flows, but neither are needed.

**Because of the length of this article, i placed the texts inside summaries, click on them to open to open.**

# Living Room Example

## Create a device

> **Summary**
>
> Goto create a device, then select Device Capabilities, then Virtual Device (the name is up for suggestions and could be changed).  
> A list with one device will be shown (allthough you can create more if you wish, one by one).  
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/c/ac28ff81b561a44536ae0ff9b217c3f6f4849421.png)  
> Click continue.
> 
> Next you can select a icon from the list, or you can upload your own icon.
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/c/5cd371a059619d924ba82b980a514356275748ae.png)  
> After that, click continue.  
> The device will now have been created and you can change the name to Living Room.  
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/5/951daddcb40aa257ff4e8db7737257a3af2d0a82.png)

## Enter the Device Settings

> **Summary**
>
> Because there are a lott of Device Settings, i’m gonna do this step by step.
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/6/666c6899ea3d77c6a26a7c2a5207f48fa04b29aa.png) ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/d/3dbaa1de47fb55ef4515f09d36075ddd0fc8ebe1.png)
> 
> **The status field is unique, and can be used as a textual (and number) status on the device tile in the Web/Mobile App.**
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/a/9a859300d556b380bce9411b3e1be07a75542b57.png)
> 
> I am gonna turn button 1 into an indicator. That means that the device tile in the Web/Mobile App will be light/dark based on that buttonvalue.  
> **You remove a field by removing its name.**
> 
> Only button 1 can be a hidden button, so i will first use other buttons, until i know what i will use it for.
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/1/f1a1818220867c1cc11bc24bc65e6faaf7c42c7d.png)
> 
> After removing all fields and pressing save, my device looks empty:
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/f/8f9560b43c7774384f074a88a9023d5d50a6ad16.png)

### Create Media Buttons

> **Summary**
>
> Firstly, i want my media to show on this device, firstly from my sonos, but we can later overrule that to also show TV info.  
> We first need a few buttons for this:
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/1/611a96daf0553e3f8ab323af34413e3c7e495d18.png)

### Create a Flow

> **Summary**
>
> Now we need a flow to handle this virtual device.  
> We need to setup the status and reactions to the music buttons.
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/b/cbe4d127c3231c99b7803bf5a1f2a942a809a3ae.png)
> 
> - Because the Playing button can be false or true, we need to check the value (waarde)
> 
> After this, the playing button on the LivingRoom device can be used to start the music, and it will also show it if music is playing or not.
> 
> Next up we need to react to the previous and next button being pushed.
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/2/62e21230acec9aa52d17262de3bae5578ab2ecc7.png)
> 
> - No need here to check for the value, it will always be true

### Textfields

> **Summary**
>
> Next i would also like to Add the Artist, Album and Track.
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/a/0a27ba4a014518516c8e9d76f5f39225bad8ac3d.png)
> 
> And we need the flow for it:
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/0/8063ff38957a9b04be5714a05f3f1c83e8b61c77.png)

### Volume

> **Summary**
>
> First we add a Volume to the settings.
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/e/fe049fb1d31cd76cf14da5830079b69475891434.png)
> 
> And then we write the next flow.
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/4/e4504e8077b02b2781272b0fe6c25486495fdcb3.png)
> 
> **And, tada, we are done with the Media!**
> 
> Lets now add the four Curtains that we have in our livingroom to this same device.

## Four Curtains

> **Summary**
>
> Again we go into the device settings to add four number fields:
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/1/5176532224e91231b1f6042f972261b061ef8036.png) ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/b/0bca5fc528695229635a3f30c5267c37525c5844.png)
> 
> And for those we need flows, two ways.  
> First a reaction to us change the slider in the Living Room device:
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/4/e4e7658f0caf2c030519b26d3f46efd99e1c890a.png)
> 
> Then we need to update its status:
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/5/c50d7c827c9564144b8a6c4ec3b42d937c1574fb.png)
> 
> And now we have, within this one device, my music and my curtains from the livingroom in one device 🙂
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/0/e0128f1509fb0175bfb81b2339b95e65dba76878.jpeg)

## Custom Buttons

> **Summary**
>
> Lets continue with Buttons for the TV and Xbox.  
> First we define the buttons in the device settings:
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/6/36535bb1277334e6b4140fe292cc21a634f431e9.png)
> 
> This gives us two on-off buttons on the small button tab, next to each other, so we see tham al at once.
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/3/837e99f1c60834b7e7e8ec6689f90cb15abf85de.png).
> 
> We could actually do the exact same thing with the Yes/No fields, when set to Button
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/e/be31c925bcf45152922a3a77609c70e4772d8df2.png)  
> Would result in:  
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/b/db75c9a279e6366ad4f9ae084df8b4d8fde7b4eb.png)
> 
> But back to the Buttons, lets add a flow for the TV first:
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/a/1ac9f60709d38768341ca5993fa855bb4cddf153.png)
> 
> And next for the xbox:
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/1/e1e2d959acc71e805cd40cf5bacec0aeb83c6960.png)
> 
> And the final result us now:
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/e/ee77dc3a84b9b28d9bd432a649f7affd851e1c20.png)  
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/b/db11367efeee31aaca851ea644572ae2c0015d2c.png)  
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/0/40200a11e520907044c85e186f2643a58b8a2b90.png)

## One Main Curtain Button

> **Summary**
>
> Now i want **one** button for all my curtains, which should be a light button when one is open, and dark when all are closed.
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/f/bf59f81e97594080acd446b83a6654159378a91f.png)
> 
> Will result in:
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/b/7bbde5221e3c5c27771570adbabbbc6ee7ced527.png)
> 
> And now for the flows.  
> First a flow, that when i push the button, i want them to all close/open:
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/e/ee79dcbc47c44a1b291743214859c05c44a52cba.png)

## Setting and Using Functions

> **Summary**
>
> And now for the button status to be set.  
> But for this we first add a function in **App** settings.  
> We go to the bottom, fill in `average` and press add function:
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/f/0fa05ce410c562352f4caa7ba23463511a39b629.png)  
> Then we scroll down and press on edit, and fill in the function:
> 
> ```auto
> function () {
> var sum = 0.00;
> for( var i = 0; i < arguments.length; i++ ){
> sum += parseFloat( arguments[i], 10 );
> }
> return sum/arguments.length;
> }
> 
> ```
> 
> _Please note that you don’t give the function a name in the codefield, but in the namefield._
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/e/7ebcc57455fe8f8e7f50c2914a0c24f10404bbf9.png)
> 
> No we go back to the flow for the curtains.  
> For this we use a Set field to Expression card:  
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/7/878edf5dc83202eafb4de348a635ad40a4c05898.png)
> 
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/e/ee47a19719f3f905bd76522b0e93ed9c414b8ddf.png)  
> And here we use the average function from the App Settings.  
> All the number tags are **not** from the flowcards (because only one trigger triggers the flow), but the tags from the curtain-devices.
> 
> And once again, tada! We can now close all curtains in the Living room with one button, next to the tv button 🙂

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/0/f016e3cab302568b075d9062626f209a1dedd90f.png)

`let dcApp = await Homey.apps.getApp({id:'nl.qluster-it.DeviceCapabilities'});`

# Added an API call to set the **value** of AVD fields:

`await dcApp.apiPost('setvalue', {device:'Day-Amount', field:'number1', value:21});`

`await dcApp.apiPost('setvalue', {device:'Day-Amount', field:'measure_devicecapabilities_number-custom_1.number1', value:22});`

`await dcApp.apiPost('setvalue', {device:'c34dc5b4-3c30-48a9-8a4e-014aea93d00d', field:'measure_power', value:501});`

# Added an API call to set the **name** of AVD fields:

`await dcApp.apiPost('setfieldname', {device:'Day-Amount', field:'number1', name:'Day-More'});`

`await dcApp.apiPost('setfieldname', {device:'Day-Amount', field:'measure_devicecapabilities_number-custom_1.number1', name:'Day-More'});`

`await dcApp.apiPost('setfieldname', {device:'c34dc5b4-3c30-48a9-8a4e-014aea93d00d', field:'measure_power', name:'Day-More'});`

To be continued.

If you would like to add an example, please feel free to do so.

### Apps:

> [@\[Profile\] Arie J. Godschalk](https://community.homey.app/t/profile-arie-j-godschalk/70663/2):
>
> Apps developed or maintained by me: [Advanced Triggers](https://community.homey.app/t/app-pro-advanced-triggers-trigger-and-action-cards-with-eventname-for-advanced-flows/65651) , [BeNext](https://community.homey.app/t/app-pro-benext-benext-devices-for-homey/76104) , [Better Logic](https://community.homey.app/t/app-pro-better-logic-just-some-better-logic-and-variable-management/5568) , [Chronograph](https://community.homey.app/t/app-pro-chronograph-adds-precise-timer-stopwatch-and-transition-functionality-to-homey/18214) , [Device Capabilities](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287) , [Advanced Virtual Device](https://community.homey.app/t/app-pro-advanced-virtual-device-device-capabilities-app-with-unique-text-status-indicator/68198) , [FTP Client](https://community.homey.app/t/app-pro-ftp-client/70876) , [Google Services](https://community.homey.app/t/google-services-app-for-translate-and-new-text-to-speech-for-any-device-with-url-input/43257) , [Homesh Controller](https://community.homey.app/t/app-pro-homesh-controller-homesh-satellite-connect-homey-pro-2023-to-homey-pro-for-led-speaker-zwave-satellite-and-network-resource/70369) , [Homesh Satellite](https://community.homey.app/t/app-pro-homesh-controller-homesh-satellite-connect-homey-pro-2023-to-homey-pro-for-led-speaker-zwave-satellite-and-network-resource/70369) , [JSON Handler and Manipulator](https://community.homey.app/t/app-pro-json-handler-and-manipulator/66317) , [LOQED](https://community.homey.app/t/app-pro-loqed-your-personal-doorman/89816) , [Music Url Converter](https://community.homey.app/t/music-url-converter-play-music-urls-on-homey-bigger-then-900-kb/43546) , [Simple Log](https://community.homey.app/t/simple-log-app/146) , [Universal Media Player](https://community.homey.app/t/universal-media-player-a-generic-storages-place-for-your-homey-speakers-tvs-or-other-media-devices/43450) and [Virtual Devices](https://community.homey.app/t/app-pro-virtual-devices-virtual-devices-to-simulate-1-or-more-real-devices/1723) . [Goto profile of Arie J. Godschalk](https://community.homey.app/t/profile-arie-j-godschalk/70663) for more …

### Donations or Sponsorship

> [@\[Profile\] Arie J. Godschalk](https://community.homey.app/t/profile-arie-j-godschalk/70663/3):
>
> Donations or Sponsorship. You can help with the development, maintenance and support for the Apps, by donating or becoming a sponsor. This would be much appreciated! The more donations i receive, the more time i can make free for development and support. slight_smileDonations can be done through: [[PP] PayPal](https://paypal.me/QlusterIT) Requires a PayPal account. [[GS] Github Sponsors](https://github.com/sponsors/XeroxQ) Allowes for CreditCard. Sponsorships can be done through: [[P] Patreon](https://www.patreon.com/QlusterIT/membership) Requires a Patreon account. [[GS] Github Sponsors](https://github.com/sponsors/XeroxQ) …

---

_[View the full topic](https://community.homey.app/t/app-pro-advanced-virtual-device-device-capabilities-app-with-unique-text-status-indicator/68198)._
