Files
KVM_Switch/README.md
T
2026-03-27 15:43:44 +01:00

94 lines
2.2 KiB
Markdown

# Internal KVM Switch
FastAPI dashboard and polling service for Alienware-only KVM switching.
## Trigger Logic
The app targets Alienware AW3423DWF for switching and uses Samsung as trigger-only.
Monitor filtering:
- Alienware target monitor: description contains `AW3423DWF`
- Samsung trigger monitor: Samsung-only descriptions (`SAM...` / `SAMSUNG`)
- Other non-Alienware DDC monitors are ignored for trigger selection
Configure only one value per machine:
- this device Alienware target port: `DP1`, `DP2`, or `HDMI`
- optional auxiliary trigger monitor: selected in UI; if not set, auto-detection is used
Samsung trigger input codes mapped by port:
- `DP1` -> `15`
- `DP2` -> `19` (or `16` on some setups)
- `HDMI` -> `17`
- If Samsung trigger input matches this device port code, the app runs `monitor.set_input_source(<PORT>)` on `AW3423DWF` via `monitorcontrol`.
- If it does not match, the app waits.
Retry behavior:
- Only attempts switching while the Samsung screen is connected
- After each switch attempt, waits `5` seconds and rechecks
- Tries at most `3` times per Samsung-connected session
- After success, it will not try again until the Samsung screen disconnects and reconnects
## Run
```powershell
uv run kvm-switch
```
The dashboard is served at `http://localhost:4000`.
## Test
```powershell
uv run pytest -q
```
## Diagnostic Script
Use this to inspect connected DDC/CI monitors and current input values:
```powershell
uv run monitorcontrol_main.py
```
## Autostart
### Easiest option: Startup folder
1. Press `Win + R`
2. Run:
```text
shell:startup
```
3. Create a shortcut in that folder pointing to:
```text
C:\Users\LagoWorkStation\OneDrive\Documentos\BE-terna\Internal - KVM Switch\start_kvm_switch_background.vbs
```
This starts the app at logon in the background (no persistent console window).
### Cleaner option: Task Scheduler
Use Task Scheduler if you want it to start automatically at logon with better control.
Program/script:
```text
wscript.exe
```
Arguments:
```text
"C:\Users\LagoWorkStation\OneDrive\Documentos\BE-terna\Internal - KVM Switch\start_kvm_switch_background.vbs"
```
Set the trigger to `At log on`. Optional: enable `Hidden` in task settings.