getDeviceCostBudget(params: GetDeviceCostBudgetParams)
Additional notesRead the full notes
Description
Query the device electricity cost budget list. Only budget items with energyAction set to cost are returned. Can be used to display budget progress or threshold alerts in the UI.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| Yes | Request parameters |
Return Value
Referenced Types
GetDeviceCostBudgetResult`getDeviceCostBudget` return value, electricity cost budget listDeviceBudget| Property | Type | Description |
|---|---|---|
bizId | string | Business ID |
budget | string | Budget value; unit depends on `energyAction` (kWh or currency) |
dateType | BudgetDataType | Budget time dimension |
energyAction | EnergyAction | Energy action type (`consume` or `cost`) |
entityId | string | Entity ID (i.e., device ID) |
entityType | string | Entity type |
projectId | string | Project ID |
projectType | string | Project type |
BudgetDataType| Value | Actual Value | Description |
|---|---|---|
BudgetDataType.Day | day | Daily |
BudgetDataType.Week | week | Weekly |
BudgetDataType.Month | month | Monthly |
EnergyAction| Value | Actual Value | Description |
|---|---|---|
EnergyAction.Cost | cost | Electricity cost |
EnergyAction.Consume | consume | Electricity consumption |
Examples
Request example
Response example
FAQ
Why does the call to cloud capabilities fail?
Before using this API, please ensure that the product to which the device belongs has enabled the Electricity Statistics advanced capability on the Tuya IoT Development Platform. Products without this capability enabled cannot collect electricity consumption/cost data, and the API will return empty data or an error. If you need to use it, please create a product with electricity consumption/cost statistics functions and enable the corresponding advanced capabilities in the product details. At the same time, the API depends on cloud capabilities, and authorization configuration is required in Development Settings - Cloud Capabilities on the Mini Program Developer Platform.