能耗统计

更新时间:2022-02-17 05:22:45下载pdf

用户登录成功后可以在监控页看到各项能耗是数据统计,通过TuyaLightingEnergyService去获取分项和区域相关的各项能耗统计数据。

获取区域能耗排名

接口说明

- (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;

参数说明

参数 说明
projectId 项目id
areaId 区域id
targetType 时间类型,1:日、2:月、3:年
time 该时间范围的开始时间
success 成功回调
failure 失败回调

示例代码

Objc:

    [[TuyaLightingEnergyService new] requestEnergyAreaRank:self.projectId
                                 areaId:self.areaId
                             targetType:self.targetType
                                   time:self.startTime
                                success:^(NSArray * _Nonnull energyRankList) {
        NSLog(@"success");
    } failure:^(NSError *error) {
        NSLog(@"failure");
    }];

获取分项能耗排名

接口说明

- (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;

参数说明

参数 说明
projectId 项目id
areaId 区域id
targetType 时间类型,1:日、2:月、3:年
time 该时间范围的开始时间
success 成功回调
failure 失败回调

示例代码

Objc:

    [[TuyaLightingEnergyService new] requestEnergySubentryRank:self.projectId
                                 areaId:self.areaId
                             targetType:self.targetType
                                   time:self.startTime
                                success:^(NSArray * _Nonnull energyRankList) {
        NSLog(@"success");
    } failure:^(NSError *error) {
        NSLog(@"failure");
    }];

获取监控首页能耗统计

接口说明

- (void)requestEnergySubentryPreview:(long)projectId
                          targetType:(NSInteger)targetType
                                time:(long)time
                             success:(nullable void(^)(NSArray *energyRankList))success
                             failure:(nullable void(^)(NSError *error))failure;

参数说明

参数 说明
projectId 项目id
targetType 时间类型,1:日、2:月、3:年
time 该时间范围的开始时间
success 成功回调
failure 失败回调

示例代码

Objc:

    [[TuyaLightingEnergyService new] requestEnergySubentryPreview:project.model.projectId targetType:1 time:startTime success:^(NSArray * _Nonnull energyRankList) {
        NSLog(@"success");
    } failure:^(NSError *error) {
        NSLog(@"failure");
    }];

获取各分项能耗的图表数据

接口说明

- (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;

参数说明

参数 说明
projectId 项目id
targetType 时间类型,1:日、2:月、3:年
time 该时间范围的开始时间
purposeCode null或一级设备用途code。null会返回所有能耗分项(用途)的数据;否则返回指定能耗分项的数据
success 成功回调
failure 失败回调

示例代码

Objc:

    [[TuyaLightingEnergyService new] requestEnergySubentryDetail:self.currentProject.model.projectId areaIds:areaIds success:^(NSArray * _Nonnull energyPurposeList) {
        NSLog(@"success");
    } failure:^(NSError *error) {
        NSLog(@"failure");
    }];

查询能耗设备数量

接口说明

- (void)requestEnergyReportDeviceSize:(long)projectId
                              success:(nullable void(^)(NSInteger deviceSize))success
                              failure:(nullable void(^)(NSError *error))failure;

参数说明

参数 说明
projectId 项目 id
success 成功回调
failure 失败回调

示例代码

Objc:

    [[TuyaLightingEnergyService new] requestEnergySubentryDetail:self.currentProject.model.projectId areaIds:areaIds success:^(NSArray * _Nonnull energyPurposeList) {
        NSLog(@"success");
    } failure:^(NSError *error) {
        NSLog(@"failure");
    }];

查询所选区域下存在的能耗用途

接口说明

- (void)requestEnergySubentryDetail:(long)projectId
                            areaIds:(NSString *)areaIds
                            success:(nullable void(^)(NSArray *energyPurposeList))success
                            failure:(nullable void(^)(NSError *error))failure;

参数说明

参数 说明
projectId 项目 id
areaIds 所选区域ID,0表示全部区域
success 成功回调
failure 失败回调

示例代码

Objc:

    [[TuyaLightingEnergyService new] requestEnergySubentryDetail:self.currentProject.model.projectId areaIds:areaIds success:^(NSArray * _Nonnull energyPurposeList) {
        NSLog(@"success");
    } failure:^(NSError *error) {
        NSLog(@"failure");
    }];

查询设备能耗列表

接口说明

- (void)requestEnergySubentryDetail:(long)projectId
                            areaIds:(NSString *)areaIds
                            success:(nullable void(^)(NSArray *energyPurposeList))success
                            failure:(nullable void(^)(NSError *error))failure;

参数说明

参数 说明
projectId 项目 id
startTime 开始时间
endTime 结束时间,具体到当天的最后一毫秒
areaIds 所选区域ID,0表示全部区域
pageNo 分页页数 ,从1开始
pageSize 每页数量
success 成功回调
failure 失败回调

示例代码

Objc:

    [[TuyaLightingEnergyService new] requestEnergyReportDeviceSize:project.model.projectId success:^(NSInteger deviceSize) {
        NSLog(@"success");
    } failure:^(NSError *error) {
        NSLog(@"failure");
    }];

获取能耗详情页区域能耗

接口说明

- (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;

参数说明

参数 说明
projectId 项目 id
targetType 1表示日,2:月,3:年
startTime 开始时间
endTime 结束时间,具体到当天的最后一毫秒
areaIds 所选区域ID,0表示全部区域
success 成功回调
failure 失败回调

示例代码

Objc:

    [[TuyaLightingEnergyService new] requestEnergyAreaDetail:project.model.projectId targetType:1 startTime:startTime endTime:endTime areaId:areaId success:^(TYLampEnergyAreaDetailModel * _Nonnull model) {
        NSLog(@"success");
    } failure:^(NSError *error) {
        NSLog(@"failure");
    }];