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

Thanks!


image image image

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


Device Capabilities 2.0 App voor Homey | Homey
It’s live!

This Addendum to Device Capabilities (Forum topic) is for explanation on, and examples, for the newly created free fully customisable virtual device.
image

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
Click continue.

Next you can select a icon from the list, or you can upload your own icon.
image
After that, click continue.
The device will now have been created and you can change the name to Living Room.
image

Enter the Device Settings

Summary

Because there are a lott of Device Settings, i’m gonna do this step by step.

imageimage

The status field is unique, and can be used as a textual (and number) status on the device tile in the Web/Mobile App.

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.

After removing all fields and pressing save, my device looks empty:

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:

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.

  • 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

  • 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.

And we need the flow for it:
image

Volume

Summary

First we add a Volume to the settings.
image

And then we write the next flow.
image

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:

And for those we need flows, two ways.
First a reaction to us change the slider in the Living Room device:
image

Then we need to update its status:
image

And now we have, within this one device, my music and my curtains from the livingroom in one device :slight_smile:

Custom Buttons

Summary

Lets continue with Buttons for the TV and Xbox.
First we define the buttons in the device settings:

This gives us two on-off buttons on the small button tab, next to each other, so we see tham al at once.

.

We could actually do the exact same thing with the Yes/No fields, when set to Button
image
Would result in:

But back to the Buttons, lets add a flow for the TV first:

And next for the xbox:

And the final result us now:



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

Will result in:

And now for the flows.
First a flow, that when i push the button, i want them to all close/open:

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
Then we scroll down and press on edit, and fill in the function:

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


No we go back to the flow for the curtains.
For this we use a Set field to Expression card:
image


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 :slight_smile:


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:

Donations or Sponsorship

9 Likes

How to request a custom picker?

Goto the topic for it: Request custom picker for Advanced Virtual Devices from the Device Capabilities App - Homey Community Forum

1 Like

[Reserved 2]

Wiki

Hi Arie, I closed my private and business Paypal accounts for good reason. But still I would like to contribute. Do you have another way to support you? I am in NL so a pm with an IBAN does miracles for this case :wink:

Many Thanks Roger for your gracious gift!

1 Like

Homey’s random mood status indicator for mobile app

Inspired by this idea by Arie, I extended it a bit, and it became

You could f.i. use this as “who feeds the cat” indicator, by replacing the moods with names, and run the flow every x hours.
.

- This is the device setting, I used the tag option This is needed to be able to display the moods (text / string value) as Status indicator:

Screenshot (click me)

- In App config, I copied the 'random' function from Arie:

Screenshot

- Code for copy/paste:

function (arr) { 
return arr[Math.floor(Math.random () * Math.floor(arr.length))] 
}

- Flow:

Screenshot

- The tag is from "Textfield 1" and can be found with the devicename in Logics:

Screenshot

- Device tile:


.

.

.

OK, here's the cat thing:

- Flow:

Screenshot

- Device tile:


.

2 Likes

Show the time on a device tile (afaik this was not possible before).

- Flow

Screenshot (click me)

- The [time] tag can be found with 'Date & time'

Screenshot

.

  • Device tile

  • Web app:

Screenshot from 2022-09-03 22-36-01

Check ook deze, met datum en zonder voorloop nul:

https://community.homey.app/t/app-pro-advanced-virtual-device-device-capabilities-app-with-unique-text-status-indicator/68198/31?u=peter_kawa

3 Likes

- Dummy power consuming device -

When you want the used power of a hardwired boiler, ac unit or whatever, to be present in Homey

  1. First, create a Logics numeric variable (this way you can adjust the value quite easy); Enter 0 as value.

  2. Add a Device Capabilities virtual device, (optional: and pick an appropriate device icon)

  1. Create a simple flow (it’s only needed to set the value)

  1. Change the variable value to, say, 1800:

  2. The device tile now should look like this:

  3. When you like the power value to appear in Energy tab, use this (hardcoded) field

I am a diabetic and have built a min/max temperature display especially for my insulin. It helps me a lot because insulin is not allowed to leave a certain temperature range. But the whole thing works with any temperature.
Here is the example of the outside temperature:

The min/max values are provided by a variable. When the temperature changes, a flow with greater/smaller than compares the current temperature with the number stored in the variable. If the value is greater or less than the variable value, the respective variable is updated.
The variables are reset to 0 at 0:00 in order to always have the current value of the day.

Screenshot_20220905-164638_Homey

Insulin:

2 Likes

Monitor (an) app(s) memory usage

This app now can check any app/system/weather/logic insights,
so with this example flow we can check a memory value, and send alerts,
and optionally disable of restart an app which is memory hungry

The [Number] tag is a local variable

Optional:
you can add an Advanced virtual device, to display the used memory value.

Device settings

Screenshot from 2022-09-06 01-49-58

Device tile:

2 Likes

Actually, @Peter_Kawa , perhaps do it like this, at least, when the power_usage could be dynamic (could it be off for instance?)
image

This will make sure that you really have a measure_power that is detected by Homey:

image

Now you can dynamicly set the power usage value just through the Flowcards:
image

2 Likes

That’s what I was looking for Arie! But I didn’t know how😬

1 Like

Now it's possible to change Device Name as well!

This can be achieved by installing the H.O.O.P. app v1.4.5
That’s it, the flow card to set the device name is now available.

  • With Advanced flow:
  • Standard Flow

Practical example, a thermostat device which also shows the room temperature

The default thermostat device, only shows the target temperature:
Screenshot from 2022-09-08 00-31-21

But now, with use of the updated H.O.O.P. app, we can show the room temperature as well, by alternating the device name for the temperature tag.

This can be done with the original device!

Peek 2022-09-08 00-12
(right click and open in new tab for big screen view)

.

- Similar example for window coverings position -

Peek 2022-09-08 01-09
(right click and open in new tab for big screen view)

2 Likes

Also an option: Show the percentage in the Device Tile.
image

But, you can still set the Dark/Light of the Tile based on Open or Closed, and have the button react to it.

image

True, but then you’ll have to add a new AVdevice and make it control (a) curtain(s) as well ?

1 Like

Indeed, just in some case can it been usefull, for instance, when you have a living room device showing all curtains.
Just wanted to let you know you could use percentages als in the units :wink:

1 Like

So, using “Show as: sensor”, makes it display 0.45 automatically as 45?

  • EDIT Just tested: No it doesn’t

B/c I still use this to convert it to %

.

Thanks, so it’s nice to have a choice now:

  1. H.O.O.P. to display a value quickly on a tile
  2. Device Capabilities: Create a virtual device which does and shows everything (if possible) you want.

I created a Homey memory and average load monitor as well:

.
Last night I was fiddling a bit too much, and Homey got unreachable. That means, too busy to care for the wifi connection

Looking in Insights, Homey’s memory was over 400MB, and system load over 10.
Well, when that’s the case, Homey is allowed to be restarted automatically!

1 Like