djtimca / hagooglewifi

Home Assistant integration for Google Wifi systems.
Apache License 2.0
81 stars 27 forks source link

Owner of multiple wifi points #4

Closed judeibe closed 3 years ago

judeibe commented 3 years ago

I manage my parent's wifi points as well as mine. Is it possible as part of the integration to choose which group to use? I messed around with the API and looks as if an array of groups is passed if the user has more than one.

djtimca commented 3 years ago

I don't have a way to test that scenario to see what data is returned. Are you able to post a sample file which would highlight how that data is represented when it is returned from the API?

judeibe commented 3 years ago

On this api call https://googlehomefoyer-pa.googleapis.com/v2/groups?prettyPrint=false the googlewifi library seems to pull the first id from groups. This is from the postman collection

// The first system's ID pm.environment.set("system_id", jdata["groups"][0]["id"]);

{
    "groups": [
        {
            "id": "AAAAAA6aoPQ",
            ....,
        },
       {
           "id": "AAAAABhsip0",
           ....,
        }
     ]
}
djtimca commented 3 years ago

That is odd then... in my library I iterate through the groups to capture all systems that are returned. Is the pm.environment code you listed from postman somewhere that I can look at?

judeibe commented 3 years ago

This is the link to the collection https://documenter.getpostman.com/view/7490211/SzzdD1pF?version=latest On Nov 27, 2020, 8:04 AM -0600, djtimca notifications@github.com, wrote:

That is odd then... in my library I iterate through the groups to capture all systems that are returned. Is the pm.environment code you listed from postman somewhere that I can look at? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

djtimca commented 3 years ago

Thanks @judeibe that's one of the docs I've been using to pull this together. But I am actually iterating through the systems in groups in my library so I'm wondering if the issue might be that Google isn't actually returning all of the systems under the account. Might be related to the token approach to authentication. I'll see if I can't put together a tool to get some test data in the way I'm pulling it so i can validate.

judeibe commented 3 years ago

I'll take a look at the api repo and if I can pin point the issue, I am facing I'll either create a new issue or pr.

djtimca commented 3 years ago

Fixed in latest push. Thanks @judeibe!