@ray-js/api 1.4.20 → 1.4.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * DeviceKit
3
3
  *
4
- * @version 3.4.0
4
+ * @version 4.1.9
5
5
  */
6
6
  declare namespace ty.device {
7
7
  /**
@@ -1046,7 +1046,7 @@ declare namespace ty.device {
1046
1046
  * 支持跨面板获取其他的设备信息,当前面板可以传当前设备的 id 来进行获取
1047
1047
  */
1048
1048
  deviceId: string
1049
- /** dps 科学变化的数据 */
1049
+ /** dps */
1050
1050
  dps?: Record<string, {}>
1051
1051
  complete?: () => void
1052
1052
  success?: (params: null) => void
@@ -1069,7 +1069,7 @@ declare namespace ty.device {
1069
1069
  * 支持跨面板获取其他的设备信息,当前面板可以传当前设备的 id 来进行获取
1070
1070
  */
1071
1071
  deviceId: string
1072
- /** dps 科学变化的数据 */
1072
+ /** dps */
1073
1073
  dps?: Record<string, {}>
1074
1074
  complete?: () => void
1075
1075
  success?: (params: null) => void
@@ -1092,7 +1092,7 @@ declare namespace ty.device {
1092
1092
  * 支持跨面板获取其他的设备信息,当前面板可以传当前设备的 id 来进行获取
1093
1093
  */
1094
1094
  deviceId: string
1095
- /** dps 科学变化的数据 */
1095
+ /** dps */
1096
1096
  dps?: Record<string, {}>
1097
1097
  complete?: () => void
1098
1098
  success?: (params: null) => void
@@ -1115,7 +1115,7 @@ declare namespace ty.device {
1115
1115
  * 支持跨面板获取其他的设备信息,当前面板可以传当前设备的 id 来进行获取
1116
1116
  */
1117
1117
  deviceId: string
1118
- /** dps 科学变化的数据 */
1118
+ /** dps */
1119
1119
  dps?: Record<string, {}>
1120
1120
  complete?: () => void
1121
1121
  success?: (params: null) => void
@@ -1138,7 +1138,7 @@ declare namespace ty.device {
1138
1138
  * 支持跨面板获取其他的设备信息,当前面板可以传当前设备的 id 来进行获取
1139
1139
  */
1140
1140
  deviceId: string
1141
- /** dps 科学变化的数据 */
1141
+ /** dps */
1142
1142
  dps?: Record<string, {}>
1143
1143
  complete?: () => void
1144
1144
  success?: (params: null) => void
@@ -1161,7 +1161,7 @@ declare namespace ty.device {
1161
1161
  * 支持跨面板获取其他的设备信息,当前面板可以传当前设备的 id 来进行获取
1162
1162
  */
1163
1163
  deviceId: string
1164
- /** dps 科学变化的数据 */
1164
+ /** dps */
1165
1165
  dps?: Record<string, {}>
1166
1166
  complete?: () => void
1167
1167
  success?: (params: null) => void
@@ -1184,7 +1184,7 @@ declare namespace ty.device {
1184
1184
  * 支持跨面板获取其他的设备信息,当前面板可以传当前设备的 id 来进行获取
1185
1185
  */
1186
1186
  deviceId: string
1187
- /** dps 科学变化的数据 */
1187
+ /** dps */
1188
1188
  dps?: Record<string, {}>
1189
1189
  complete?: () => void
1190
1190
  success?: (params: {
@@ -1210,10 +1210,12 @@ declare namespace ty.device {
1210
1210
  * 支持跨面板获取其他的设备信息,当前面板可以传当前设备的 id 来进行获取
1211
1211
  */
1212
1212
  deviceId: string
1213
- /** dps 科学变化的数据 */
1213
+ /** dps */
1214
1214
  dps?: Record<string, {}>
1215
1215
  complete?: () => void
1216
1216
  success?: (params: {
1217
+ /** 设备所处房间名 */
1218
+ roomName?: string
1217
1219
  /** 产品信息,schema,功能定义都在里面 */
1218
1220
  schema: {}[]
1219
1221
  /**
@@ -1226,6 +1228,11 @@ declare namespace ty.device {
1226
1228
  * 产品属性定义,在 backend-ng 平台上可查到对应配置,使用二进制位运算的方式进行管理
1227
1229
  */
1228
1230
  attribute: number
1231
+ /**
1232
+ * baseAttribute
1233
+ * 基础产品属性定义
1234
+ */
1235
+ baseAttribute: number
1229
1236
  /**
1230
1237
  * capability
1231
1238
  * 产品能力值,在 backend-ng 平台上可以查询对应的勾选项,整体业务逻辑会根据该数据进行划分
@@ -1301,7 +1308,7 @@ declare namespace ty.device {
1301
1308
  * parentId
1302
1309
  * 上级节点 id,子设备/或蓝牙 mesh 设备通常会有该字段,用于内部寻找相关的网关或上级模型来进行业务处理
1303
1310
  */
1304
- parentId: string
1311
+ parentId?: string
1305
1312
  /**
1306
1313
  * category
1307
1314
  * 产品的分类
@@ -1311,7 +1318,7 @@ declare namespace ty.device {
1311
1318
  * standSchemaModel
1312
1319
  * 标准产品功能集定义模型
1313
1320
  */
1314
- standSchemaModel: {}
1321
+ standSchemaModel?: {}
1315
1322
  /**
1316
1323
  * productId
1317
1324
  * 设备对应的产品 id
@@ -1319,7 +1326,7 @@ declare namespace ty.device {
1319
1326
  productId: string
1320
1327
  /**
1321
1328
  * bizAttribute
1322
- * 设备自主上报的能力位, 对应baseAttribute
1329
+ * 业务属性能力
1323
1330
  */
1324
1331
  bizAttribute: number
1325
1332
  /**
@@ -1370,7 +1377,7 @@ declare namespace ty.device {
1370
1377
  /** 设备经度 */
1371
1378
  longitude: string
1372
1379
  /** 设备ip地址 */
1373
- ip: string
1380
+ ip?: string
1374
1381
  /** 是否为虚拟设备 */
1375
1382
  isVirtualDevice: boolean
1376
1383
  /** zigbeeInstallCode to the cloud to mark the gateway with installation code ability */
@@ -1383,6 +1390,41 @@ declare namespace ty.device {
1383
1390
  mac?: string
1384
1391
  /** 蓝牙的设备能力值,由设备进行上报 */
1385
1392
  bluetoothCapability?: string
1393
+ /** 是否三方matter设备 */
1394
+ isTripartiteMatter: boolean
1395
+ /** 是否网关设备 */
1396
+ isGW: boolean
1397
+ /** 是否支持群组 */
1398
+ isSupportGroup: boolean
1399
+ /** 是否zigbee子设备 */
1400
+ isZigBeeSubDev: boolean
1401
+ /** cadv版本号 */
1402
+ cadv?: string
1403
+ /** 设备是否支持OTA */
1404
+ isSupportOTA: boolean
1405
+ /** 设备图标 */
1406
+ iconUrl: string
1407
+ /** 设备是否有Wi-Fi模块 */
1408
+ hasWifi: boolean
1409
+ /** 快捷控制dp */
1410
+ switchDp: number
1411
+ /** 快捷控制dp */
1412
+ switchDps: number[]
1413
+ /** 设备Wi-Fi模块的状态:1:不可用 2:可用 */
1414
+ wifiEnableState: number
1415
+ /** 设备产品配置 */
1416
+ configMetas: Record<string, {}>
1417
+ /** 是否为matter设备 */
1418
+ isMatter: boolean
1419
+ /** 设备是否支持双控 */
1420
+ isSupportLink: boolean
1421
+ /** 是否支持将设备添加到苹果家庭中 */
1422
+ isSupportAppleHomeKit?: boolean
1423
+ /**
1424
+ * attribute 格式化的二进制字符串
1425
+ * 产品属性定义,在 backend-ng 平台上可查到对应配置,使用二进制位运算的方式进行管理
1426
+ */
1427
+ attributeString: string
1386
1428
  }) => void
1387
1429
  fail?: (params: {
1388
1430
  errorMsg: string
@@ -1550,6 +1592,11 @@ declare namespace ty.device {
1550
1592
  * 产品版本
1551
1593
  */
1552
1594
  productVer: string
1595
+ /**
1596
+ * attribute 格式化的二进制字符串
1597
+ * 产品属性定义,在 backend-ng 平台上可查到对应配置,使用二进制位运算的方式进行管理
1598
+ */
1599
+ attributeString: string
1553
1600
  }) => void
1554
1601
  fail?: (params: {
1555
1602
  errorMsg: string
@@ -1850,7 +1897,7 @@ declare namespace ty.device {
1850
1897
  * 支持跨面板获取其他的设备信息,当前面板可以传当前设备的 id 来进行获取
1851
1898
  */
1852
1899
  deviceId: string
1853
- /** dps 科学变化的数据 */
1900
+ /** dps */
1854
1901
  dps?: Record<string, {}>
1855
1902
  complete?: () => void
1856
1903
  success?: (params: {
@@ -2123,6 +2170,55 @@ declare namespace ty.device {
2123
2170
  }) => void
2124
2171
  }): void
2125
2172
 
2173
+ /**
2174
+ * 请求dp点的高级能力
2175
+ */
2176
+ export function requestAdvancedCapability(params: {
2177
+ /** 设备/群组 id */
2178
+ resId: string
2179
+ /** dpCodes */
2180
+ dpCodes: string[]
2181
+ /** 设备:"6" 群组:"5" */
2182
+ type: string
2183
+ /** 当前空间id */
2184
+ spaceId: number
2185
+ complete?: () => void
2186
+ success?: (params: null) => void
2187
+ fail?: (params: {
2188
+ errorMsg: string
2189
+ errorCode: string | number
2190
+ innerError: {
2191
+ errorCode: string | number
2192
+ errorMsg: string
2193
+ }
2194
+ }) => void
2195
+ }): void
2196
+
2197
+ /**
2198
+ * 需要先调用requestAdvancedCapability方法获取高级能力后,才可以调用此方法进行dp数据高级能力转换
2199
+ */
2200
+ export function dpTranslateAdvancedCapability(params: {
2201
+ /** 设备/群组 id */
2202
+ resId: string
2203
+ /** 需要转换的dps */
2204
+ dps: OriginalDps[]
2205
+ /** 设备:"6" 群组:"5" */
2206
+ type: string
2207
+ complete?: () => void
2208
+ success?: (params: {
2209
+ /** 转换后的高级能力 */
2210
+ advancedCapability: TranslateAdvancedCapability[]
2211
+ }) => void
2212
+ fail?: (params: {
2213
+ errorMsg: string
2214
+ errorCode: string | number
2215
+ innerError: {
2216
+ errorCode: string | number
2217
+ errorMsg: string
2218
+ }
2219
+ }) => void
2220
+ }): void
2221
+
2126
2222
  /**
2127
2223
  * 检查固件升级信息
2128
2224
  */
@@ -2778,9 +2874,143 @@ declare namespace ty.device {
2778
2874
  }) => void
2779
2875
  }): void
2780
2876
 
2877
+ /**
2878
+ * 获取设备详情App侧配置信息
2879
+ */
2880
+ export function getDeviceDetailConfiguration(params?: {
2881
+ complete?: () => void
2882
+ success?: (params: {
2883
+ /** 定制业务配置项 */
2884
+ customConfiguration: {}[]
2885
+ /** 有实现的子功能列表 */
2886
+ hasImplFunctionList: string[]
2887
+ }) => void
2888
+ fail?: (params: {
2889
+ errorMsg: string
2890
+ errorCode: string | number
2891
+ innerError: {
2892
+ errorCode: string | number
2893
+ errorMsg: string
2894
+ }
2895
+ }) => void
2896
+ }): void
2897
+
2898
+ /**
2899
+ * 分发设备详情子功能事件
2900
+ */
2901
+ export function dispatchSubFunctionTouchEvent(params: {
2902
+ /** 子功能id */
2903
+ id: string
2904
+ /** 名称 */
2905
+ name?: string
2906
+ /** 子功能显示类型 */
2907
+ type?: string
2908
+ /** 子功能分组类型 */
2909
+ optionType?: string
2910
+ /** 子功能来源:RN|小程序|APP */
2911
+ from?: string
2912
+ /** 排序 */
2913
+ order?: number
2914
+ /** 是否隐藏 */
2915
+ isHide?: boolean
2916
+ /** 业务参数 */
2917
+ data?: Record<string, {}>
2918
+ complete?: () => void
2919
+ success?: (params: null) => void
2920
+ fail?: (params: {
2921
+ errorMsg: string
2922
+ errorCode: string | number
2923
+ innerError: {
2924
+ errorCode: string | number
2925
+ errorMsg: string
2926
+ }
2927
+ }) => void
2928
+ }): void
2929
+
2930
+ /**
2931
+ * 分发子功能数据结果
2932
+ */
2933
+ export function dispatchDataResult(params: {
2934
+ /** 子功能id */
2935
+ id: string
2936
+ /** 名称 */
2937
+ name?: string
2938
+ /** 子功能显示类型 */
2939
+ type?: string
2940
+ /** 子功能分组类型 */
2941
+ optionType?: string
2942
+ /** 子功能来源:RN|小程序|APP */
2943
+ from?: string
2944
+ /** 排序 */
2945
+ order?: number
2946
+ /** 是否隐藏 */
2947
+ isHide?: boolean
2948
+ /** 业务参数 */
2949
+ data?: Record<string, {}>
2950
+ complete?: () => void
2951
+ success?: (params: null) => void
2952
+ fail?: (params: {
2953
+ errorMsg: string
2954
+ errorCode: string | number
2955
+ innerError: {
2956
+ errorCode: string | number
2957
+ errorMsg: string
2958
+ }
2959
+ }) => void
2960
+ }): void
2961
+
2962
+ /**
2963
+ * 子功能显示状态
2964
+ */
2965
+ export function getSubFunctionShowState(params: {
2966
+ /** 需要获取显示状态的子功能Id */
2967
+ ids: string[]
2968
+ /** 设备Id */
2969
+ deviceId?: string
2970
+ /** 群组Id */
2971
+ groupId?: number
2972
+ complete?: () => void
2973
+ success?: (params: {
2974
+ /** 需要监听的子功能列表 */
2975
+ showStateList: SubFunctionShowState[]
2976
+ }) => void
2977
+ fail?: (params: {
2978
+ errorMsg: string
2979
+ errorCode: string | number
2980
+ innerError: {
2981
+ errorCode: string | number
2982
+ errorMsg: string
2983
+ }
2984
+ }) => void
2985
+ }): void
2986
+
2987
+ /**
2988
+ * 获取子功能额外的显示数据
2989
+ */
2990
+ export function getSubFunctionExtShowData(params: {
2991
+ /** 子功能id */
2992
+ id: string
2993
+ /** 查询参数 / 返回的数据 */
2994
+ data?: Record<string, {}>
2995
+ complete?: () => void
2996
+ success?: (params: {
2997
+ /** 子功能id */
2998
+ id: string
2999
+ /** 查询参数 / 返回的数据 */
3000
+ data?: Record<string, {}>
3001
+ }) => void
3002
+ fail?: (params: {
3003
+ errorMsg: string
3004
+ errorCode: string | number
3005
+ innerError: {
3006
+ errorCode: string | number
3007
+ errorMsg: string
3008
+ }
3009
+ }) => void
3010
+ }): void
3011
+
2781
3012
  /**
2782
3013
  * 打开推荐场景详情页面
2783
- *详细文档链接:https://wiki.tuya-inc.com:7799/page/1456192108871295013
2784
3014
  */
2785
3015
  export function openRecommendSceneDetail(params: {
2786
3016
  /** 来源 */
@@ -3050,7 +3280,7 @@ declare namespace ty.device {
3050
3280
  /** groupId 群组id */
3051
3281
  groupId: string
3052
3282
  /** deviceList 设备列表 */
3053
- deviceList: DeviceInfo_cBjmel[]
3283
+ deviceList: DeviceInfo_GIIYoW[]
3054
3284
  }) => void
3055
3285
  fail?: (params: {
3056
3286
  errorMsg: string
@@ -3303,7 +3533,7 @@ declare namespace ty.device {
3303
3533
  /** The custom DP name. */
3304
3534
  dpName: {}
3305
3535
  /** The device list. */
3306
- deviceList: DeviceInfo_cBjmel[]
3536
+ deviceList: DeviceInfo_GIIYoW[]
3307
3537
  /** The local short address of groups. */
3308
3538
  localId: string
3309
3539
  /** The subclass. */
@@ -3597,7 +3827,22 @@ declare namespace ty.device {
3597
3827
  * 0:属性, 1:动作, 2:事件
3598
3828
  */
3599
3829
  type: number
3600
- /** payload */
3830
+ /**
3831
+ * Example:
3832
+ * type == property:
3833
+ * payload = {
3834
+ * "color":"green",
3835
+ * "brightness": 50
3836
+ * }
3837
+ * type == action:
3838
+ * payload = {
3839
+ * "actionCode": "testAction",
3840
+ * "inputParams": {
3841
+ * "inputParam1":"value1",
3842
+ * "inputParam2":"value2"
3843
+ * }
3844
+ * }
3845
+ */
3601
3846
  payload: Record<string, any>
3602
3847
  complete?: () => void
3603
3848
  success?: (params: null) => void
@@ -3647,6 +3892,27 @@ declare namespace ty.device {
3647
3892
  }) => void
3648
3893
  }): void
3649
3894
 
3895
+ /**
3896
+ * 初始化虚拟设备
3897
+ */
3898
+ export function initVirtualDevice(params: {
3899
+ /** 产品id */
3900
+ pid: string
3901
+ complete?: () => void
3902
+ success?: (params: {
3903
+ /** 设备id */
3904
+ devId: string
3905
+ }) => void
3906
+ fail?: (params: {
3907
+ errorMsg: string
3908
+ errorCode: string | number
3909
+ innerError: {
3910
+ errorCode: string | number
3911
+ errorMsg: string
3912
+ }
3913
+ }) => void
3914
+ }): void
3915
+
3650
3916
  /**
3651
3917
  * 远离beacon设备的事件
3652
3918
  */
@@ -3818,12 +4084,12 @@ declare namespace ty.device {
3818
4084
  /**
3819
4085
  * 设备信息变化
3820
4086
  */
3821
- export function onDeviceInfoUpdated(listener: (params: Device_UB2pYG) => void): void
4087
+ export function onDeviceInfoUpdated(listener: (params: Device_ZZifb8) => void): void
3822
4088
 
3823
4089
  /**
3824
4090
  * 取消监听:设备信息变化
3825
4091
  */
3826
- export function offDeviceInfoUpdated(listener: (params: Device_UB2pYG) => void): void
4092
+ export function offDeviceInfoUpdated(listener: (params: Device_ZZifb8) => void): void
3827
4093
 
3828
4094
  /**
3829
4095
  * 设备移除事件
@@ -3848,42 +4114,42 @@ declare namespace ty.device {
3848
4114
  /**
3849
4115
  * 网关子设备dp信息变化事件
3850
4116
  */
3851
- export function onSubDeviceDpUpdate(listener: (params: Device_UB2pYG) => void): void
4117
+ export function onSubDeviceDpUpdate(listener: (params: Device_ZZifb8) => void): void
3852
4118
 
3853
4119
  /**
3854
4120
  * 取消监听:网关子设备dp信息变化事件
3855
4121
  */
3856
- export function offSubDeviceDpUpdate(listener: (params: Device_UB2pYG) => void): void
4122
+ export function offSubDeviceDpUpdate(listener: (params: Device_ZZifb8) => void): void
3857
4123
 
3858
4124
  /**
3859
4125
  * 网关子设备被移除事件
3860
4126
  */
3861
- export function onSubDeviceRemoved(listener: (params: Device_UB2pYG) => void): void
4127
+ export function onSubDeviceRemoved(listener: (params: Device_ZZifb8) => void): void
3862
4128
 
3863
4129
  /**
3864
4130
  * 取消监听:网关子设备被移除事件
3865
4131
  */
3866
- export function offSubDeviceRemoved(listener: (params: Device_UB2pYG) => void): void
4132
+ export function offSubDeviceRemoved(listener: (params: Device_ZZifb8) => void): void
3867
4133
 
3868
4134
  /**
3869
4135
  * 网关添加子设备的事件
3870
4136
  */
3871
- export function onSubDeviceAdded(listener: (params: Device_UB2pYG) => void): void
4137
+ export function onSubDeviceAdded(listener: (params: Device_ZZifb8) => void): void
3872
4138
 
3873
4139
  /**
3874
4140
  * 取消监听:网关添加子设备的事件
3875
4141
  */
3876
- export function offSubDeviceAdded(listener: (params: Device_UB2pYG) => void): void
4142
+ export function offSubDeviceAdded(listener: (params: Device_ZZifb8) => void): void
3877
4143
 
3878
4144
  /**
3879
4145
  * 网关子设备信息变化的事件
3880
4146
  */
3881
- export function onSubDeviceInfoUpdate(listener: (params: Device_UB2pYG) => void): void
4147
+ export function onSubDeviceInfoUpdate(listener: (params: Device_ZZifb8) => void): void
3882
4148
 
3883
4149
  /**
3884
4150
  * 取消监听:网关子设备信息变化的事件
3885
4151
  */
3886
- export function offSubDeviceInfoUpdate(listener: (params: Device_UB2pYG) => void): void
4152
+ export function offSubDeviceInfoUpdate(listener: (params: Device_ZZifb8) => void): void
3887
4153
 
3888
4154
  /**
3889
4155
  * 定时变化事件
@@ -3895,6 +4161,26 @@ declare namespace ty.device {
3895
4161
  */
3896
4162
  export function offTimerUpdate(listener: (params: {}) => void): void
3897
4163
 
4164
+ /**
4165
+ * 子功能数据变化事件
4166
+ */
4167
+ export function onSubFunctionDataChange(listener: (params: SubFunctionParams) => void): void
4168
+
4169
+ /**
4170
+ * 取消监听:子功能数据变化事件
4171
+ */
4172
+ export function offSubFunctionDataChange(listener: (params: SubFunctionParams) => void): void
4173
+
4174
+ /**
4175
+ * 子功能分发事件
4176
+ */
4177
+ export function onDispatchEvent(listener: (params: SubFunctionParams) => void): void
4178
+
4179
+ /**
4180
+ * 取消监听:子功能分发事件
4181
+ */
4182
+ export function offDispatchEvent(listener: (params: SubFunctionParams) => void): void
4183
+
3898
4184
  /**
3899
4185
  * 群组内增加/移除设备事件
3900
4186
  */
@@ -3966,6 +4252,8 @@ declare namespace ty.device {
3966
4252
  }
3967
4253
 
3968
4254
  export type DeviceInfo = {
4255
+ /** 设备所处房间名 */
4256
+ roomName?: string
3969
4257
  /** 产品信息,schema,功能定义都在里面 */
3970
4258
  schema: {}[]
3971
4259
  /**
@@ -3978,6 +4266,11 @@ declare namespace ty.device {
3978
4266
  * 产品属性定义,在 backend-ng 平台上可查到对应配置,使用二进制位运算的方式进行管理
3979
4267
  */
3980
4268
  attribute: number
4269
+ /**
4270
+ * baseAttribute
4271
+ * 基础产品属性定义
4272
+ */
4273
+ baseAttribute: number
3981
4274
  /**
3982
4275
  * capability
3983
4276
  * 产品能力值,在 backend-ng 平台上可以查询对应的勾选项,整体业务逻辑会根据该数据进行划分
@@ -4053,7 +4346,7 @@ declare namespace ty.device {
4053
4346
  * parentId
4054
4347
  * 上级节点 id,子设备/或蓝牙 mesh 设备通常会有该字段,用于内部寻找相关的网关或上级模型来进行业务处理
4055
4348
  */
4056
- parentId: string
4349
+ parentId?: string
4057
4350
  /**
4058
4351
  * category
4059
4352
  * 产品的分类
@@ -4063,7 +4356,7 @@ declare namespace ty.device {
4063
4356
  * standSchemaModel
4064
4357
  * 标准产品功能集定义模型
4065
4358
  */
4066
- standSchemaModel: {}
4359
+ standSchemaModel?: {}
4067
4360
  /**
4068
4361
  * productId
4069
4362
  * 设备对应的产品 id
@@ -4071,7 +4364,7 @@ declare namespace ty.device {
4071
4364
  productId: string
4072
4365
  /**
4073
4366
  * bizAttribute
4074
- * 设备自主上报的能力位, 对应baseAttribute
4367
+ * 业务属性能力
4075
4368
  */
4076
4369
  bizAttribute: number
4077
4370
  /**
@@ -4122,7 +4415,7 @@ declare namespace ty.device {
4122
4415
  /** 设备经度 */
4123
4416
  longitude: string
4124
4417
  /** 设备ip地址 */
4125
- ip: string
4418
+ ip?: string
4126
4419
  /** 是否为虚拟设备 */
4127
4420
  isVirtualDevice: boolean
4128
4421
  /** zigbeeInstallCode to the cloud to mark the gateway with installation code ability */
@@ -4135,10 +4428,63 @@ declare namespace ty.device {
4135
4428
  mac?: string
4136
4429
  /** 蓝牙的设备能力值,由设备进行上报 */
4137
4430
  bluetoothCapability?: string
4431
+ /** 是否三方matter设备 */
4432
+ isTripartiteMatter: boolean
4433
+ /** 是否网关设备 */
4434
+ isGW: boolean
4435
+ /** 是否支持群组 */
4436
+ isSupportGroup: boolean
4437
+ /** 是否zigbee子设备 */
4438
+ isZigBeeSubDev: boolean
4439
+ /** cadv版本号 */
4440
+ cadv?: string
4441
+ /** 设备是否支持OTA */
4442
+ isSupportOTA: boolean
4443
+ /** 设备图标 */
4444
+ iconUrl: string
4445
+ /** 设备是否有Wi-Fi模块 */
4446
+ hasWifi: boolean
4447
+ /** 快捷控制dp */
4448
+ switchDp: number
4449
+ /** 快捷控制dp */
4450
+ switchDps: number[]
4451
+ /** 设备Wi-Fi模块的状态:1:不可用 2:可用 */
4452
+ wifiEnableState: number
4453
+ /** 设备产品配置 */
4454
+ configMetas: Record<string, {}>
4455
+ /** 是否为matter设备 */
4456
+ isMatter: boolean
4457
+ /** 设备是否支持双控 */
4458
+ isSupportLink: boolean
4459
+ /** 是否支持将设备添加到苹果家庭中 */
4460
+ isSupportAppleHomeKit?: boolean
4461
+ /**
4462
+ * attribute 格式化的二进制字符串
4463
+ * 产品属性定义,在 backend-ng 平台上可查到对应配置,使用二进制位运算的方式进行管理
4464
+ */
4465
+ attributeString: string
4138
4466
  }
4139
4467
 
4140
4468
  export type Object = {}
4141
4469
 
4470
+ export type OriginalDps = {
4471
+ /** dpId */
4472
+ dpId: string
4473
+ /** dpCode */
4474
+ dpCode: string
4475
+ /** dpValue */
4476
+ dpValue: {}
4477
+ }
4478
+
4479
+ export type TranslateAdvancedCapability = {
4480
+ /** dpCode */
4481
+ dpCode: string
4482
+ /** 转换后的值 */
4483
+ translatedValue: string
4484
+ /** 单位 */
4485
+ unit: string
4486
+ }
4487
+
4142
4488
  export type TimerConfig = {
4143
4489
  /**
4144
4490
  * background
@@ -4286,10 +4632,19 @@ declare namespace ty.device {
4286
4632
  attributeKey: string
4287
4633
  /** attributeSign */
4288
4634
  attributeSign: number
4635
+ /** widgetUrl */
4636
+ widgetUrl: string
4289
4637
  /** 包含云端完整字段的 json 对象 */
4290
4638
  originJson: Record<string, {}>
4291
4639
  }
4292
4640
 
4641
+ export type SubFunctionShowState = {
4642
+ /** 子功能Id */
4643
+ id: string
4644
+ /** 是否显示 */
4645
+ isShow: boolean
4646
+ }
4647
+
4293
4648
  export type SceneAction = {
4294
4649
  /** 条件 ID */
4295
4650
  id?: string
@@ -4346,6 +4701,8 @@ declare namespace ty.device {
4346
4701
  actionDisplayNew?: Record<string, {}>
4347
4702
  /** 执行状态 */
4348
4703
  status?: boolean
4704
+ /** 批量控制设备的数据 */
4705
+ relationGroup?: Record<string, {}>
4349
4706
  }
4350
4707
 
4351
4708
  export type Expr = {
@@ -4365,7 +4722,7 @@ declare namespace ty.device {
4365
4722
  cityName: string
4366
4723
  }
4367
4724
 
4368
- export type DeviceInfo_cBjmel = {
4725
+ export type DeviceInfo_GIIYoW = {
4369
4726
  /** 产品信息,schema,功能定义都在里面 */
4370
4727
  schema: {}[]
4371
4728
  /**
@@ -4673,13 +5030,13 @@ declare namespace ty.device {
4673
5030
  onlineType: number
4674
5031
  }
4675
5032
 
4676
- export type Device_UB2pYG = {
5033
+ export type Device_ZZifb8 = {
4677
5034
  /**
4678
5035
  * deviceId 设备id
4679
5036
  * 支持跨面板获取其他的设备信息,当前面板可以传当前设备的 id 来进行获取
4680
5037
  */
4681
5038
  deviceId: string
4682
- /** dps 科学变化的数据 */
5039
+ /** dps */
4683
5040
  dps?: Record<string, {}>
4684
5041
  }
4685
5042
 
@@ -4697,6 +5054,25 @@ declare namespace ty.device {
4697
5054
  connectState: number
4698
5055
  }
4699
5056
 
5057
+ export type SubFunctionParams = {
5058
+ /** 子功能id */
5059
+ id: string
5060
+ /** 名称 */
5061
+ name?: string
5062
+ /** 子功能显示类型 */
5063
+ type?: string
5064
+ /** 子功能分组类型 */
5065
+ optionType?: string
5066
+ /** 子功能来源:RN|小程序|APP */
5067
+ from?: string
5068
+ /** 排序 */
5069
+ order?: number
5070
+ /** 是否隐藏 */
5071
+ isHide?: boolean
5072
+ /** 业务参数 */
5073
+ data?: Record<string, {}>
5074
+ }
5075
+
4700
5076
  export type GroupInfoResponse = {
4701
5077
  /** groupId 群组id */
4702
5078
  groupId: string
@@ -4924,6 +5300,11 @@ declare namespace ty.device {
4924
5300
  * 产品版本
4925
5301
  */
4926
5302
  productVer: string
5303
+ /**
5304
+ * attribute 格式化的二进制字符串
5305
+ * 产品属性定义,在 backend-ng 平台上可查到对应配置,使用二进制位运算的方式进行管理
5306
+ */
5307
+ attributeString: string
4927
5308
  }
4928
5309
 
4929
5310
  export type Mesh = {
@@ -5073,6 +5454,31 @@ declare namespace ty.device {
5073
5454
  topicList: string[]
5074
5455
  }
5075
5456
 
5457
+ export type AdvancedCapabilityParams = {
5458
+ /** 设备/群组 id */
5459
+ resId: string
5460
+ /** dpCodes */
5461
+ dpCodes: string[]
5462
+ /** 设备:"6" 群组:"5" */
5463
+ type: string
5464
+ /** 当前空间id */
5465
+ spaceId: number
5466
+ }
5467
+
5468
+ export type TranslateAdvancedCapabilityParams = {
5469
+ /** 设备/群组 id */
5470
+ resId: string
5471
+ /** 需要转换的dps */
5472
+ dps: OriginalDps[]
5473
+ /** 设备:"6" 群组:"5" */
5474
+ type: string
5475
+ }
5476
+
5477
+ export type TranslateAdvancedCapabilityResponse = {
5478
+ /** 转换后的高级能力 */
5479
+ advancedCapability: TranslateAdvancedCapability[]
5480
+ }
5481
+
5076
5482
  export type OTAUpdateInfoParams = {
5077
5483
  /**
5078
5484
  * deviceId
@@ -5382,7 +5788,7 @@ declare namespace ty.device {
5382
5788
  warningText: string
5383
5789
  }
5384
5790
 
5385
- export type Device_fDm5Lu = {
5791
+ export type Device_ACEDBp = {
5386
5792
  /**
5387
5793
  * deviceId
5388
5794
  * 设备 id
@@ -5427,6 +5833,34 @@ declare namespace ty.device {
5427
5833
  services: ThirdPartyService[]
5428
5834
  }
5429
5835
 
5836
+ export type ConfigurationResponse = {
5837
+ /** 定制业务配置项 */
5838
+ customConfiguration: {}[]
5839
+ /** 有实现的子功能列表 */
5840
+ hasImplFunctionList: string[]
5841
+ }
5842
+
5843
+ export type SubFunctionShowParams = {
5844
+ /** 需要获取显示状态的子功能Id */
5845
+ ids: string[]
5846
+ /** 设备Id */
5847
+ deviceId?: string
5848
+ /** 群组Id */
5849
+ groupId?: number
5850
+ }
5851
+
5852
+ export type SubFunctionShowResponse = {
5853
+ /** 需要监听的子功能列表 */
5854
+ showStateList: SubFunctionShowState[]
5855
+ }
5856
+
5857
+ export type SubFunctionExtShowData = {
5858
+ /** 子功能id */
5859
+ id: string
5860
+ /** 查询参数 / 返回的数据 */
5861
+ data?: Record<string, {}>
5862
+ }
5863
+
5430
5864
  export type UiComponent = {
5431
5865
  /** 组件code */
5432
5866
  code: string
@@ -5632,7 +6066,7 @@ declare namespace ty.device {
5632
6066
  /** groupId 群组id */
5633
6067
  groupId: string
5634
6068
  /** deviceList 设备列表 */
5635
- deviceList: DeviceInfo_cBjmel[]
6069
+ deviceList: DeviceInfo_GIIYoW[]
5636
6070
  }
5637
6071
 
5638
6072
  export type DeviceNumResponse = {
@@ -5786,7 +6220,7 @@ declare namespace ty.device {
5786
6220
  /** The custom DP name. */
5787
6221
  dpName: {}
5788
6222
  /** The device list. */
5789
- deviceList: DeviceInfo_cBjmel[]
6223
+ deviceList: DeviceInfo_GIIYoW[]
5790
6224
  /** The local short address of groups. */
5791
6225
  localId: string
5792
6226
  /** The subclass. */
@@ -5937,7 +6371,22 @@ declare namespace ty.device {
5937
6371
  * 0:属性, 1:动作, 2:事件
5938
6372
  */
5939
6373
  type: number
5940
- /** payload */
6374
+ /**
6375
+ * Example:
6376
+ * type == property:
6377
+ * payload = {
6378
+ * "color":"green",
6379
+ * "brightness": 50
6380
+ * }
6381
+ * type == action:
6382
+ * payload = {
6383
+ * "actionCode": "testAction",
6384
+ * "inputParams": {
6385
+ * "inputParam1":"value1",
6386
+ * "inputParam2":"value2"
6387
+ * }
6388
+ * }
6389
+ */
5941
6390
  payload: Record<string, any>
5942
6391
  }
5943
6392
 
@@ -5950,4 +6399,14 @@ declare namespace ty.device {
5950
6399
  /** 设备id */
5951
6400
  devId: string
5952
6401
  }
6402
+
6403
+ export type InitReq = {
6404
+ /** 产品id */
6405
+ pid: string
6406
+ }
6407
+
6408
+ export type InitRes = {
6409
+ /** 设备id */
6410
+ devId: string
6411
+ }
5953
6412
  }
@@ -188,3 +188,5 @@ export declare const registerGateWaySubDeviceListener: typeof ty.device.register
188
188
  export declare const unregisterGateWaySubDeviceListener: typeof ty.device.unregisterGateWaySubDeviceListener;
189
189
  export declare const getDeviceListByDevIds: typeof ty.device.getDeviceListByDevIds;
190
190
  export declare const sendMqttMessage: typeof ty.device.sendMqttMessage;
191
+ export declare const dispatchSubFunctionTouchEvent: typeof ty.device.dispatchSubFunctionTouchEvent;
192
+ export declare const onSubFunctionDataChange: typeof ty.device.onSubFunctionDataChange;
@@ -569,4 +569,11 @@ export const getDeviceListByDevIds = factory('getDeviceListByDevIds', {
569
569
  });
570
570
  export const sendMqttMessage = factory('sendMqttMessage', {
571
571
  "namespace": "device"
572
+ });
573
+ // 3.9.0 新增
574
+ export const dispatchSubFunctionTouchEvent = factory('dispatchSubFunctionTouchEvent', {
575
+ "namespace": "device"
576
+ });
577
+ export const onSubFunctionDataChange = factory('onSubFunctionDataChange', {
578
+ "namespace": "device"
572
579
  });
package/lib/index.d.ts CHANGED
@@ -31,3 +31,4 @@ export * from './cloud';
31
31
  */
32
32
  export * from './viewAPI';
33
33
  export * from './panel';
34
+ export * from './openGroupCreate';
package/lib/index.js CHANGED
@@ -33,4 +33,5 @@ export * from './cloud';
33
33
  * 0.10.3将一部分未支持的api导入
34
34
  */
35
35
  export * from './viewAPI';
36
- export * from './panel';
36
+ export * from './panel';
37
+ export * from './openGroupCreate';
@@ -0,0 +1,29 @@
1
+ interface OpenGroupCreateParams {
2
+ deviceId: string;
3
+ name?: string;
4
+ type?: string;
5
+ optionType?: string;
6
+ from?: 'RN' | '小程序' | 'APP';
7
+ order?: number;
8
+ isShow?: boolean;
9
+ success?: () => void;
10
+ fail?: (err?: {
11
+ errorMsg: string;
12
+ errorCode: string | number;
13
+ innerError: {
14
+ errorCode: string | number;
15
+ errorMsg: string;
16
+ };
17
+ }) => void;
18
+ complete?: () => void;
19
+ }
20
+ interface OnOpenSubFunctionCallbackParams {
21
+ data: {
22
+ groupCreateResult: boolean;
23
+ };
24
+ id: 'group_create';
25
+ isHide: boolean;
26
+ }
27
+ export declare function onOpenGroupCreate(callback: (res: OnOpenSubFunctionCallbackParams) => void): void;
28
+ export declare function openGroupCreate(params: OpenGroupCreateParams): Promise<void>;
29
+ export {};
@@ -0,0 +1,39 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ const _excluded = ["deviceId", "success", "fail", "complete"];
4
+ export function onOpenGroupCreate(callback) {
5
+ ty.device.onSubFunctionDataChange(res => {
6
+ if (res.id === 'group_create') {
7
+ callback(res);
8
+ }
9
+ });
10
+ }
11
+ export function openGroupCreate(params) {
12
+ const {
13
+ deviceId,
14
+ success,
15
+ fail,
16
+ complete
17
+ } = params,
18
+ rest = _objectWithoutProperties(params, _excluded);
19
+ return new Promise((resolve, reject) => {
20
+ ty.device.dispatchSubFunctionTouchEvent(_objectSpread(_objectSpread({
21
+ id: 'group_create',
22
+ data: {
23
+ deviceId: deviceId
24
+ }
25
+ }, rest), {}, {
26
+ success() {
27
+ success === null || success === void 0 ? void 0 : success();
28
+ resolve();
29
+ },
30
+ fail(err) {
31
+ fail === null || fail === void 0 ? void 0 : fail(err);
32
+ reject(err);
33
+ },
34
+ complete() {
35
+ complete === null || complete === void 0 ? void 0 : complete();
36
+ }
37
+ }));
38
+ });
39
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/api",
3
- "version": "1.4.20",
3
+ "version": "1.4.22",
4
4
  "description": "Ray universal api",
5
5
  "keywords": [
6
6
  "ray"
@@ -29,13 +29,13 @@
29
29
  "watch": "ray start --type=component"
30
30
  },
31
31
  "dependencies": {
32
- "@ray-js/framework": "1.4.20",
33
- "@ray-js/router": "1.4.20",
32
+ "@ray-js/framework": "1.4.22",
33
+ "@ray-js/router": "1.4.22",
34
34
  "@ray-js/wechat": "^0.0.33",
35
35
  "base64-browser": "^1.0.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@ray-js/cli": "1.4.20",
38
+ "@ray-js/cli": "1.4.22",
39
39
  "art-template": "^4.13.2",
40
40
  "fs-extra": "^10.1.0",
41
41
  "miniprogram-api-typings": "^3.12.0",
@@ -45,5 +45,5 @@
45
45
  "access": "public",
46
46
  "registry": "https://registry.npmjs.org"
47
47
  },
48
- "gitHead": "010807959cdbaca6a74e23602cd4bbd15839b6c5"
48
+ "gitHead": "2f2f4f4d1aeb121755ccc82f5c1145e24eefa60f"
49
49
  }