Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Update conditions_service.go
Browse files Browse the repository at this point in the history
  • Loading branch information
November-12 committed Aug 28, 2023
1 parent df5956b commit ee88671
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion services/conditions_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,24 @@ func (*ConditionsService) ExecuteAutomationAction(automationId string, automatio
} else if deviceModel == "2" {
automationLogDetail.ProcessDescription = "暂不支持调动服务;"
automationLogDetail.ProcessResult = "2"
} else {
} else if deviceModel == "3" { // 自定义属性下发
instructMap := res.Get("instruct").MustMap()
instructByte, err := json.Marshal(instructMap)
if err != nil {
logs.Error(err.Error())
automationLogDetail.ProcessDescription = "instruct:" + err.Error()
automationLogDetail.ProcessResult = "2"
} else {
var Device DeviceService
deviceData, _ := Device.Token(automationAction.DeviceId)
err := Device.SendMessage(instructByte, deviceData)
if err != nil {
logs.Error(err.Error())
automationLogDetail.ProcessDescription = "instruct:" + err.Error()
automationLogDetail.ProcessResult = "2"
}
}
} else { // 暂不支持的deviceModel
automationLogDetail.ProcessDescription = "deviceModel错误;"
automationLogDetail.ProcessResult = "2"
}
Expand Down

0 comments on commit ee88671

Please sign in to comment.