Commit 7e4db009 authored by chen.weican's avatar chen.weican

【修改内容】1,修改网关名字同步后显示不正常的BUG;2,修改快照上报不触发IFTT

【提交人】陈伟灿
parent e58f0462
...@@ -29,7 +29,8 @@ int kk_check_config_file(char* path,char **config) ...@@ -29,7 +29,8 @@ int kk_check_config_file(char* path,char **config)
{ {
FILE *fp; FILE *fp;
int filesize = 0; int filesize = 0;
char *buf = NULL; char *buf = NULL;
INFO_PRINT("path:%s\n",path);
if((access(path,F_OK)) == 0){ if((access(path,F_OK)) == 0){
fp = fopen(path, "r"); fp = fopen(path, "r");
if(fp != NULL){ if(fp != NULL){
......
...@@ -161,9 +161,9 @@ cJSON *kk_scene_build(SYN_SCENE_ITEM **content) ...@@ -161,9 +161,9 @@ cJSON *kk_scene_build(SYN_SCENE_ITEM **content)
} }
int kk_sync_actions(cJSON *actions,SYN_SCENE_ACTION **act,char **room_id) int kk_sync_actions(cJSON *actions,SYN_SCENE_ACTION **act)
{ {
cJSON *deviceCode,*delay,*epNum,*propertyName,*type,*propertyValue,*roomId; cJSON *deviceCode,*delay,*epNum,*propertyName,*type,*propertyValue;
int i,num = cJSON_GetArraySize(actions); int i,num = cJSON_GetArraySize(actions);
int node = -1; int node = -1;
...@@ -186,7 +186,7 @@ int kk_sync_actions(cJSON *actions,SYN_SCENE_ACTION **act,char **room_id) ...@@ -186,7 +186,7 @@ int kk_sync_actions(cJSON *actions,SYN_SCENE_ACTION **act,char **room_id)
propertyName= cJSON_GetObjectItem(item,"propertyName"); propertyName= cJSON_GetObjectItem(item,"propertyName");
type= cJSON_GetObjectItem(item,"type"); type= cJSON_GetObjectItem(item,"type");
propertyValue= cJSON_GetObjectItem(item,"propertyValue"); propertyValue= cJSON_GetObjectItem(item,"propertyValue");
roomId= cJSON_GetObjectItem(item,"roomId");
ptr->ui_area = NULL; ptr->ui_area = NULL;
ptr->ui_name = NULL; ptr->ui_name = NULL;
...@@ -196,11 +196,6 @@ int kk_sync_actions(cJSON *actions,SYN_SCENE_ACTION **act,char **room_id) ...@@ -196,11 +196,6 @@ int kk_sync_actions(cJSON *actions,SYN_SCENE_ACTION **act,char **room_id)
ptr->operate_type ="*";//type->valuestring;//根据实际设备调整 ptr->operate_type ="*";//type->valuestring;//根据实际设备调整
ptr->operation = "*";//propertyValue->valuestring;// ptr->operation = "*";//propertyValue->valuestring;//
if(get_flag==0){
get_flag = 1;
*room_id = roomId->valuestring;
}
} }
return num; return num;
} }
...@@ -280,7 +275,7 @@ cJSON *kk_sync_scence_to_sdk(cJSON *root,cJSON *data) ...@@ -280,7 +275,7 @@ cJSON *kk_sync_scence_to_sdk(cJSON *root,cJSON *data)
{ {
cJSON *scenes = cJSON_GetObjectItem(data,SCENES_STR); cJSON *scenes = cJSON_GetObjectItem(data,SCENES_STR);
cJSON *actions,*enable,*name,*sceneId,*sceneType,*trigger,*condition; cJSON *actions,*enable,*name,*sceneId,*sceneType,*trigger,*condition,*roomId;
int i,num = cJSON_GetArraySize(scenes); int i,num = cJSON_GetArraySize(scenes);
int k = 0,isMatch = 0; int k = 0,isMatch = 0;
...@@ -306,7 +301,11 @@ cJSON *kk_sync_scence_to_sdk(cJSON *root,cJSON *data) ...@@ -306,7 +301,11 @@ cJSON *kk_sync_scence_to_sdk(cJSON *root,cJSON *data)
sceneType= cJSON_GetObjectItem(item,SCENE_TYPE_STR); sceneType= cJSON_GetObjectItem(item,SCENE_TYPE_STR);
trigger= cJSON_GetObjectItem(item,SCENE_TRIGGER_STR); trigger= cJSON_GetObjectItem(item,SCENE_TRIGGER_STR);
condition= cJSON_GetObjectItem(item,CONDITION_STR); condition= cJSON_GetObjectItem(item,CONDITION_STR);
roomId = cJSON_GetObjectItem(item,ROOMS_ID_STR);
if(roomId == NULL){
INFO_PRINT("-------------------->NO ROOMID\n");
continue;
}
/*过滤多控 iftt,定时相关场景*/ /*过滤多控 iftt,定时相关场景*/
if(sceneType == NULL||sceneType->type!=cJSON_Number||sceneType->valueint != 0){ if(sceneType == NULL||sceneType->type!=cJSON_Number||sceneType->valueint != 0){
continue; continue;
...@@ -325,7 +324,7 @@ cJSON *kk_sync_scence_to_sdk(cJSON *root,cJSON *data) ...@@ -325,7 +324,7 @@ cJSON *kk_sync_scence_to_sdk(cJSON *root,cJSON *data)
if(isMatch == 0){ if(isMatch == 0){
pScene->scenetype = "100";//自定义场景 pScene->scenetype = "100";//自定义场景
} }
pScene->act_num = kk_sync_actions(actions,&pScene->act,&pScene->room_id); pScene->act_num = kk_sync_actions(actions,&pScene->act);
kk_sync_scene_condition(condition,&pScene); kk_sync_scene_condition(condition,&pScene);
...@@ -333,7 +332,7 @@ cJSON *kk_sync_scence_to_sdk(cJSON *root,cJSON *data) ...@@ -333,7 +332,7 @@ cJSON *kk_sync_scence_to_sdk(cJSON *root,cJSON *data)
pScene->scene_id = sceneId->valuestring; pScene->scene_id = sceneId->valuestring;
pScene->name = name->valuestring; pScene->name = name->valuestring;
pScene->pannel_id = NULL; pScene->pannel_id = NULL;
pScene->room_id = roomId->valuestring;
sceneItem = kk_scene_build(&pScene); sceneItem = kk_scene_build(&pScene);
cJSON_AddItemToArray(scenesAry,sceneItem); cJSON_AddItemToArray(scenesAry,sceneItem);
...@@ -561,15 +560,12 @@ static int _kk_sync_devices_status_arg_str(kk_map_dev_node_t *node,cJSON *devSta ...@@ -561,15 +560,12 @@ static int _kk_sync_devices_status_arg_str(kk_map_dev_node_t *node,cJSON *devSta
} }
num = cJSON_GetArraySize(newccu); num = cJSON_GetArraySize(newccu);
printf("[%s][%d]\n",__FUNCTION__,__LINE__);
for(i=0;i<num;i++){ for(i=0;i<num;i++){
cJSON * newccuItem = cJSON_GetArrayItem(newccu,i); cJSON * newccuItem = cJSON_GetArrayItem(newccu,i);
cJSON * oldccuItem = cJSON_GetArrayItem(oldccu,i); cJSON * oldccuItem = cJSON_GetArrayItem(oldccu,i);
cJSON *val = NULL; cJSON *val = NULL;
printf("[%s][%d]\n",__FUNCTION__,__LINE__);
if((val = val_conver_new2old(newccuItem,oldccuItem,0))!=NULL){ if((val = val_conver_new2old(newccuItem,oldccuItem,0))!=NULL){
printf("[%s][%d]\n",__FUNCTION__,__LINE__);
char indexId[16] = {0}; char indexId[16] = {0};
char nodeid[32] = {0}; char nodeid[32] = {0};
cJSON *epNum = cJSON_GetObjectItem(newccuItem,CHANNEL_STRING); cJSON *epNum = cJSON_GetObjectItem(newccuItem,CHANNEL_STRING);
......
...@@ -734,6 +734,7 @@ static int kk_service_addDeviceToRoom_handle(cJSON *params) ...@@ -734,6 +734,7 @@ static int kk_service_addDeviceToRoom_handle(cJSON *params)
sprintf(name,"空调%d",eplist[i]); sprintf(name,"空调%d",eplist[i]);
kk_room_dev_add(roomId->valuestring,room_name->valuestring,deviceCode->valuestring,epNumStr,name); kk_room_dev_add(roomId->valuestring,room_name->valuestring,deviceCode->valuestring,epNumStr,name);
} }
INFO_PRINT("addDeviceToRoom air gw count:%d\n",count);
} }
if(strcmp(node->productType,KK_DM_AIR_SWITCH_GATEWAY_TYPE) == 0 && isAirGwFlag == 2){ if(strcmp(node->productType,KK_DM_AIR_SWITCH_GATEWAY_TYPE) == 0 && isAirGwFlag == 2){
int eplist[64] = {0}; int eplist[64] = {0};
......
...@@ -741,9 +741,9 @@ int kk_indoorAir_query_epnums(const char *deviceCode,int epList[]) ...@@ -741,9 +741,9 @@ int kk_indoorAir_query_epnums(const char *deviceCode,int epList[])
if(count > 64){ if(count > 64){
return count; return count;
} }
printf("-----------------------------------------------kk_indoorAir_query_epnums\n"); INFO_PRINT("-----------------------------------------------kk_indoorAir_query_epnums count:%d\n",count);
epList[count] = sqlite3_column_int(stmt, DB_INDOORAIR_EPNUM); epList[count] = sqlite3_column_int(stmt, DB_INDOORAIR_EPNUM);
printf("epList[count] :%d\n",epList[count]); INFO_PRINT("epList[count] :%d\n",epList[count]);
count++; count++;
} }
sqlite3_free(sqlCmd); sqlite3_free(sqlCmd);
......
...@@ -811,6 +811,7 @@ static int kk_get_gw_devices_info(cJSON *gwdevices) ...@@ -811,6 +811,7 @@ static int kk_get_gw_devices_info(cJSON *gwdevices)
{ {
char *sqlCmd = NULL; char *sqlCmd = NULL;
char macaddr[33] = {0}; char macaddr[33] = {0};
char gwname[256] = {0};
//char *zErrMsg = 0; //char *zErrMsg = 0;
sqlite3_stmt *stmt; sqlite3_stmt *stmt;
//cJSON *gwdevicesItem = NULL; //cJSON *gwdevicesItem = NULL;
...@@ -839,8 +840,9 @@ static int kk_get_gw_devices_info(cJSON *gwdevices) ...@@ -839,8 +840,9 @@ static int kk_get_gw_devices_info(cJSON *gwdevices)
cJSON_AddStringToObject(gwdevicesItem, KK_SYNC_DEVICECODE_STR, gw_deviceCode); cJSON_AddStringToObject(gwdevicesItem, KK_SYNC_DEVICECODE_STR, gw_deviceCode);
cJSON_AddStringToObject(gwdevicesItem, KK_SYNC_VERSION_STR, gw_version); cJSON_AddStringToObject(gwdevicesItem, KK_SYNC_VERSION_STR, gw_version);
_kk_deviceCode_switchto_mac(gw_deviceCode,macaddr); _kk_deviceCode_switchto_mac(gw_deviceCode,macaddr);
cJSON_AddStringToObject(gwdevicesItem, KK_SYNC_MAC_STR, macaddr); cJSON_AddStringToObject(gwdevicesItem, KK_SYNC_MAC_STR, macaddr);
cJSON_AddStringToObject(gwdevicesItem, KK_SYNC_NANE_STR, "GW"); kk_property_db_get_value(gw_deviceCode,KK_SYNC_NANE_STR,gwname);
cJSON_AddStringToObject(gwdevicesItem, KK_SYNC_NANE_STR, gwname);
cJSON_AddNumberToObject(gwdevicesItem, KK_SYNC_ONLINE_STR, (strcmp(gw_isline,"0")==0)?1:0); cJSON_AddNumberToObject(gwdevicesItem, KK_SYNC_ONLINE_STR, (strcmp(gw_isline,"0")==0)?1:0);
cJSON_AddStringToObject(gwdevicesItem, KK_SYNC_PRODUCTCODE_STR, gw_productCode); cJSON_AddStringToObject(gwdevicesItem, KK_SYNC_PRODUCTCODE_STR, gw_productCode);
cJSON_AddStringToObject(gwdevicesItem, KK_SYNC_SN_STR, ""); cJSON_AddStringToObject(gwdevicesItem, KK_SYNC_SN_STR, "");
...@@ -1025,9 +1027,18 @@ static int kk_get_panel_scenes_actions_info(cJSON *actionItem,int id) ...@@ -1025,9 +1027,18 @@ static int kk_get_panel_scenes_actions_info(cJSON *actionItem,int id)
cJSON_AddStringToObject(actionItem, KK_SYNC_SCENE_PROPERTYNAME_STR, propertyName); cJSON_AddStringToObject(actionItem, KK_SYNC_SCENE_PROPERTYNAME_STR, propertyName);
} }
cJSON_AddStringToObject(actionItem, KK_SYNC_SCENE_TYPE_STR, type); cJSON_AddStringToObject(actionItem, KK_SYNC_SCENE_TYPE_STR, type);
cJSON_AddStringToObject(actionItem, KK_SYNC_SCENE_PROPERTYVALUE_STR, propertyValue); if(strstr(propertyValue,"{")!=NULL && strstr(propertyValue,"}")!=NULL){
cJSON* prtyObj = cJSON_Parse(propertyValue);
if(prtyObj != NULL){
cJSON_AddItemToObject(actionItem, KK_SYNC_SCENE_PROPERTYVALUE_STR, prtyObj);
}else{
cJSON_AddStringToObject(actionItem, KK_SYNC_SCENE_PROPERTYVALUE_STR, propertyValue);
}
}else{
cJSON_AddStringToObject(actionItem, KK_SYNC_SCENE_PROPERTYVALUE_STR, propertyValue);
}
cJSON_AddStringToObject(actionItem, KK_SYNC_ROOMID_STR, roomIdStr); cJSON_AddStringToObject(actionItem, KK_SYNC_ROOMID_STR, roomIdStr);
break; break;
} }
...@@ -1345,6 +1356,7 @@ static int kk_get_scenes_info(cJSON *data) ...@@ -1345,6 +1356,7 @@ static int kk_get_scenes_info(cJSON *data)
sqlite3_stmt *stmt; sqlite3_stmt *stmt;
int enable = 0,type = 0; int enable = 0,type = 0;
char *name = NULL; char *name = NULL;
char *roomId = NULL;
char *sceneId = NULL; char *sceneId = NULL;
kk_sync_ctx_t *ctx = _kk_sync_get_ctx(); kk_sync_ctx_t *ctx = _kk_sync_get_ctx();
if(data == NULL){ if(data == NULL){
...@@ -1366,6 +1378,8 @@ static int kk_get_scenes_info(cJSON *data) ...@@ -1366,6 +1378,8 @@ static int kk_get_scenes_info(cJSON *data)
name = (char*)sqlite3_column_text(stmt, DB_SCENEINFO_SCENENAME); name = (char*)sqlite3_column_text(stmt, DB_SCENEINFO_SCENENAME);
cJSON_AddStringToObject(sceneArrayItem, KK_SYNC_NANE_STR, name); cJSON_AddStringToObject(sceneArrayItem, KK_SYNC_NANE_STR, name);
sceneId = (char*)sqlite3_column_text(stmt, DB_SCENEINFO_SCENEID); sceneId = (char*)sqlite3_column_text(stmt, DB_SCENEINFO_SCENEID);
roomId = (char*)sqlite3_column_text(stmt, DB_SCENEINFO_ROOMID);
cJSON_AddStringToObject(sceneArrayItem, KK_SYNC_ROOMID_STR, roomId);
cJSON_AddStringToObject(sceneArrayItem, KK_SYNC_SCENEID_STR, sceneId); cJSON_AddStringToObject(sceneArrayItem, KK_SYNC_SCENEID_STR, sceneId);
cJSON *actionArray = cJSON_CreateArray(); cJSON *actionArray = cJSON_CreateArray();
kk_get_scenes_actions_info(actionArray,atoi(sceneId)); kk_get_scenes_actions_info(actionArray,atoi(sceneId));
......
...@@ -1163,6 +1163,17 @@ static int kk_subDevice_property_handle(cJSON *info,cJSON *payload,char *deviceC ...@@ -1163,6 +1163,17 @@ static int kk_subDevice_property_handle(cJSON *info,cJSON *payload,char *deviceC
free(infff); free(infff);
return 0; return 0;
} }
static int _kk_subDevice_online_to_app(cJSON *info,cJSON *payload)
{
char *payload11=cJSON_Print(payload);
char *infff=cJSON_Print(info);
printf("------------------------payload11:%s\n",payload11);
printf("------------------------infff:%s\n",infff);
kk_sendData2app(infff,payload11,0);
free(payload11);
free(infff);
return 0;
}
static int kk_indoorAir_online_handle(dm_mgr_dev_node_t *node ,char *deviceCode,int epNum) static int kk_indoorAir_online_handle(dm_mgr_dev_node_t *node ,char *deviceCode,int epNum)
{ {
int idx = 0; int idx = 0;
...@@ -1334,14 +1345,17 @@ void kk_platMsg_handle(void* data, char* chalMark){ ...@@ -1334,14 +1345,17 @@ void kk_platMsg_handle(void* data, char* chalMark){
cJSON *epNumJson = cJSON_GetObjectItem(jsonPay, "epNum"); cJSON *epNumJson = cJSON_GetObjectItem(jsonPay, "epNum");
if(epNumJson == NULL) goto error; if(epNumJson == NULL) goto error;
kk_indoorAir_online_handle(search_node,devCode->valuestring,epNumJson->valueint); kk_indoorAir_online_handle(search_node,devCode->valuestring,epNumJson->valueint);
_kk_subDevice_online_to_app(info,payload);
}else if(strcmp(search_node->productType,KK_DM_AIR_SWITCH_GATEWAY_TYPE) == 0){ }else if(strcmp(search_node->productType,KK_DM_AIR_SWITCH_GATEWAY_TYPE) == 0){
cJSON *epNumJson = cJSON_GetObjectItem(jsonPay, "epNum"); cJSON *epNumJson = cJSON_GetObjectItem(jsonPay, "epNum");
if(epNumJson == NULL) goto error; if(epNumJson == NULL) goto error;
kk_subAirSwitch_online_handle(search_node,devCode->valuestring,epNumJson->valueint); kk_subAirSwitch_online_handle(search_node,devCode->valuestring,epNumJson->valueint);
_kk_subDevice_online_to_app(info,payload);
}else if(strcmp(search_node->productType,KK_DM_FRESHAIR_GATEWAY_TYPE) == 0){ }else if(strcmp(search_node->productType,KK_DM_FRESHAIR_GATEWAY_TYPE) == 0){
cJSON *epNumJson = cJSON_GetObjectItem(jsonPay, "epNum"); cJSON *epNumJson = cJSON_GetObjectItem(jsonPay, "epNum");
if(epNumJson == NULL) goto error; if(epNumJson == NULL) goto error;
kk_subFreshair_online_handle(search_node,devCode->valuestring,epNumJson->valueint); kk_subFreshair_online_handle(search_node,devCode->valuestring,epNumJson->valueint);
_kk_subDevice_online_to_app(info,payload);
} }
} }
else if (strstr(msgType->valuestring, KK_THING_TOPO_BATCH_ADD_MSG) != NULL){ else if (strstr(msgType->valuestring, KK_THING_TOPO_BATCH_ADD_MSG) != NULL){
...@@ -1395,7 +1409,11 @@ void kk_platMsg_handle(void* data, char* chalMark){ ...@@ -1395,7 +1409,11 @@ void kk_platMsg_handle(void* data, char* chalMark){
proCode = cJSON_GetObjectItem(info, MSG_PRODUCT_CODE_STR); proCode = cJSON_GetObjectItem(info, MSG_PRODUCT_CODE_STR);
if(strcmp(proCode->valuestring,"3053")&& if(strcmp(proCode->valuestring,"3053")&&
strcmp(proCode->valuestring,"3042")){ strcmp(proCode->valuestring,"3042")){
kk_scene_iftt_check(info_dcode->valuestring,jsonPay); //如果带version,代表的是快照信息,快照信息不需要触发iftt
cJSON *version = cJSON_GetObjectItem(jsonPay, "version");
if(version == NULL){
kk_scene_iftt_check(info_dcode->valuestring,jsonPay);
}
} }
free(outstr); free(outstr);
} }
......
...@@ -1151,7 +1151,76 @@ int kk_scene_parse_scene_condition(const cJSON* str,const char *sceneId) ...@@ -1151,7 +1151,76 @@ int kk_scene_parse_scene_condition(const cJSON* str,const char *sceneId)
*返 回 值: 0:成功;其他:失败 *返 回 值: 0:成功;其他:失败
*其他说明: *其他说明:
*************************************************************/ *************************************************************/
static int _kk_scene_LightStripSpecialAction_handle(cJSON* propertyValue,char *deviceCode,int ep,int idelay,char *sceneId,char *fatherDeviceCode)
{
kk_scene_action_detail_t info = {0};
cJSON * Brightness = cJSON_GetObjectItem(propertyValue,"Brightness");
if(Brightness != NULL && Brightness->type==cJSON_Number){
sprintf(info.propertyValue,"%d",Brightness->valueint);
memcpy(info.propertyName,"Brightness",strlen("Brightness"));
memcpy(info.deviceCode,deviceCode,strlen(deviceCode));
info.epNum = ep;
info.delay = idelay;
kk_scene_action_add(fatherDeviceCode,sceneId,info);
}
memset(&info,0x0,sizeof(kk_scene_action_detail_t));
cJSON * RGBColor = cJSON_GetObjectItem(propertyValue,"RGBColor");
if(RGBColor != NULL && RGBColor->type==cJSON_String){//"RGBColor":"[115,114,253]"
cJSON *rgb = cJSON_CreateObject();
char *pStart = strstr(RGBColor->valuestring,"[");
char *pEnd = strstr(RGBColor->valuestring,",");
if(pStart != NULL && pEnd != NULL){
char redS[4] = {0};
memcpy(redS,pStart + 1,pEnd - pStart + 1);
cJSON_AddNumberToObject(rgb,"Red",atoi(redS));
char *pGreenEnd = strstr(pEnd+1,",");
if(pGreenEnd != NULL){
char greenS[4] = {0};
memcpy(greenS,pEnd + 1,pGreenEnd - pEnd + 1);
cJSON_AddNumberToObject(rgb,"Green",atoi(greenS));
char *pBlueEnd = strstr(pGreenEnd,"]");
if(pBlueEnd != NULL){
char blueS[4] = {0};
memcpy(blueS,pGreenEnd + 1,pBlueEnd - pGreenEnd + 1);
cJSON_AddNumberToObject(rgb,"Blue",atoi(blueS));
}
}
}
char *str = cJSON_PrintUnformatted(rgb);
memcpy(info.propertyValue,str,strlen(str));
memcpy(info.propertyName,"RGBColor",strlen("RGBColor"));
memcpy(info.deviceCode,deviceCode,strlen(deviceCode));
info.epNum = ep;
info.delay = idelay;
kk_scene_action_add(fatherDeviceCode,sceneId,info);
free(str);
cJSON_Delete(rgb);
}else if(RGBColor != NULL && RGBColor->type==cJSON_Array){
cJSON *rgb = cJSON_CreateObject();
cJSON *red = cJSON_GetArrayItem(RGBColor,0);
if(red != NULL){
cJSON_AddNumberToObject(rgb,"Red",red->valueint);
}
cJSON *green = cJSON_GetArrayItem(RGBColor,1);
if(green != NULL){
cJSON_AddNumberToObject(rgb,"Green",green->valueint);
}
cJSON *blue = cJSON_GetArrayItem(RGBColor,2);
if(blue != NULL){
cJSON_AddNumberToObject(rgb,"Blue",blue->valueint);
}
char *str = cJSON_PrintUnformatted(rgb);
memcpy(info.propertyValue,str,strlen(str));
memcpy(info.propertyName,"RGBColor",strlen("RGBColor"));
memcpy(info.deviceCode,deviceCode,strlen(deviceCode));
info.epNum = ep;
info.delay = idelay;
kk_scene_action_add(fatherDeviceCode,sceneId,info);
free(str);
cJSON_Delete(rgb);
}
return SUCCESS_RETURN;
}
int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdate) int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdate)
{ {
int res = 0; int res = 0;
...@@ -1188,6 +1257,7 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat ...@@ -1188,6 +1257,7 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
item = action->child; item = action->child;
while(item != NULL){ while(item != NULL){
printf("+++\r\n"); printf("+++\r\n");
ArmingStateFlag = 0;
type = cJSON_GetObjectItem(item,MSG_SCENE_TYPE); type = cJSON_GetObjectItem(item,MSG_SCENE_TYPE);
if(type == NULL){ if(type == NULL){
memcpy(typeStr,"action/thing/setProperty",strlen("action/thing/setProperty")); memcpy(typeStr,"action/thing/setProperty",strlen("action/thing/setProperty"));
...@@ -1239,26 +1309,6 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat ...@@ -1239,26 +1309,6 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
} }
else{ else{
memset(propertyValueStr,0x0,sizeof(propertyValueStr));
if(propertyValue->type==cJSON_Number){
snprintf(propertyValueStr,sizeof(propertyValueStr),"%d",propertyValue->valueint);
}else if(propertyValue->type==cJSON_Object){
if(strcmp(propertyName->valuestring,"LightStripSpecialAction") == 0){
cJSON * Brightness = cJSON_GetObjectItem(propertyValue,"Brightness");
if(Brightness != NULL && Brightness->type==cJSON_Number){
snprintf(propertyValueStr,sizeof(propertyValueStr),"%d",Brightness->valueint);
}
}else{
char *str = cJSON_PrintUnformatted(propertyValue);
snprintf(propertyValueStr,sizeof(propertyValueStr),"%s",str);
free(str);
}
}else if(propertyValue->type==cJSON_String){
memcpy(propertyValueStr,propertyValue->valuestring,strlen(propertyValue->valuestring));
}
if(strcmp(propertyName->valuestring,"ArmingState") == 0){
ArmingStateFlag = 1;
}
deviceCode = cJSON_GetObjectItem(item,MSG_DEVICE_CODE_STR); deviceCode = cJSON_GetObjectItem(item,MSG_DEVICE_CODE_STR);
if(deviceCode == NULL) return FAIL_RETURN; if(deviceCode == NULL) return FAIL_RETURN;
epNum = cJSON_GetObjectItem(item,MSG_SCENE_EPNUM); epNum = cJSON_GetObjectItem(item,MSG_SCENE_EPNUM);
...@@ -1273,13 +1323,28 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat ...@@ -1273,13 +1323,28 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
} }
delay = cJSON_GetObjectItem(item,MSG_SCENE_DELAY); delay = cJSON_GetObjectItem(item,MSG_SCENE_DELAY);
if(delay == NULL) return FAIL_RETURN; if(delay == NULL) return FAIL_RETURN;
int idelay = delay->valueint; int idelay = delay->valueint;
res = dm_mgr_get_device_by_devicecode(deviceCode->valuestring,&node); res = dm_mgr_get_device_by_devicecode(deviceCode->valuestring,&node);
if (res != SUCCESS_RETURN) { if (res != SUCCESS_RETURN) {
item = item->next; item = item->next;
continue; continue;
} }
memset(propertyValueStr,0x0,sizeof(propertyValueStr));
if(propertyValue->type==cJSON_Number){
snprintf(propertyValueStr,sizeof(propertyValueStr),"%d",propertyValue->valueint);
}else if(propertyValue->type==cJSON_Object){
if(strcmp(propertyName->valuestring,"LightStripSpecialAction") == 0){
_kk_scene_LightStripSpecialAction_handle(propertyValue,deviceCode->valuestring,iepnum,idelay,(char*)sceneId,node->fatherDeviceCode);
}
char *str = cJSON_PrintUnformatted(propertyValue);
snprintf(propertyValueStr,sizeof(propertyValueStr),"%s",str);
free(str);
}else if(propertyValue->type==cJSON_String){
memcpy(propertyValueStr,propertyValue->valuestring,strlen(propertyValue->valuestring));
}
if(strcmp(propertyName->valuestring,"ArmingState") == 0){
ArmingStateFlag = 1;
}
if(kk_subDev_check_scene_support(node->fatherDeviceCode) == 1 && ArmingStateFlag == 0){ if(kk_subDev_check_scene_support(node->fatherDeviceCode) == 1 && ArmingStateFlag == 0){
kk_scene_action_detail_t info = {0}; kk_scene_action_detail_t info = {0};
memcpy(info.deviceCode,node->deviceCode,strlen(node->deviceCode)); memcpy(info.deviceCode,node->deviceCode,strlen(node->deviceCode));
...@@ -1294,18 +1359,15 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat ...@@ -1294,18 +1359,15 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
memcpy(info.propertyName,propertyName->valuestring,strlen(propertyName->valuestring)); memcpy(info.propertyName,propertyName->valuestring,strlen(propertyName->valuestring));
} }
}else{ }else{
if(strcmp(propertyName->valuestring,"LightStripSpecialAction") == 0){ memcpy(info.propertyName,propertyName->valuestring,strlen(propertyName->valuestring));
memcpy(info.propertyName,"Brightness",strlen("Brightness"));
}else{
memcpy(info.propertyName,propertyName->valuestring,strlen(propertyName->valuestring));
}
} }
memcpy(info.propertyValue,propertyValueStr,strlen(propertyValueStr)); memcpy(info.propertyValue,propertyValueStr,strlen(propertyValueStr));
info.epNum = iepnum; info.epNum = iepnum;
info.delay = idelay; info.delay = idelay;
if(strcmp(propertyName->valuestring,"LightStripSpecialAction") != 0){
kk_scene_action_add(node->fatherDeviceCode,sceneId,info); kk_scene_action_add(node->fatherDeviceCode,sceneId,info);
}
//printf("---------------------------------DEBUG CWC[%s][%d]\n",__FUNCTION__,__LINE__); //printf("---------------------------------DEBUG CWC[%s][%d]\n",__FUNCTION__,__LINE__);
res = kk_scene_insert_scene_action(typeStr,node->deviceCode,iepnum, res = kk_scene_insert_scene_action(typeStr,node->deviceCode,iepnum,
info.propertyName,propertyValueStr,idelay,sceneId,node->fatherDeviceCode); info.propertyName,propertyValueStr,idelay,sceneId,node->fatherDeviceCode);
...@@ -1324,7 +1386,7 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat ...@@ -1324,7 +1386,7 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
item = item->next; item = item->next;
} }
//场景设置布防不需要下发到网关 //场景设置布防不需要下发到网关
if(propertySetType && ArmingStateFlag == 0){ if(propertySetType){
kk_scene_action_info_send(isUpdate); kk_scene_action_info_send(isUpdate);
} }
return SUCCESS_RETURN; return SUCCESS_RETURN;
......
{ {
"productCode":"3093", "productCode":"3093",
"operateType":"511", "operateType":"506",
"channel":3, "channel":3,
"syn_type":1, "syn_type":1,
"syn_opcode":"DIMMABLE_LIGHT_STATUS", "syn_opcode":"DIMMABLE_LIGHT_STATUS",
......
{ {
"productCode":"3094", "productCode":"3092",
"operateType":"501", "operateType":"512",
"channel":1, "channel":2,
"syn_type":1, "syn_type":1,
"syn_opcode":"DIMMABLE_LIGHT_STATUS", "syn_opcode":"DIMMABLE_LIGHT_STATUS",
"newccu":[ "newccu":[
...@@ -19,6 +19,34 @@ ...@@ -19,6 +19,34 @@
"channel":"1", "channel":"1",
"valueRange":[], "valueRange":[],
"value": 0 "value": 0
},{
"identifier":"ColorTemperature",
"opcodemap":"ADJUST_COLOUR_TEMPERATURE",
"dataType":"int",
"channel":"1",
"valueRange":[],
"value": 0
},{
"identifier":"PowerSwitch",
"opcodemap":"SWITCH",
"dataType":"int",
"channel":"2",
"valueRange":[0,1],
"value": 0
},{
"identifier":"Brightness",
"opcodemap":"ADJUST_LUMINANCE",
"dataType":"int",
"channel":"2",
"valueRange":[],
"value": 0
},{
"identifier":"ColorTemperature",
"opcodemap":"ADJUST_COLOUR_TEMPERATURE",
"dataType":"int",
"channel":"2",
"valueRange":[],
"value": 0
} }
], ],
"oldccu":[ "oldccu":[
...@@ -38,6 +66,38 @@ ...@@ -38,6 +66,38 @@
"valueRange":[], "valueRange":[],
"syn":"bri", "syn":"bri",
"synType":"int" "synType":"int"
},{
"opcode":"ADJUST_COLOUR_TEMPERATURE",
"identifiermap":"ColorTemperature",
"dataType":"int",
"channel":"1",
"valueRange":[],
"syn":"colour_temperature",
"synType":"int"
},{
"opcode":"SWITCH",
"identifiermap":"PowerSwitch",
"dataType":"map",
"channel":"2",
"valueRange":["OFF","ON"],
"syn":"on",
"synType":"bool"
},{
"opcode":"ADJUST_LUMINANCE",
"identifiermap":"Brightness",
"dataType":"int",
"channel":"2",
"valueRange":[],
"syn":"bri",
"synType":"int"
},{
"opcode":"ADJUST_COLOUR_TEMPERATURE",
"identifiermap":"ColorTemperature",
"dataType":"int",
"channel":"2",
"valueRange":[],
"syn":"colour_temperature",
"synType":"int"
} }
] ]
......
{ {
"productCode":"3102", "productCode":"3102",
"operateType":"502", "operateType":"506",
"channel":1, "channel":1,
"syn_type":1, "syn_type":1,
"syn_opcode":"DIMMABLE_LIGHT_STATUS", "syn_opcode":"DIMMABLE_LIGHT_STATUS",
......
{
"productCode":"3137",
"operateType":"514",
"channel":1,
"syn_type":1,
"syn_opcode":"DIMMABLE_LIGHT_STATUS",
"newccu":[
{
"identifier":"PowerSwitch",
"opcodemap":"SWITCH",
"dataType":"int",
"channel":"1",
"valueRange":[0,1],
"value": 0
},{
"identifier":"Brightness",
"opcodemap":"ADJUST_LUMINANCE",
"dataType":"int",
"channel":"1",
"valueRange":[],
"value": 0
},{
"identifier":"ColorTemperature",
"opcodemap":"ADJUST_COLOUR_TEMPERATURE",
"dataType":"int",
"channel":"1",
"valueRange":[],
"value": 0
}
],
"oldccu":[
{
"opcode":"SWITCH",
"identifiermap":"PowerSwitch",
"dataType":"map",
"channel":"1",
"valueRange":["OFF","ON"],
"syn":"on",
"synType":"bool"
},{
"opcode":"ADJUST_LUMINANCE",
"identifiermap":"Brightness",
"dataType":"int",
"channel":"1",
"valueRange":[],
"syn":"bri",
"synType":"int"
},{
"opcode":"ADJUST_COLOUR_TEMPERATURE",
"identifiermap":"ColorTemperature",
"dataType":"int",
"channel":"1",
"valueRange":[],
"syn":"colour_temperature",
"synType":"int"
}
]
}
\ No newline at end of file
...@@ -11,6 +11,17 @@ ...@@ -11,6 +11,17 @@
"services": [ "services": [
{ {
"outputData": [ "outputData": [
{
"identifier": "SosState",
"name": "紧急按钮告警状态",
"dataType": {
"type": "enum",
"specs": {
"0": "没有报警",
"1": "报警"
}
}
},
{ {
"identifier": "Battery", "identifier": "Battery",
"name": "电池电量", "name": "电池电量",
...@@ -38,11 +49,24 @@ ...@@ -38,11 +49,24 @@
} }
], ],
"properties": [ "properties": [
{
"identifier": "SosState",
"name": "紧急按钮告警状态",
"accessMode": "r",
"required": true,
"dataType": {
"type": "enum",
"specs": {
"0": "没有报警",
"1": "报警"
}
}
},
{ {
"identifier": "Battery", "identifier": "Battery",
"name": "电池电量", "name": "电池电量",
"accessMode": "r", "accessMode": "r",
"required": true, "required": false,
"dataType": { "dataType": {
"type": "double", "type": "double",
"specs": { "specs": {
...@@ -53,6 +77,21 @@ ...@@ -53,6 +77,21 @@
"step": "0.01" "step": "0.01"
} }
} }
},
{
"identifier": "SensorType",
"name": "安防等级",
"accessMode": "rw",
"required": true,
"dataType": {
"type": "enum",
"specs": {
"0": "在家安防",
"1": "室外安防",
"2": "24小时警戒",
"3": "无警戒"
}
}
} }
], ],
"events": [ "events": [
...@@ -81,7 +120,21 @@ ...@@ -81,7 +120,21 @@
"desc": "属性上报" "desc": "属性上报"
}, },
{ {
"outputData": [], "outputData": [
{
"identifier": "SosState",
"name": "紧急按钮告警状态",
"accessMode": "r",
"required": true,
"dataType": {
"type": "enum",
"specs": {
"0": "没有报警",
"1": "报警"
}
}
}
],
"identifier": "sosAlarm", "identifier": "sosAlarm",
"method": "thing.event.sosAlarm.post", "method": "thing.event.sosAlarm.post",
"name": "sosAlarm", "name": "sosAlarm",
......
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"productType": "airConditioning", "productType": "airConditioning",
"version": "1.3", "version": "1.3",
"profile": { "profile": {
"heartbeat": "3000", "heartbeat": "300",
"productCode": "3035", "productCode": "3035",
"productName": "肖邦系列.大金中央空调线控器Z3KA(KONKE)" "productName": "肖邦系列.大金中央空调线控器Z3KA(KONKE)"
}, },
......
This diff is collapsed.
{ {
"schema": "https://iot-ap.ikonke.com/model/product_3093.json", "schema": "https://iot-ap.ikonke.com/model/product_3093.json",
"productType": "lightPanel", "productType": "lightPanel",
"version": "1.2", "version": "1.3",
"profile": { "profile": {
"heartbeat": "300", "heartbeat": "300",
"productCode": "3093", "productCode": "3093",
...@@ -87,48 +87,6 @@ ...@@ -87,48 +87,6 @@
}, },
"name": "亮度" "name": "亮度"
}, },
{
"identifier": "ColorTemperature_1",
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "色温"
},
{
"identifier": "ColorTemperature_2",
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "色温"
},
{
"identifier": "ColorTemperature_3",
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "色温"
},
{ {
"identifier": "FadeTime_1", "identifier": "FadeTime_1",
"dataType": { "dataType": {
...@@ -339,48 +297,6 @@ ...@@ -339,48 +297,6 @@
}, },
"name": "亮度" "name": "亮度"
}, },
{
"identifier": "ColorTemperature_1",
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "色温"
},
{
"identifier": "ColorTemperature_2",
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "色温"
},
{
"identifier": "ColorTemperature_3",
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "色温"
},
{ {
"identifier": "FadeTime_1", "identifier": "FadeTime_1",
"dataType": { "dataType": {
...@@ -512,19 +428,16 @@ ...@@ -512,19 +428,16 @@
"inputData": [ "inputData": [
"PowerSwitch_1", "PowerSwitch_1",
"Brightness_1", "Brightness_1",
"ColorTemperature_1",
"FadeTime_1", "FadeTime_1",
"LowBrightness_1", "LowBrightness_1",
"HighBrightness_1", "HighBrightness_1",
"PowerSwitch_2", "PowerSwitch_2",
"Brightness_2", "Brightness_2",
"ColorTemperature_2",
"FadeTime_2", "FadeTime_2",
"LowBrightness_2", "LowBrightness_2",
"HighBrightness_2", "HighBrightness_2",
"PowerSwitch_3", "PowerSwitch_3",
"Brightness_3", "Brightness_3",
"ColorTemperature_3",
"FadeTime_3", "FadeTime_3",
"LowBrightness_3", "LowBrightness_3",
"HighBrightness_3" "HighBrightness_3"
...@@ -626,48 +539,6 @@ ...@@ -626,48 +539,6 @@
}, },
"name": "亮度" "name": "亮度"
}, },
{
"identifier": "ColorTemperature_1",
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "色温"
},
{
"identifier": "ColorTemperature_2",
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "色温"
},
{
"identifier": "ColorTemperature_3",
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "色温"
},
{ {
"identifier": "FadeTime_1", "identifier": "FadeTime_1",
"dataType": { "dataType": {
...@@ -885,54 +756,6 @@ ...@@ -885,54 +756,6 @@
}, },
"name": "亮度" "name": "亮度"
}, },
{
"identifier": "ColorTemperature_1",
"accessMode": "rw",
"required": false,
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "色温"
},
{
"identifier": "ColorTemperature_2",
"accessMode": "rw",
"required": false,
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "色温"
},
{
"identifier": "ColorTemperature_3",
"accessMode": "rw",
"required": false,
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "色温"
},
{ {
"identifier": "FadeTime_1", "identifier": "FadeTime_1",
"accessMode": "rw", "accessMode": "rw",
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{ {
"schema": "https://iot-ap.ikonke.com/model/product_3119.json", "schema": "https://iot-ap.ikonke.com/model/product_3119.json",
"productType": "sensor", "productType": "sensor",
"version": "1.1", "version": "1.2",
"profile": { "profile": {
"heartbeat": "300", "heartbeat": "300",
"productCode": "3119", "productCode": "3119",
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
} }
}, },
{ {
"identifier": "Pollution", "identifier": "TVOC",
"name": "TVOC检测值", "name": "TVOC检测值",
"dataType": { "dataType": {
"type": "int", "type": "int",
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
"CO2", "CO2",
"PM2.5", "PM2.5",
"HCHO", "HCHO",
"Pollution" "TVOC"
], ],
"method": "thing.service.property.get", "method": "thing.service.property.get",
"name": "get", "name": "get",
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
} }
}, },
{ {
"identifier": "Pollution", "identifier": "TVOC",
"name": "TVOC检测值", "name": "TVOC检测值",
"accessMode": "r", "accessMode": "r",
"required": false, "required": false,
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
} }
}, },
{ {
"identifier": "Pollution", "identifier": "TVOC",
"name": "TVOC检测值", "name": "TVOC检测值",
"dataType": { "dataType": {
"type": "int", "type": "int",
......
{ {
"schema": "https://iot-ap.ikonke.com/model/product_3132.json", "schema": "https://iot-ap.ikonke.com/model/product_3132.json",
"productType": "sensor", "productType": "sensor",
"version": "1.1", "version": "1.2",
"profile": { "profile": {
"heartbeat": "300", "heartbeat": "300",
"productCode": "3132", "productCode": "3132",
...@@ -79,20 +79,6 @@ ...@@ -79,20 +79,6 @@
"step": "1" "step": "1"
} }
} }
},
{
"identifier": "Pollution",
"name": "TVOC检测值",
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "9999",
"unit": "ug/m3",
"unitName": "微克每立方米",
"step": "1"
}
}
} }
], ],
"identifier": "get", "identifier": "get",
...@@ -190,22 +176,6 @@ ...@@ -190,22 +176,6 @@
"step": "1" "step": "1"
} }
} }
},
{
"identifier": "Pollution",
"name": "TVOC检测值",
"accessMode": "r",
"required": false,
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "9999",
"unit": "ug/m3",
"unitName": "微克每立方米",
"step": "1"
}
}
} }
], ],
"events": [ "events": [
...@@ -280,20 +250,6 @@ ...@@ -280,20 +250,6 @@
"step": "1" "step": "1"
} }
} }
},
{
"identifier": "Pollution",
"name": "TVOC检测值",
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "9999",
"unit": "ug/m3",
"unitName": "微克每立方米",
"step": "1"
}
}
} }
], ],
"identifier": "property", "identifier": "property",
......
{
"schema": "https://iot-ap.ikonke.com/model/product_3137.json",
"productType": "lightPanel",
"version": "1.2",
"profile": {
"heartbeat": "300",
"productCode": "3137",
"productName": "耀夜系列.智能双色温筒灯5W(KONKE)"
},
"services": [
{
"outputData": [],
"identifier": "set",
"inputData": [
{
"identifier": "PowerSwitch",
"dataType": {
"specs": {
"0": "关闭",
"1": "打开"
},
"type": "bool"
},
"name": "电源开关"
},
{
"identifier": "Brightness",
"dataType": {
"type": "int",
"specs": {
"min": "1",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "亮度"
},
{
"identifier": "ColorTemperature",
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "100",
"unit": "K",
"unitName": "百分比",
"step": "1"
}
},
"name": "色温"
},
{
"identifier": "FadeTime",
"dataType": {
"type": "int",
"specs": {
"min": "10",
"max": "50",
"unit": "1/10s",
"unitName": "1/10秒",
"step": "10"
}
},
"name": "渐变时间"
},
{
"identifier": "LowBrightness",
"dataType": {
"type": "int",
"specs": {
"min": "10",
"max": "90",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "最低亮度"
},
{
"identifier": "HighBrightness",
"dataType": {
"type": "int",
"specs": {
"min": "20",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "最高亮度"
}
],
"method": "thing.service.property.set",
"name": "set",
"required": true,
"callType": "async",
"desc": "属性设置"
},
{
"outputData": [
{
"identifier": "PowerSwitch",
"dataType": {
"specs": {
"0": "关闭",
"1": "打开"
},
"type": "bool"
},
"name": "电源开关"
},
{
"identifier": "Brightness",
"dataType": {
"type": "int",
"specs": {
"min": "1",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "亮度"
},
{
"identifier": "ColorTemperature",
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "100",
"unit": "K",
"unitName": "百分比",
"step": "1"
}
},
"name": "色温"
},
{
"identifier": "FadeTime",
"dataType": {
"type": "int",
"specs": {
"min": "10",
"max": "50",
"unit": "1/10s",
"unitName": "1/10秒",
"step": "10"
}
},
"name": "渐变时间"
},
{
"identifier": "LowBrightness",
"dataType": {
"type": "int",
"specs": {
"min": "10",
"max": "90",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "最低亮度"
},
{
"identifier": "HighBrightness",
"dataType": {
"type": "int",
"specs": {
"min": "20",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "最高亮度"
}
],
"identifier": "get",
"inputData": [
"PowerSwitch",
"Brightness",
"ColorTemperature",
"FadeTime",
"LowBrightness",
"HighBrightness"
],
"method": "thing.service.property.get",
"name": "get",
"required": true,
"callType": "async",
"desc": "属性获取"
},
{
"outputData":[
],
"identifier":"negativeProperty",
"inputData":[
"PowerSwitch"
],
"method":"thing.service.negativeProperty",
"name":"negativeProperty",
"required":true,
"callType":"async",
"desc":"属性值取反"
}
],
"properties": [
{
"identifier": "PowerSwitch",
"dataType": {
"specs": {
"0": "关闭",
"1": "打开"
},
"type": "bool"
},
"name": "电源开关",
"accessMode": "rw",
"required": true
},
{
"identifier": "Brightness",
"name": "亮度",
"accessMode": "rw",
"required": false,
"dataType": {
"type": "int",
"specs": {
"min": "1",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
}
},
{
"identifier": "ColorTemperature",
"accessMode": "rw",
"required": false,
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "100",
"unit": "K",
"unitName": "百分比",
"step": "1"
}
},
"name": "色温"
},
{
"identifier": "FadeTime",
"accessMode": "rw",
"required": false,
"dataType": {
"type": "int",
"specs": {
"min": "10",
"max": "50",
"unit": "1/10s",
"unitName": "1/10秒",
"step": "10"
}
},
"name": "渐变时间"
},
{
"identifier": "LowBrightness",
"accessMode": "rw",
"required": false,
"dataType": {
"type": "int",
"specs": {
"min": "10",
"max": "90",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "最低亮度"
},
{
"identifier": "HighBrightness",
"accessMode": "rw",
"required": false,
"dataType": {
"type": "int",
"specs": {
"min": "20",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "最高亮度"
}
],
"events": [
{
"outputData": [
{
"identifier": "PowerSwitch",
"dataType": {
"specs": {
"0": "关闭",
"1": "打开"
},
"type": "bool"
},
"name": "电源开关"
},
{
"identifier": "Brightness",
"dataType": {
"type": "int",
"specs": {
"min": "1",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "亮度"
},
{
"identifier": "ColorTemperature",
"dataType": {
"type": "int",
"specs": {
"min": "0",
"max": "100",
"unit": "K",
"unitName": "百分比",
"step": "1"
}
},
"name": "色温"
},
{
"identifier": "FadeTime",
"dataType": {
"type": "int",
"specs": {
"min": "10",
"max": "50",
"unit": "1/10s",
"unitName": "1/10秒",
"step": "10"
}
},
"name": "渐变时间"
},
{
"identifier": "LowBrightness",
"dataType": {
"type": "int",
"specs": {
"min": "10",
"max": "90",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "最低亮度"
},
{
"identifier": "HighBrightness",
"dataType": {
"type": "int",
"specs": {
"min": "20",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "最高亮度"
}
],
"identifier": "property",
"method": "thing.event.property.post",
"name": "property",
"type": "info",
"required": true,
"desc": "属性上报"
}
]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment