[WIP] UPS control from the webplatform#135
Merged
RoiArthurB merged 4 commits intodevfrom Mar 25, 2026
Merged
Conversation
- Using `node-hid` to communicate with the UPS - Detailed explanation can be found here : #126 (comment) - Add reverse engineered library to communicate exactly with APC Back-UPS BX2200MI - Add a test file to check communication with UPS
Sends `reboot -p` to every currently streaming ADB device using the existing adbServer.createTransport + Adb.subprocess pattern.
- Connects to APC Back-UPS via HID with up to 4 retries (5s delay) - Warns with a banner if product name is not Back-UPS BX2200MI - Disables beeper on connect - Polls every 5s and emits typed events (power-lost/restored, battery-low/critical) - Auto-reconnects on cable disconnect or HID error (retries every 5s indefinitely) - Exposes isConnected(), isOnAC(), armShutdown(), close()
- Instantiates UpsManager in constructor and connects in initialize() - Starts a 3-hour setTimeout on startup - On timeout: if UPS is on battery or absent, powers off all headsets via AdbManager.shutdownAllHeadsets(), arms UPS 2-min cutoff, then shuts down the host computer after 30s - No-ops if UPS reports AC present at timeout
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Pull Request
Checklist
Description
Allow to control the UPS from the webplatform to do several things :
Related Issue
#74 #126