Google home reportStateAndNotification是否支持多设备状态报告?

Google home reportStateAndNotification是否支持多设备状态报告?,google-home,google-smart-home,Google Home,Google Smart Home,我正试图通过报告两台设备的状态,我收到了这个错误 请求有效负载: { "requestId":"3310672920401175639", "agentUserId":"5d8f3dd42ce05140dc1c6a20", "payload":{ "devices":{ "states":[ { "5de28e041729ec0cb40ba906":{

我正试图通过报告两台设备的状态,我收到了这个错误

请求有效负载:

 { 
   "requestId":"3310672920401175639",
   "agentUserId":"5d8f3dd42ce05140dc1c6a20",
   "payload":{ 
      "devices":{ 
         "states":[ 
            { 
               "5de28e041729ec0cb40ba906":{ 
                  "on":true
               }
            },
            { 
               "5df49862f53ffa4c1452a448":{ 
                  "on":false,
                  "brightness":100
               }
            }
         ]
      }
   }
}
答复:

{ 
   "error":{ 
      "code":400,
      "message":"Invalid JSON payload received. Unknown name "states" at 'payload.devices': Proto field is not repeating, cannot start list.",
      "status":"INVALID_ARGUMENT",
      "details":[ 
         { 
            "@type":"type.googleapis.com/google.rpc.BadRequest",
            "fieldViolations":[ 
               { 
                  "field":"payload.devices",
                  "description":"Invalid JSON payload received. Unknown name "states" at 'payload.devices': Proto field is not repeating, cannot start list."
               }
            ]
         }
      ]
   }
}

“状态”可以保存设备的多个状态吗?还是我做错了什么

有效负载中的
状态
值应该是一个对象,每个唯一的设备id都是一个键。返回时不应将它们包装到数组中。因此,您的请求负载应该更像这样:

{ 
  "requestId":"3310672920401175639",
  "agentUserId":"5d8f3dd42ce05140dc1c6a20",
  "payload": { 
    "devices": { 
      "states": { 
        "5de28e041729ec0cb40ba906": { 
          "on": true
        },
        "5df49862f53ffa4c1452a448": { 
          "on": false,
          "brightness": 100
        }
      }
    }
  }
}