-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Create Smart Battery Module #3944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Right now there's a bunch of code for logging, might remove that later on or make it a toggle in settings |
I made logging an option in settings, app is good to go. This is my first module I've made, so if anything looks strange, I would love to get feedback on it :) |
I decided to try it out on physical hardware. Currently the behaviour is weird where it shows 0hr (logging off) but turning on loging gives me a figure ranging from 8hr to 99days (which i expected). Hopefully it is just a temp thing and in a day or so it starts working properly. We shall see P.S. Isnt logging just for debuging? Or does it actually have an effect on the module? |
@RelapsingCertainly Logging shouldn't change anything fundamental, you're right, it's just for debugging. Give it up to 2 days to see if the drainage rate is just fluctuating, and it's still learning from that. I would love to hear a status update on this later on :) PS: how did you install the app? If you copied the files into the ide and uploaded it, maybe something went awry there... |
@RelapsingCertainly I have it installed through my app loader on my watch, and it seems pretty steady and accurate, logging doesn't have an impact... If the problem is still there, try installing it with my app loader, and see if that fixes anything |
I did just download the files, rename them according to the metadata and uploaded them. I'll try to use the app loader in case that makes a difference |
Looks like it was an ide error. Its now saying 99days so it looks like estimates are at least being made |
@RelapsingCertainly Glad to hear! Let me know how it goes after a few days :) |
I was able to use the module for a bit and it works pretty well. I think it took around 6 hours to get a decent estimate and was surprisingly accurate. P.s. if u are interested, i have made a clockinfo for smartbatt that would probably work well if bundled with the widget or module. |
Glad to hear! :)
@RelapsingCertainly That would be amazing! If you want, you could make a separate PR for it, or you could drop the code here and I can add it with you as a contributor? |
I was thinking of making an app for it, where it shows average drainage, current drainage, and the time it is estimated to die... |
Heres the link to a gist with the clock info code. Could use some polish tbh: https://gist.github.com/RelapsingCertainly/03f91f0dbba33d940aad263416c77ad5 |
Oh as for the app idea, i wonder if it just should be an battery app that takes data for both power manager and smart batt together? I imagine smartbatt being the prediction algorithm per say and power manager as having all the actual hardware things. Edit: i made a forum post to explain it https://github.com/orgs/espruino/discussions/7827#discussion-8666123 |
@RelapsingCertainly That looks really good! Maybe I'll add another clockInfo with current drainage rate, and days left as well :) |
Turns out redrawing was messed up so i fixed it in the gist. It should now update the clockinfo text and icon once a minute. |
Current drainage sounds good, but what do you mean "and days left", like another card with the days remaining? (the existing card already does that) or a card with drainage and days remaining together? |
@RelapsingCertainly Sorry, forgot that the whole point of the module was to show the days remaining! lol... |
Nice! I'll get to work adding this into the module :) |
Lmfao, its cool 😂 the clockinfo basically acts as a replacement for the battery clock info. It shows percentage when charging, days left if time left is more than 24hours or, hours left if there is less than a days amount of charge. In the future, a click might show percentage for a bit (like the widget) or open a battery app. |
@RelapsingCertainly I added the clockInfo, and added a second one for average battery drainage. Try reinstalling the app from my app loader, and check it out! |
The clock info is broken again, idk if it my watch or just the clock info but it's not updating either on charge or to show the new estimate. P.s. Power manager might be broken since the battery percentage stays the same charging or not until its reloaded. Im currently running an experiment to see if 0.12 is indeed broken, ill report back with my finding. P.p.s turns out this module is a hard thing to test since my previous typical drainage would be around 5% per day. |
Well im back and can confirm, powermanager stable percentage is broken. After disabling it, both clock infos are working as they should. |
@RelapsingCertainly How is it broken? I have it installed for me, and it works well... |
Ok, I see what's broken now, created #3958 to fix that. Thanks! |
This provides a module an app can use for battery. It learns your usage patterns over time by averaging out drainage rates, and extrapolates that into a pretty accurate prediction.