I have been reading some posts as I wanted to have a battery monitoring sensor for the laptop I am running the HA server in (VirtualBox). There are some potential solutions with a script and all. But some of us want a simpler method. It would be great if the HomeAssistant companion app was available for Widows or ported to Windows (maybe in Windows 11? I haven’t used this OS yet.)
The solution I used is to install an Android in VirtualBox on the same laptop. Then I logged in to the play store, downloaded the companion app, and logged in to my local HA instance.
Then in my HA, there were a bunch of sensors shown and I could create automation based on them.
The status of the battery shown in VirtualBox’s android is in sync with the laptop’s battery status with acceptable delay.
I have used Android ISO from Release Android-x86 CM Release 14.1 - Android-x86 - OSDN and used
“cm-x86_64-14.1-r5-k419.iso”
I used this simple instruction to install LineageOS in VirtualBox Android on Virtualbox - Lineage OS 14 🔥🔥🔥 - YouTube
Other than that, the network setting I used for Android VM is “Bridged Adapter”.
My use case here is that since I am using my laptop as a server I am keeping my charger always attached. But for battery health, I want to let the laptop discharge at a certain level and then charge it again by controlling a smart outlet the laptop charger is plugged into. With these sensors available there are possibilities of other automation as well, maybe it can tell there is a power outage!
The downside is having another VM that will require some disk space, processor, and RAM.