How can I use an outlet subscription to know *only* when a device attached to it is turned on or off?

We’re developing an OAuth API app.

We have a subscription to a power outlet. We want to know when someone turns the device attached to it on or off (not the outlet itself, but whatever is plugged into it).

We use a subscription like this:

    {
        "id": "*****",
        "installedAppId": "*****",
        "sourceType": "CAPABILITY",
        "capability": {
            "locationId": "*****",
            "capability": "powerMeter",
            "attribute": "power",
            "value": "*",
            "stateChangeOnly": true,
            "subscriptionName": "all_power_sub",
            "modes": []
        }
    }

This works well for OFF events (when value == 0), but we get a deluge of ON events, as each small fluctuation in power consumption fires.

We’ve tried also subscribing to other capabilities: energyMeter, switch, voltageMeasurement - but these don’t help.

This seems quite a basic requirement for a smart plug, so we think we must be missing something. We hoped “stateChangeOnly” would limit the triggers to on/off, but that doesn’t seem to be the case.

Is there any way (without ourselves storing the state of the device) to limit the trigger to when the powerMeter moves from 0 to >0, or to throttle it so the change in power needs to be a specific minimum number? Can we add some kind of formula to the ‘value’ field, or is there another way to solve this?

If we subscribe to the event via IFTTT then we don’t get the duplicates, so we think there must be a way to limit them. Does anyone have any suggestions?

I’m not aware of anything at the app end, though I only have a superficial knowledge of this area. I do note that you are subscribing to a capability rather than a specific device so you will get power events from all the devices in your location that support it.

Is throttling the events at source an option for you, or do you have to work with whatever the devices are doing? That is assuming the devices can be throttled.

Thanks for your answer.

Yes - the issue is that a single outlet generates an event every second or so while on, whenever the power fluctuates slightly, so switching to a device subscription doesn’t help.

We’re trying to track when, for example, a kettle is switched on. We can’t ask the end user to only do this via the switch on the outlet, so we have to track the power events.

Knowing their pricing, I’m surprised IFTTT are able to bear the cost of throttling themselves, so it’s odd there’s no way to do it at source.