0

When I send the reportState I am getting this error:

{"error": {  "code": 400,  "message": "Request contains an invalid argument.",  "status": "INVALID_ARGUMENT"}} 

For the following request:

{ 
   "requestId":"b09aa527-e8ec-4374-8d0b-742ba61bbfe3",
   "agentUserId":"5d8f3dd42ce05140dc1c6a20",
   "payload":{ 
      "devices":{ 
         "states":{ 
            "5e3679c9130c053f48888114":{ 
               "brightness":67,
               "colorModel":"rgb",
               "spectrumRGB":31655,
               "on":true
            }
         }
      }
   }
}

This is the sync request response:

{ 
   "requestId":"4439574979535065527",
   "payload":{ 
      "agentUserId":"5d8f3dd42ce05140dc1c6a20",
      "devices":[          
         { 
            "id":"5e3679c9130c053f48888114",
            "type":"action.devices.types.LIGHT",
            "traits":[ 
               "action.devices.traits.Brightness",
               "action.devices.traits.ColorSetting",
               "action.devices.traits.OnOff"
            ],
            "name":{ 
               "defaultNames":[ 
                  "lamp"
               ],
               "name":"lamp",
               "nicknames":[ 
                  "lamp"
               ]
            },
            "willReportState":true,
            "roomHint":"Living Room",
            "deviceInfo":{ 
               "manufacturer":"Sinric Pro",
               "model":"SR2",
               "hwVersion":"1.0",
               "swVersion":"1.0"
            },
            "attributes":{ 
               "colorModel":"rgb",
               "colorTemperatureRange":{ 
                  "temperatureMinK":2000,
                  "temperatureMaxK":9000
               },
               "commandOnlyColorSetting":false
            }
         }
      ]
   }
}

If I remove

"colorModel":"rgb", "spectrumRGB":31655,

seems to success.

Any idea why and how to fix this? It would be nice if Google APIs can return a better response than this

kakopappa
  • 5,023
  • 5
  • 54
  • 73
  • Have you tried *just* removing the `colorModel` part, but keeping the `spectrumRGB`? I don't know much about Google Home, but looking at the docs, I don't *think* you want to set `colorModel`. – Jon Skeet Feb 02 '20 at 08:37
  • Thanks. i just tried again with {"brightness":67,"spectrumRGB":12582656,"on":true} .. still same – kakopappa Feb 02 '20 at 08:43

1 Answers1

0

I found the reason. The response was missing color. Hope this will be helpful for someone else :D

{ 
   "requestId":"956cf9d4-6ac2-407d-b683-e04224303de6",
   "agentUserId":"5d8f3dd42ce05140dc1c6a20",
   "payload":{ 
      "devices":{ 
         "states":{ 
            "5e3679c9130c053f48888114":{ 
               "brightness":67,
               "color":{ 
                  "spectrumRGB":4915330
               },
               "on":true
            }
         }
      }
   }
}
kakopappa
  • 5,023
  • 5
  • 54
  • 73