Custom insight reporting

Can you set your own insight values? Like I have rmsVoltage, but also rmsVoltagePhaseB and rmsVoltagePhaseC.

Can I report these from a Zigbee driver? Could not really find anything related to setting “insight data” in the documentation. Seems to just happen magically when you setCapabilityValue()

Not sure I understand, but you can store them as custom capabilities and then you will get insights for those. But that’s probably not what you meant ?

If you create Advanced Virtual Device (app) with insight, you can store any value there and see on trends…

Would this work for you?

Looks like this is probably what I need. I tried setting this up, but I get an error message when I try to follow the examples in old or new docs.

.homeycopose/capabilities/meter_rmsVoltagePhaseA.json

{
  "type": "number",
  "title": {"en" :  "Voltage Phase A"},
  "units": {"en" : "V"},
  "getable": true,
  "setable": false,
  "uiComponent": null,
  "uiQuickAction": false,
  "icon": "/assets/icon.svg",
  "insights": true
}

.drivers/qudo/driver.compose.json

{
...
  "capabilities": [
    "dim",
    "meter_power",
    "measure_power",
    "measure_voltage",
    "meter_rmsVoltagePhaseA",
    "onoff"
  ],
...
}

.drivers/qudo/device.js

class Device extends ZigBeeDevice {
    ...

   async onNodeInit({ zclNode }) {
      ...


       await this.setCapabilityValue('meter_rmsVoltagePhaseA', this.voltagePhaseA)
          .catch((err) => {
            this.error('Error setting rmsVoltage capability:', err);
          });

      ...
    }
    
    ...
}

I get the error

2024-06-12T09:58:29.118Z [err] [Homey:665877af2fb1e463cd51143e] [ManagerDrivers] [Driver:qudo] [Device:a7988fb9-117d-4e6e-8c7f-40852cb5383f] Error setting rmsVoltage capability: Invalid Capability: meter_rmsVoltagePhaseA

I feel like I’ve missed something obvious here…

Edit:
What I missed was that I needed to remove and readd the device…

If you add a capability to the driver, already existing devices won’t get this capability automatically.
You have to re-add the device or add the capability in onInit() using this.addCapability() … and perhaps check before with if (!this.hasCapability()).