is it possible to remotely see laptop battery percentage, or output it into a web browser?

Posted by jhsevs@reddit | learnprogramming | View on Reddit | 2 comments

Long story long, I do IRL streaming using a homemade streaming backpack. My backpack uses a laptop. It works well, but I would like to be able to know my battery percentage without having to use remote desktop.

If I can output the battery percentage directly onto the stream, that would be perfect. I am using Open Broadcaster Software (OBS) for streaming.

I cannot use screen capture in OBS because as soon as I close the laptop screen, the screen capture freezes. I don't think there is a viable workaround to this.

However, the software Core Temp has a remote server plugin which outputs stats like cpu temperature etc to a local web server. In OBS you can add a web browser as an overlay source. Unfortunately Core Temp does not output any battery related stats. I had the idea of contacting the Core Temp author and ask if he would like to add this functionality to CT so that I could use the CT web server as a source in OBS, but I doubt he has time to bother with my suggestion. Also you can't use the CT web server directly as a source, as it has no UI elements, it only outputs info/stats as a constant stream of ascii characters if I understand it correctly. I don't know how to make it into a UI thing that OBS can capture and display.

I have tried googling this and found something called "getBattery() method" and "the Battery status API". Is this something you code into a HTML document? There was an example of some code on stackoverflow but it used {} symbols so I don't think it was HTML code. I tried pasting it into a HTML document but it didn't show anything useful when I opened the document in a browser. It might also only be meant to be used with mobile phones instead of laptops?

Is there a simple website online that just scans your battery status and outputs it on screen? I have tried looking but since google is AI riddled, I'm not getting any results but you guys might.

Even though I have a degree in electrical automation engineering and know how to program a PLC, I have 0 idea how to program a computer. So bear with me.