Last Updated on : 2022-02-17 05:22:45download
After successful login, users can see the energy consumption statistics on the monitoring page, using TuyaLightingEnergy
to get the energy consumption statistics by item and by region.
Interface Description
- (void)requestEnergyAreaRank:(long)projectId
areaId:(long)areaId
targetType:(NSInteger)targetType
time:(long)time
success:(nullable void(^)(NSArray *energyRankList))success
failure:(nullable void(^)(NSError *error))failure;
Parameter Description
parameters | description |
---|---|
projectId | projectid |
areaId | area id |
targetType | Time type, 1:day, 2:month, 3:year |
time | The start time of the time range |
success | success callback |
failure | failure callback |
Sample Code
Objective
[[TuyaLightingEnergy new] requestEnergyAreaRank:self.projectId
areaId:self.areaId
targetType:self.targetType
time:self.startTime
success:^(NSArray * _Nonnull energyRankList) {
NSLog(@"success");
} failure:^(NSError *error) {
NSLog(@"failure");
}];
Interface Description
- (void)requestEnergySubentryRank:(long)projectId
areaId:(long)areaId
targetType:(NSInteger)targetType
time:(long)time
success:(nullable void(^)(NSArray *energyRankList))success
failure:(nullable void(^)(NSError *error))failure;
Parameter Description
parameters | description |
---|---|
projectId | projectid |
areaId | area id |
targetType | Time type, 1:day, 2:month, 3:year |
time | The start time of the time range |
success | success callback |
failure | failure callback |
Sample Code
Objective:
[[TuyaLightingEnergy new] requestEnergySubentryRank:self.projectId
areaId:self.areaId
targetType:self.targetType
time:self.startTime
success:^(NSArray * _Nonnull energyRankList) {
NSLog(@"success");
} failure:^(NSError *error) {
NSLog(@"failure");
}];
Interface Description
- (void)requestEnergySubentryPreview:(long)projectId
targetType:(NSInteger)targetType
time:(long)time
success:(nullable void(^)(NSArray *energyRankList))success
failure:(nullable void(^)(NSError *error))failure;
Parameter Description
parameters | description |
---|---|
projectId | project id |
targetType | Time type, 1:day, 2:month, 3:year |
time | The start time of the time range |
success | success callback |
failure | failure callback |
Sample Code
Objective:
[[TuyaLightingEnergy new] requestEnergySubentryPreview:project.model.projectId targetType:1 time:startTime success:^(NSArray * _ Nonnull energyRankList) {
NSLog(@"success");
} failure:^(NSError *error) {
NSLog(@"failure");
}];
Interface Description
- (void)requestEnergySubentryDetail:(long)projectId
targetType:(NSInteger)targetType
time:(long)time
purposeCode:(NSInteger)purposeCode
success:(nullable void(^)(TYLampEnergySubentryDetailModel *model))success
failure:(nullable void(^)(NSError *error))failure;
Parameter Description
parameters | description |
---|---|
projectId | project id |
targetType | Time type, 1:day, 2:month, 3:year |
time | The start time of this time range |
purposeCode | null or primary device purpose code. null returns data for all energy subsections (purposes); otherwise, it returns data for the specified energy subsections |
success | success callback |
failure | failure callback |
Sample Code
Objective:
[[TuyaLightingEnergy new] requestEnergySubentryDetail:self.currentProject.model.projectId areaIds:areaIds success:^(NSArray * _ Nonnull energyPurposeList) {
NSLog(@"success");
} failure:^(NSError *error) {
NSLog(@"failure");
}];
Interface Description
- (void)requestEnergyReportDeviceSize:(long)projectId
success:(nullable void(^)(NSInteger deviceSize))success
failure:(nullable void(^)(NSError *error))failure;
Parameter Description
parameters | description |
---|---|
projectId | project id |
success | success callback |
failure | failure callback |
Sample Code
Objective:
[[TuyaLightingEnergy new] requestEnergySubentryDetail:self.currentProject.model.projectId areaIds:areaIds success:^(NSArray * _Nonnull energyPurposeList) {
NSLog(@"success");
} failure:^(NSError *error) {
NSLog(@"failure");
}];
Interface Description
- (void)requestEnergyReportDeviceSize:(long)projectId
success:(nullable void(^)(NSInteger deviceSize))success
failure:(nullable void(^)(NSError *error))failure;
Parameter Description
parameters | description |
---|---|
projectId | project id |
success | success callback |
failure | failure callback |
Sample Code
Objective:
[[TuyaLightingEnergy new] requestEnergyReportDeviceSize:project.model.projectId success:^(NSInteger deviceSize) {
NSLog(@"success");
} failure:^(NSError *error) {
NSLog(@"failure");
}];
Interface Description
- (void)requestEnergySubentryDetail:(long)projectId
areaIds:(NSString *)areaIds
success:(nullable void(^)(NSArray *energyPurposeList))success
failure:(nullable void(^)(NSError *error))failure;
Parameter Description
parameters | description |
---|---|
projectId | project id |
areaIds | The selected area ID, 0 means all areas |
success | success callback |
failure | failure callback |
Sample Code
Objective:
[[TuyaLightingEnergy new] requestEnergySubentryDetail:self.currentProject.model.projectId areaIds:areaIds success:^(NSArray * _Nonnull energyPurposeList) {
NSLog(@"success");
} failure:^(NSError *error) {
NSLog(@"failure");
}];
Interface Description
- (void)requestEnergySubentryDetail:(long)projectId
areaIds:(NSString *)areaIds
success:(nullable void(^)(NSArray *energyPurposeList))success
failure:(nullable void(^)(NSError *error))failure;
Parameter Description
parameters | description |
---|---|
projectId | project id |
startTime | start time |
endTime | The end time, specified to the last millisecond of the day |
areaIds | The ID of the selected area, 0 means all areas |
pageNo | The number of paging pages, starting from 1. |
pageSize | number of pages per page |
success | success callback |
failure | failure callback |
Sample Code
Objective:
[[TuyaLightingEnergy new] requestEnergyReportDeviceSize:projectId success:^(NSInteger deviceSize) {
} failure:^(NSError *error) {
}];
Interface Description
- (void)requestEnergyAreaDetail:(long)projectId
targetType:(NSInteger)targetType
startTime:(long)startTime
endTime:(long)endTime
areaId:(long)areaId
success:(nullable void(^)(TYLampEnergyAreaDetailModel *model))success
failure:(nullable void(^)(NSError *error))failure;
Parameter Description
parameters | description |
---|---|
projectId | project id |
targetType | 1 means day, 2:month, 3:year |
startTime | start time |
endTime | the end time, specified to the last millisecond of the day |
areaIds | The ID of the selected area, 0 means all areas |
success | success callback |
failure | failure callback |
Sample Code
Objective:
[[TuyaLightingEnergy new] requestEnergyAreaDetail:project.model.projectId targetType:1 startTime:startTime endTime:endTime areaId:areaId success:^(TYLampEnergyAreaDetailModel * _Nonnull model) {
NSLog(@"success");
} failure:^(NSError *error) {
NSLog(@"failure");
}];
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback