#3 update

Merged
lijian merged 1 commits from yongxu/emqx into yongxu/v2 1 year ago
2 changed files with 2 additions and 1 deletions
  1. 1 0
      services/emqx-agent/agent.go
  2. 1 1
      services/emqx-agent/sub_dev.go

+ 1 - 0
services/emqx-agent/agent.go

@@ -157,6 +157,7 @@ func processReportStatus(deviceid, vendorId string, message *gjson.Json) {
 
 // Connected 设备接入时
 func (a *Agent) Connected(status *protocol.DevConnectStatus) error {
+	server.Log.Infof("设备上线;%s", status.DeviceId)
 	// 查询设备信息
 	device := &models.Device{}
 	err := server.RPCCallByName(nil, rpcs.RegistryServerName, "Registry.FindDeviceByIdentifier", status.DeviceId, device)

+ 1 - 1
services/emqx-agent/sub_dev.go

@@ -161,7 +161,7 @@ func (d *MqttClient) subConnectStatus(handle Handle) func(ctx context.Context, t
 			DeviceId:   msg.Clientid,
 			ClientIp:   msg.Ipaddress,
 		}
-		if strings.HasSuffix(topic, "/connected") {
+		if strings.HasSuffix(topic, "/connected") || strings.HasSuffix(topic, "/subscribed") {
 			status.Action = "LOGIN"
 			return handle(ctx).Connected(&status)
 		} else {