Device shadow monetization rule not triggering when usage threshold exceeded

We’ve configured a monetization rule in Oracle IoT Cloud Platform 23 to trigger billing events when device shadow attributes exceed usage thresholds. The rule should fire when dataUsageMB exceeds 1000 MB per device per day, but billing events are not being generated despite devices clearly exceeding this limit.

Our device shadow attribute mapping looks like this:

{
  "deviceId": "sensor-001",
  "dataUsageMB": 1547,
  "timestamp": "2025-03-14T23:45:00Z"
}

The rule condition is set to dataUsageMB > 1000 with action type “Generate Billing Event”. We’ve verified that shadow updates are working and the attribute values are correct in the shadow document. However, no billing events appear in the monetization console. This is causing missed billing cycles for high-usage devices. Has anyone encountered similar issues with device shadow-based monetization rules?

Let me provide a complete solution addressing all three focus areas:

Device Shadow Attribute Mapping: Your shadow structure must align with how the rule references attributes. Based on your JSON example, the correct path in rule conditions is state.reported.dataUsageMB. Update your device shadow mapping to ensure attributes are consistently placed under state.reported for all devices. You can verify this by checking a few device shadows in the console.

Rule Condition Syntax: The complete rule condition should be:


state.reported.dataUsageMB > 1000

Make sure there are no extra spaces or special characters. Also verify the data type - if dataUsageMB is stored as a string instead of a number in the shadow, the comparison will fail. You may need to cast it: toNumber(state.reported.dataUsageMB) > 1000.

Billing Event Action Configuration: Your action configuration needs these parameters:

{
  "actionType": "GENERATE_BILLING_EVENT",
  "eventType": "USAGE_EVENT",
  "serviceId": "iot-data-service-01",
  "quantityExpression": "state.reported.dataUsageMB",
  "deviceIdExpression": "deviceId",
  "metadataExpressions": {
    "timestamp": "state.reported.timestamp",
    "thresholdExceeded": "true"
  }
}

The quantityExpression is critical - it tells the billing system how much to charge for. The serviceId must match an existing service definition in your monetization configuration that’s linked to your ERP billing module. The metadataExpressions are optional but useful for billing audit trails.

After making these changes, test with the rule simulator first, then enable the rule and trigger a device shadow update that exceeds the threshold. Check the monetization event log (not just the billing console) to see if events are being generated but failing at the ERP integration stage. If events appear in the log but not in billing, the issue is with the service definition or ERP connection, not the rule itself.

One more thing: if you’re using daily aggregation, make sure your rule evaluation window aligns with your billing period. Set the evaluation frequency to “On every shadow update” rather than scheduled intervals to catch threshold crossings immediately.

I’ve seen this before. Check if your rule condition syntax is using the correct path notation for nested shadow attributes. In OIOT 23, you need to use dot notation like state.reported.dataUsageMB instead of just dataUsageMB. The rule engine might not be finding the attribute at all.

Also verify that your billing event action includes the correct service identifier that links to your ERP billing module. The action needs serviceId parameter mapped to your IoT billing service definition. And make sure the rule evaluation frequency is set appropriately - if it’s set to evaluate only on shadow updates, but your devices update shadows in batches, you might miss threshold crossings that happen between updates.

The path notation depends on where the attribute is stored in the shadow document. If your shadow structure has the attribute under state.reported, then you must use that full path in the rule condition regardless of the device model definition. The device model defines what attributes exist, but the shadow structure determines how to reference them in rules.

For testing, you can use the IoT console’s rule simulator. Navigate to the rule details page and look for the “Test Rule” option. You can input sample shadow JSON and see if the condition evaluates correctly. This would quickly tell you if it’s a path issue or something else in the billing event action configuration.

Used the rule simulator and you were right - the condition wasn’t matching because of the path. However, even after fixing the path to state.reported.dataUsageMB > 1000, the simulator shows the condition as true but the billing event action still shows as “not configured properly”. The action configuration has Event Type set to “Usage Event” and includes deviceId as a parameter. What else could be missing in the billing event action setup?