asyncapi: 3.0.0
info:
  title: 造物云设备协议
  version: 1.0.0
  description: 自有硬件与设备接入网关之间的 MQTT 消息契约
servers:
  production:
    host: mqtt.device.zaowuyun.com:8883
    protocol: mqtts
    description: 每台设备使用独立证书，示例地址不代表已部署
channels:
  deviceUplink:
    address: zy/v1/devices/{deviceId}/up
    parameters:
      deviceId:
        description: 造物云永久设备 ID
    messages:
      envelope:
        $ref: '#/components/messages/UplinkEnvelope'
  deviceDownlink:
    address: zy/v1/devices/{deviceId}/down
    parameters:
      deviceId:
        description: 造物云永久设备 ID
    messages:
      command:
        $ref: '#/components/messages/Command'
operations:
  receiveUplink:
    action: receive
    channel:
      $ref: '#/channels/deviceUplink'
  sendCommand:
    action: send
    channel:
      $ref: '#/channels/deviceDownlink'
components:
  messages:
    UplinkEnvelope:
      payload:
        $ref: ./schemas/envelope.schema.json
    Command:
      payload:
        $ref: ./schemas/command.schema.json
