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

Wow, thanks for the help. I managed to set it up according to your instructions. I now have the bulb’s power, but now the question is, how do I set the kWh?

Thanks, and nice to hear.
To calculate the kWh, you’ll need to know how it’s calculated (just in case you didn’t know yet):
When the 500W (= 0.5kW) light is turned on for 1h, it used 1h * 0.5kW = 0.5kWh
So, when it was on during 15h, it used 15h * 0.5kW = 7.5kWh

It’s possible to record the “on” time by using a stopwatch, and update the kWh of every “light on” period accordingly.

(You’d use Advanced flow in order to use the Chronograph app’s stopwatch “elapsed time” tag)

When..
lamp A turned on
Then..
start or resume stopwatch X

When..
lamp A turned off
Then..
pause stopwatch X

When..
stopwatch X is paused
Then..
set field Lamp A’s kWh to expression

(( [Elapsed time (s)] / 60 / 60 ) * 0.5 ) + [tag lamp kWh]

To clearify, this is the ‘Then’ card you’d use:

The sum part, being “+ [tag lamp kWh]” adds the current kWh value to the last calculated value, making it increase after each “on” session of the virtual light.

A flow screenshot often is way clearer, so I’ve add it as well;
In this example, [tag lamp kWh] is called [v_kWh], Lamp A is called “Kaarsen Wit IR”

Ok. Tell me, because I don’t understand where I’m supposed to use this


and where the kWh calc came from

In the “set field to expression” card, belonging to the virtual light, as shown on the flow screenshot on the bottom-right.

The stopwatch name “kWh calc” is one I just made up. You can use any name which suits you. Make sure it’s unique regarding your Chronograph stopwatches.

Is there a way to create more icons in the app settings than is already there? i’m not sure which icons to replace with my own so would be nice with more slots maybe?

You mean for capabilities?

There are 80 slots you can customise.

I think that should be enough, right?

Or do you mean something else?

Oh yeah, i am just unsure which ones to replace :joy::joy: it might be good now hearing it’s 80?!?! I just need to make a decision and figure out which ones to replace. But if possible creating more slots as a feature would be cool. Some people might use all 80 and run out. If you can add a create button to make more slots yourself? I don’t know if that’s possible, but would be cool.

Sorry, maybe I didnt get it, but I have several fields which are somehow sorted random “Outlet” > “Ambient” > “Comperssor”

is there any way how I can influence the sort order of the fields? Sorry if I oversaw something, but ti me it seems that Device Capabilities renders fields in the order they were created in the device’s lifetime, and offers no built-in drag-to-reorder UI.

The only real way to change the layout is delete-and-recreate in the order you want them to appear - destructive, as I lose insights history on deleted fields.

Regarding fields, this might be a less cumbersome work-around:

Unfortunately this is a limitation of Homey firmware.
No app developer can add any option/tool to rearrange, or auto-sort the order of the capabilities after a device has been created.

The best workaround is shown by @SunBeech

I think that is actually possible by calling this.removeCapability() for every capability and then calling this.addCapability() for each capability in the order that you want the capabilities arranged in. However, this does break existing Flows as far as I know

Maybe I don’t understand your remark, Sven, but,
AFAIK developers can’t add any option / tool for app users to change the order on the fly.