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

Great, thats something i love to hear haha

3 Likes

For my Irrigation app I created a script to fetch the groundwater status from 2 sources (grondwaterpeil).
This scripts gives me back the value of Todays “Grondwaterstand”. I want to store this number -1.99 with a classification in my device… Is that possible?

function classify(value) {
if (value >= 2.0) return ‘Extreem nat’;
if (value >= 1.5) return ‘Zeer nat’;
if (value >= 1.0) return ‘Vrij nat’;
if (value >= -0.99 && value <= 0.99) return ‘Normaal’;
if (value >= -1.49) return ‘Vrij droog’;
if (value >= -1.99) return ‘Zeer droog’;
return ‘Extreem droog’;

https://houten.grondwater.info/kaart/12491 needs this classification:

Grondwaterstand (m -mv) Situatie / Classificatie
< 0.5 m Nat
0.5 – 1.2 m Normaal / geschikt voor landbouw
1.2 – 2.0 m Matig droog
> 2.0 m Droog
> 2.5 m Ernstige droogte

Not what you need now, but I know this works in a BLL calc field:

$value >= 2 ? "Nat" : "Droog"

(if value >= 2 return “Nat” else return “Droog”)

Maybe you’d use the function part of Better Logic, in order to call that function as BLL expression?

Thanks @Peter_Kawa tried it, and am running into the next challenge.

My rain sensor “MM Regen +1hr” reports mm rain expected the next hour. I think it updates every 5 minutes. I want to calculate total rain over the past 72 hours for irrigation decisions.
:backhand_index_pointing_right: Is there a way to sum the last 72 values of measure_rain ?

Maybe with Insight Trends Reloaded, Better Logic, or another trick? Searched the forum, tried homey script, ChatGPT but not effective upon till now…

1 Like

Hi Arie,

I see cumulative is available for “Power (Sensor)” (values in Watt), but shouldn’t it be available for “Energy (Sensor)” (values in Watt-hours) instead?

At least that’s what is says SDK-Reference Energy:

1 Like

Hi @DirkG ,

Have you been using an AVD for your solar panels? If so, what settings have you used? I’ve setup an AVD for my panels, specified Solar Panels for Device Class, and have exactly one Power (Sensor) and one Energy (Sensor). Both of them have correct values - one in Watt, one in kWh - and I see the power in Homey Energy, but the energy in Homey Energy stays at 0 Wh.

Any tips?

It should work as you described it.

Settings of the AVD
– Device Class: Solar Panel
– Solar Power (W): sensor, measure_power
– Solar Yield (kW/h): sensor, meter_power

Advanced Settings of the AVD
– Excluding from energy: No

When you add an energy device, like solar panels, for the first time, it may take a few hours for the values to be displayed in the energy dashboard. Tomorrow, however, the values of the solar panels should be displayed in the dashboard.

1 Like

Thanks @DirkG for your help, it’s very much appreciated.

It seems that the switch of the device class or capacity type screwed up some flows, but after I fixed them, it works now in Homey Energy.

But now there’s another problem. I have one capability named “Aktuelle Leistung” and this is my “Power (Sensor)”/measure_power. It shows in the device itself:

This capability is specified as real field with insights:

Until I switched from “Sensor (default)” to “Power (Sensor)” the Insights worked. But now I don’t have any insights for “Aktuelle Leistung” anymore, but instead for “Energieverbrauch”:

This Energieverbrauch contains all the data for Aktuelle Leistung, but this naming is nowhere specified by me nor does it make any sense (it isn’t a consumption/Verbrauch).

Any idea how to fix this?

On another topic: is your Stromzähler also an AVD or is it a real device? I have a meter included in one of my inverter which gives me all values, but I have no clue how to make it show that in Homey Energy. According to Energy | Homey Apps SDK I need to specify a device as cumulative and define the import/export capability, but I couldn’t find that device setting.

Depending on what you change in an AVD afterwards, this can actually lead to problems, that’s right.

That’s also the case for me. I named my PV power as “Gesamtleistung”, but in the Insights the power is also labeled as “Energieverbrauch”, but I don’t know why.
@Arie_J_Godschalk, can you please explain why the name in Insights doesn’t reflect the name given in the AVD? And can we change it?

1 Like

I’m pretty sure that this is a Homey bug. I have multiple plugs from different brands, they all measure the power and usually name it „Leistung“, but if I look into the insights I always - without exception - see „Energieverbrauch“.

The insight name should be the field-name. Perhaps Athom has changed something with all power updates? I’ll check it out later, but afaik, for other fields/capability-types, it still works, just not power/energy?

It’s an Athom thing:

Update for the community:

:white_check_mark: Power-by-the-hour could solve my issue with the power metering of Zigbee Smart Sockets once I turned on “Watt als Quelle nutzen” (Watts as source) in the advanced settings.

Since about a week I’m having problems with two devices that stop updating. Restarting the Device Capabilities app solves the issue for a day or two. Both devices reflect values from a Homewizard P1 dongle, but that app seem to work as it should.
Diagnostic report d74fe4f7-5868-4958-9a98-0f15f6dfb9c1

I can’t find an answer for the following question in this thread:
Is it possible to (re)order the fields that are shown when you click on a virtual device?
I notice that the order changes when I make changes in existing fields within the ‘repair’ function. But I do not understand on which basis the ordering is done. So a second question may be: what is the logic that orders the fields that are shown when you click on a virtual device?

I think Arie wrote somewhere that they are shown in strict creation order.

At least for a text-/number-/yes-no-field, saving with a different icon puts it last. So double editing each fields icon with saving each change, editing the fields in wanted order did it for me.

Does not seem to work for buttons.

1 Like

This works, thanks Jan-Erik_Hallkvist.
Not very handy, but doable :wink:

Does the DC app respectively an AVD support home battery devices?

For several days, I’ve been trying to help a user to create an AVD for a home battery, but the data, power (W), and energy import and export (kWh) are not displayed in the Homey Energy Dashboard.
The following capabilities and settings are used:

  • Device Class
    – Battery
  • Power (W)
    – Show as: measure_power
  • Energy Import (kWh)
    – Show as: meter_power
    – Cumulative import: :check_box_with_check:
  • Energy Export (kWh)
    – Show as: meter_power
    – Cumulative export: :check_box_with_check:
  • Advanced Device Settings
    – Exclude from energy: No

Have we perhaps configured something wrong or overlooked something? :thinking:

1 Like

Can you show printscreens of the energy import and export field settings?

Import:

Export:

Edit
@Arie_J_Godschalk, before you start trying to find a bug in the app, let’s wait until tomorrow, as we’ve started another attempt.
I mainly wanted to know whether the app supports home batteries for the Homey Energy Dashboard or not.

1 Like