Integrate CyberPower UPS with HA running in VirtualBox

So I have a new CyberPower UPS that i connected via USB to my PC.
I installed the CyberPower UPS software and the PC sees the UPS and is able to manage it.

On that same PC I have a VirtualBox VM running HA (Windows - Home Assistant) and I want the HA server to discover the UPS so I’d be able to manage it from there.

What are my options?
Do I need to provide access to the UPS USB port to my Guest OS (the HA VM)? If I do that, will the host OS continue to see the UPS and would I be able to manage it from the CyberPower software on the Host OS?

Can I discover the UPS via other means - i.e. some network port?

I’m basically looking for a step-by-step guide and recommendations how to wire the UPS up to the HA.

Thanks!

Stop and think about what the ups is actually protecting here. It’s protecting the host. So you want the software to manage the host so it can provide proper shut down.

You could pipe the USB port to the gust os and let ha manage it but you lose the port in the host (no you can’t do both at once) and if a battery event occurs your VM host won’t respond

What you’re instead going to be doing… Set the ups up for the host and get it gracefully shutting down the host os including VirtualBox.

You also need to work on gracefully shutting down the guest os on shutdown signal from VirtualBox to HA. Then battery event happens and tells the host to shut down and it says hold on let me tell ha. Which starts it’s shut down process. The host waits a predetermined time then shuts the os down.

You’ll have to get battery etc. Details from the cyberpower software or WMI on the host os (use something like HASS Agent)

1 Like

Ok, so if I correctly understand your point - I should continue using the CyberPower software on the host so that it can manage the graceful shutdown of both host and guest.
However, if I want to have the UPS details show up on my HA I’d need to run something like HASS Agent on the Host so that it can fetch data out of the cyberpower software and into HA.
How do I do that?

1 Like

That you are going to have to research.

Hass agent will let you query any WMI value you want from the host os. But I don’t know the specific metrics you’re going to want. Go read the docs on HASS agent. Specifically the part about WMI queries.

You’ll be looking for information on chassis battery if im not mistaken. I think that’s where Windows describes a system battery in the WMI name space.