andrew-codechimp / HA-Andrews-Arnold-Quota

A Home Assistant integration to retrieve quota details of an Andrews & Arnold Broadband account
MIT License
6 stars 2 forks source link

Support "manager" accounts/don't presume the first line is the one to be displayed #56

Closed reedy closed 6 months ago

reedy commented 6 months ago

Checklist

Is your feature request related to a problem? Please describe.

This could be seen as a bug, it could be seen as a feature request...

I have a "manager" account, so when I log in to control.aa.net.uk, I have multiple accounts that appear, rather than just a single one because of a login. Which allowed me historically to view family member connections (for example) all in one place.

I'm not sure how it picked my parents line/login (when I log in to Control, "my" home login appears first), but I can tell it has due to the quota difference.

My parents are on 1TB quota, I'm on a 10TB.

image

I could login using my AB123@a account specifically for the line, but I shouldn't have to...

Describe the solution you'd like

If more than 1 line is found when logging in using credentials, let the user be able to pick which line.

Describe alternatives you've considered

Display quota of all lines found from login

Additional context

You can see from the graph, the massive drop off of quota after upgrading the add on, and logging in with my manager account.

image

image

image

andrew-codechimp commented 6 months ago

Hi, I've just looked at the API and there is a 5 digit account ID. I'll have to restructure the code and create entity id's like andrews_arnold_XXXXX_quota_remaining but that way it'll handle multiple. I only have 1 line myself so this will be a bit of a guess but when I get something working I'll put it in beta and ask for your feedback.

andrew-codechimp commented 6 months ago

Well once I started looking at that it was pretty easy, assuming my code for multi line works as expected. Please use HACS to redownload and show beta releases to get 2.1.x, or if you do it manually get the zip from the releases.

I'll hold in beta until you have tried it.

reedy commented 6 months ago

Thanks!

That definitely works, and is a good step in the right direction, but the ID being used isn't the most obvious. It is using to the ID from https://control.aa.net.uk/editline.cgi?ID=12345, rather than anything that potentially has some meaning. And while that is in the URL, I don't see it readily displayed anywhere else in control.

It excludes the various logins I have attached under my manager account that don't have (active) lines with quotas etc).

For some lines, having the phone number would make some sense (though, as phone numbers are getting more deprecated, and with A&A mostly not allowing outbound chargeable calling on them... They don't necessarily mean anything to everyone) ; 01234567890, but when others are BBEU12345678 (such as on FTTP, which has no phone number), that isn't so useful either.

Are you able to grab the login for each "line" and use that, rather than the ID? Which in theory, should be the ab123@a?

However, that alone might not actually be unique - my parents had 2 DSL lines on the same login, but obviously different phone numbers...

So, maybe... something like ab123@a (12345), pulling in both bits of information... Or even, all 3? ab123@a (12345; 01234567890/BBEU12345678)

Though, I can see that potentially causes other issues in HA, as the ID will get... even longer and complex?

Not sure offhand what may be useful to other people, or whether they have much interest in how it does look.

andrew-codechimp commented 6 months ago

Thanks for testing so quickly.

I've had a look around the AA control and also the quota and info API's and there's no identifier exposed that is unique to a line and guaranteed to be there other than the line id, with a lot of lines on an account I could imagine a friendly name being useful but that's on AA's side to improve.

It will have to be a one time activity within HA to give friendly names to your entities to identify them.