jamesnetherton / homehub-cli

CLI for the BT Home Hub router
MIT License
37 stars 5 forks source link

Set DSL user and password #36

Open Behzad9 opened 3 months ago

Behzad9 commented 3 months ago

Add new command for set DSL user and password or please guide me to add it. internetConnectivityPppDSLPassword
internetConnectivityPppDSLUsername and set VCI.

jamesnetherton commented 3 months ago

It's a little bit complicated...

The homehub-client project provides the interface to the router:

https://github.com/jamesnetherton/homehub-client

In simple terms, you add a new function to the client:

https://github.com/jamesnetherton/homehub-client/blob/master/client.go

Then in this project, implement a new command. E.g.

https://github.com/jamesnetherton/homehub-cli/blob/master/cmd/light_brightness_set.go

And then register it here:

https://github.com/jamesnetherton/homehub-cli/blob/master/homehub-cli.go#L62

Behzad9 commented 3 months ago

Thank you for your guidance. My hub does not accept the user and password of other providers. Do you think that if I send my user and password through above commands (e.g: internetConnectivityPppDSLPassword), it will change or in this case it will give an error too?

jamesnetherton commented 3 months ago

will give an error too

Unfortunately, I really can't be sure because I no longer own the required router to test against.

Behzad9 commented 3 months ago

Thanks, is there a resource for further guidance on how to implement new functions? I have some problem about what variables need to be defined for implement the internetConnectivityPppDSL function.

jamesnetherton commented 3 months ago

What variables need to be defined

They way I reverse engineered the requirements for each request, was to just trace the HTTP traffic in the router admin UI. Then observe what the requests / responses looked like.

There's a few examples in here:

https://github.com/jamesnetherton/homehub-client/blob/master/hub.go

E.g the set light brightness API requires an int value:

https://github.com/jamesnetherton/homehub-client/blob/master/hub.go#L227