octo4a icon indicating copy to clipboard operation
octo4a copied to clipboard

Expose battery level

Open Gerigot opened this issue 2 years ago • 8 comments

Is there a way to expose through API or some script the battery level status so that, maybe with a plugin, being able to show it to the octoprint page, or connect it to the telegram plugin to have an alert when battery is about to run out. I had a problem not so long ago that I forgot to close the webcam view in cura and my phone "died" in the middle of a print.

A part of that now It's almost 6 month since I started using Octo4a with my ender 3 v2 and it's working perfectly so I want to say thank you all for the great work.

Gerigot avatar May 28 '22 14:05 Gerigot

solder charge cable to phone

wjflier avatar May 29 '22 11:05 wjflier

the problem it is not the charging system in this case, I'd like to have the battery level somehow exposed if it's possible. My exemple was only a use case, I know there are some other solutions but it would be nice to see the battery level in octoprint.

Gerigot avatar May 29 '22 20:05 Gerigot

solder charge cable to phone

Not everyone has the skills to solder (or the equipment or even the tools to open up the phone). :-)

kilimar avatar May 29 '22 23:05 kilimar

I am eagerly waiting for this as well, The camera server seems to be the downfall, long prints almost always fail due to dead battery.

Grover49 avatar Jun 01 '22 13:06 Grover49

You cant use this and rely only on a phone battery, its useless and impractical. You must either make or buy Y cable that will allow you to charge phone at the same time or soldier buck converter to a battery terminals. Y cable doesn't work with all phones but if it does its the most easiest solution

miroan81 avatar Jun 05 '22 00:06 miroan81

I know I wrote that my phone is always in charge but the webcam sometimes uses more energy that the charger can give ... And, as i wrote, it's also a supplementary feature that can be used just for showing the charge, mine was only a use case.

Gerigot avatar Jun 05 '22 09:06 Gerigot

The Y cable isn't supported on many phones. Thankfully it is on mine but I had to install many many kernels until I found a setup that allowed it. It's a real problem, not one I face but never the less i do understand what OP is feeling.

mramirkhan avatar Jun 05 '22 15:06 mramirkhan

I've hacked together a little plugin that exposes the battery level of the phone and can send telegram messages when battery is running low. Have a look here

https://github.com/tobiasgraf/OctoPrint-Octo4a_battery

tobiasgraf avatar Jun 21 '22 17:06 tobiasgraf

@tobiasgraf your plugin is amazing thank you! that's exactly what I needed. I will close this Issue.

Gerigot avatar Sep 27 '22 16:09 Gerigot

Anyone know the battery file path for Samsung Galaxy S5?

davidalim avatar Oct 09 '22 21:10 davidalim

I used ADB to browse to the file and it's actually there and has the battery percent. However still shows INVALID PATH.

davidalim avatar Oct 12 '22 17:10 davidalim

@davidalim can you please open a issue in my repo with as much information as possible? Like android version, are you rooted, file permissions and stuff like that. I'm guessing it is some sort of permission problem.

tobiasgraf avatar Oct 13 '22 14:10 tobiasgraf

Yes totally. Didn't know much about these files so assumed it was just my phone or something :)

I'm running this on a Samsung Galaxy S5 with LineageOS 18.1 (Android 11). Not rooted.

I did just install on my Galaxy S4 (running Pixel Experience 9) and it works! So personally no longer an urgent issue.

davidalim avatar Oct 13 '22 20:10 davidalim