1

I'm developing an Action on Google and I have a question about agentUserID. In documentation I see this information to reportstate command:

{
  "requestId": "123ABC",
  "agentUserId": "user-123",
  "payload": {
    "devices": {
      "states": {
        "light-123": {
          "on": true
        }
      }
    }
  }
}

In this reportstate command there is the agentUserId.

1 - Can I to bound the same device with two agentUserId(i.e. two accounts)?

2 - If the anwser of question 1 one is yes, Should I send two reportstate command for Home Graph, one with agentUserID-1 and other with agentUserID-2?

1 Answers1

1

As it is defined in the reference documentation, the agentUserId:

Reflects the unique (and immutable) user ID on the agent's platform. The string is opaque to Google, so if there's an immutable form vs a mutable form on the agent side, use the immutable form (e.g. an account number rather than email).

On your end, you can bind the same device to two separate user accounts and agentUserIds, although from the perspective of the platform they will be internally viewed as two separate devices.

So if you have one light and two accounts, you can still handle execution commands for both by mapping devices to a single entity on your side and it will work without issue.

But yes it does mean you will need to report two separate states to update both devices from the perspective of the Home Graph.

Nick Felker
  • 11,536
  • 1
  • 21
  • 35
  • thanks for anwser. Looking at your anwser I see that I shoudn't bind the same device to two or more separate user agentUserIds. Please, look at this situation: there are a gate in a condominium and I need to bind this device with hundreds of users. I see that is impossible send reportstate command for hundreds of agentUserID. Can you help me how can I resolve this case? @NickFelker – Reis Simões Apr 04 '22 at 19:54
  • You can bind one device to multiple agentUserIds, but you'll need to do this report state for every account. – Nick Felker Apr 05 '22 at 17:31
  • The smart home platform is designed to be home-focused, with only a few users in a single structure. It does have some scaling limitations for your kind of use-case that means you may need to do some odd workarounds like that. – Nick Felker Apr 05 '22 at 17:32
  • Another alternative is to use the attribute [`commandOnlyOpenClose`](https://developers.google.com/assistant/smarthome/traits/openclose) although you won't be able to get its state. – Nick Felker Apr 05 '22 at 18:38
  • But I still will need to do the report state for every account, is this mandatory. For me the problem is this, I beleave the the Google should to allow that I report the state of the device(deviceID) and not of the user's devices(agentUserId). For me this is not good because can uses a lot resouce in third part server. But thanks for help me. – Reis Simões Apr 06 '22 at 19:29