pablo / huawei-modem-python-api-client

Modem USB Huawei HTTP API Python client
MIT License
120 stars 50 forks source link

Getting battery status #27

Open themegabyte opened 3 years ago

themegabyte commented 3 years ago

Hello,

Thank you for your work on this.

I want to add support for getting the battery status. Any pointers on where I should start?

Thank you.

EDIT 1: I was able to get some information out using the get_from_url () function. I will keep this thread updated.

url = "{}/monitoring/status".format(ctx.api_base_url)
huaweisms.api.common.get_from_url(url, ctx)
TheSeriousProgrammer commented 2 years ago

I was playing around with my airtel 4g portable modem ,looks like it too was manufactured by huawei. Hence supporting the same api

When I was checking the network logs i got the following result from http://ip_addres/api/monitoring/status

Result: """ 901 902 3 19 3 1 1 1 25 0 100.117.75.7 203.145.160.5 59.144.144.106 1 16 16 2 1 1 101 0 5 0 0 mobile-wifi 0 1 0 """

The ones I highlighted in bold and italic looks to be the values for battery status :

The same needs to be added to the library cause the api cannot be accessed without cookies

I am not sure if the same will workout with the modems directly sold by huawei or modems with latest firmware cause mine is roughly 3 years old