Skip to content

[WIP] UPS control from the webplatform#135

Merged
RoiArthurB merged 4 commits intodevfrom
ups-control
Mar 25, 2026
Merged

[WIP] UPS control from the webplatform#135
RoiArthurB merged 4 commits intodevfrom
ups-control

Conversation

@RoiArthurB
Copy link
Copy Markdown
Contributor

Pull Request

Checklist

  • Code is complete and ready for review
  • Tests have been added/updated (if applicable)
  • Documentation has been updated (if applicable)

Description

Allow to control the UPS from the webplatform to do several things :

  • Disable bipping
  • Monitor when it's about to shutdown (TODO)
  • Turn off all the M2L2 automatically after a given time (3h ?) to not drain the battery after usage if badly turned off

Related Issue

#74 #126

- 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
@RoiArthurB RoiArthurB self-assigned this Mar 24, 2026
@RoiArthurB RoiArthurB added 🔌 Connection Issues with how applications are connecting together. 📦 M2L2 labels Mar 24, 2026
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

@RoiArthurB RoiArthurB merged commit 944e3b2 into dev Mar 25, 2026
1 of 2 checks passed
@RoiArthurB RoiArthurB deleted the ups-control branch March 25, 2026 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔌 Connection Issues with how applications are connecting together. 📦 M2L2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant