huawei-modem-python-api-client
huawei-modem-python-api-client copied to clipboard
Getting battery status
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)
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 :
- first number denotes charging status 1 for charging and 0 for discharging
- 2nd number denotes battery level in digits (0 for 0% , 1 for 25% , 2 for 50% , 3 for 75% and 4 for 100% )
- 3rd number denotes battery level in percentage (it only shows one out 5 values i.e 0,25,50,75,100)
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