From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
I am trying to read the battery level of 2 APC UPS's. I have simplified code from this example to use a kernel32 dll windows call to getpowerstatus. This works and returns the variables associsated with that windows call for 1 UPS. When a second UPS is added the code still functions however does not register additional information for the second UPS. I am not sure how to scale to the code to look for and communicate with 2 different UPS's. Any recommendations?
I would suggest checking out this article from Microsoft. It appears that the GetSystemPowerStatus call will only return information in general about all the power sources in the system, but in order to retrieve specific information about multiple batteries you will have to do a few more calls to the kernel32 DLL.
I found the thread that originated the example code you posted, and it looks like others have tried communicating with UPS devices in the past and had some trouble. But I'd recommend exploring the Microsoft documentation as a next step.