jrester / tesla_powerwall

Python API for Tesla Powerwall
MIT License
73 stars 25 forks source link

In _parse_uptime_seconds the last regexp capture should be nanoseconds, not microseconds #22

Closed jeffbstewart closed 3 years ago

jeffbstewart commented 3 years ago

I was using your implementation as a guide to implementing a parallel API in golang, and I came across an issue I wanted to flag to your attention.

Consider the following uptime response returned by my Tesla Energy Gateway:

148h28m15.954321454s

The existing parse uptime in this repo treats the value after the decimal as microseconds. Note however the 9 digits after the decimal. For microseconds, we would expect 6 digits. What's being returned by the gateway after the decimal is nanoseconds, rather than microseconds. Parsing it with the existing code adds about 15 minutes to the uptime duration.

Hope that helps.

jrester commented 3 years ago

Thanks for reporting! Didn't thought about this... Good luck with your golang API implementation.