Skip to content

Home EN

Protomothis edited this page Sep 26, 2026 · 4 revisions

SmartThings PC Control is a Windows service plus tray app that lets SmartThings — and, optionally, Telegram — control a Windows PC's power. It is a drop-in replacement for Remote Shutdown Manager and is fully compatible with the PCControl Edge driver: nothing changes on the SmartThings side. The detailed wiki pages are in Korean for now; this page gives English readers the essentials. The README also has a full English section.

What it does

Runs as a Windows service No user login needed, single exe, no runtime
9 commands ping shutdown restart hibernate suspend forceshutdown lock turnscreenoff turnscreenon over http://<pc-ip>:5001/{secret}/{command}
Grace period Remote shutdown/restart/suspend/hibernate wait 10 s – 30 min (default 5 min) and can be cancelled from a Windows toast, the tray, the app or Telegram. forceshutdown and commands issued from the app are always immediate
Telegram notifications 21 events in 5 categories (remote commands, schedules, power/service, security, system), quiet hours with one digest, HTML-templated messages, bot token encrypted with DPAPI
Control from Telegram /status /menu /lock /screenoff /screenon /sleep /hibernate /restart /shutdown [min] /cancel /now /mute /unmute /help, inline buttons, allow-listed chat IDs only. Messages are headed with the PC name, and one bot serves one PC
Desktop app Settings / Commands / Schedule / Notifications / Network / Logs tabs, tray icon, Korean/English, dark/light
Signed auto-update Releases carry an ed25519-signed update.json; the app installs only what verifies, with SHA-256 checks, one UAC prompt and rollback
Optional browser WebUI Off by default; local/LAN access when enabled with a secret

Quick start

Install

  1. Download smartthings-pc-control.exe from Releases and place it in a permanent folder, e.g. C:\Program Files\SmartThings PC Control\. config.json and the logs are created next to the exe, and the service points at that path — do not move it afterwards.
  2. Double-click the exe → Settings tab → Service Management → [Install] → approve UAC. The service (RemoteShutdownService), the firewall rule (TCP 5001) and auto-start are set up together.
  3. On the Settings tab set a Secret and press [Save]. Without a secret anyone on your LAN can control the PC.

SmartThings

  1. Install the PCControl Edge driver on your hub and add a PC device.
  2. In the device settings enter the PC's IP address, port (5001) and the same secret. Add the MAC address shown on the app's Network tab if you want Wake-on-LAN.
  3. Test with ping. The service answers OK; wrong secrets get 401.

There is also a purpose-built Edge driver (SmartThings Edge 드라이버, Korean), installed from the Protomothis channel (https://bestow-regional.api.smartthings.com/invite/Kr2zNWYgpp2A). It finds the PC over SSDP — with the PC on and PC Control running, Add device → Scan nearby is the only way to add it — so only the secret is typed, and shows the real power state (sleeping / hibernated / waking / shutting down), the grace countdown with its origin, schedules and cancel, connection and Wake-on-LAN diagnostics, and screen on/off in its command list — the legacy /{secret}/{command} path is unchanged, so moving to it is optional; with more than one PC see 여러 PC 설정 (several PCs).

Telegram (optional)

  1. Send /newbot to @BotFather and copy the token.
  2. Send any message to your new bot.
  3. App → Notifications tab → paste the token → [Find Chat ID] → pick the chat → [Send test].
  4. Turn on "Enable Telegram notifications" → [Save]. To send commands from Telegram, also turn on "Allow Telegram commands to control this PC" (optionally list extra Allowed Chat IDs).

No open ports or webhooks are needed — the service only makes outbound Bot API calls and long-polls getUpdates.

The tabs

Tab What is there
Settings Service install/start/uninstall; Port, Secret, Remote grace (Off / 10 sec / 30 sec / 1 min / 5 min / 10 min / 30 min), "Allow browser WebUI access (local+LAN)"; Open WebUI, Restart Service; "Start in tray at login", "Check for updates on startup", [Check for updates]
Commands Run any command on this PC now; power commands ask for confirmation
Schedule Command + 5/15/30/60/120-minute preset, large countdown, origin label ("SmartThings remote command · grace period" or "Scheduled from this app / WebUI"), [Cancel Schedule]
Notifications Telegram connection (token, Chat ID, Find Chat ID, Send test, bot status), Control from Telegram, Notifications to receive (per-category master + per-event checks, All on / All off), Quiet hours, Display (Detail Simple/Full, PC name)
Network WoL readiness, per-adapter MAC / IPs / WoL state, external IP
Logs Last 100 lines of service.log, filter, 3-second auto-refresh, open file / folder

The Settings and Notifications tabs have a fixed [Save] bar that is enabled only when something changed; switching tabs or closing the window with unsaved edits asks Keep editing / Don't save / Save. Closing the window minimizes to the tray (left click = open, right click = menu with Open, status, Commands, Cancel Schedule, Open WebUI, Exit). After the first launch the app starts in the tray at login so grace toasts can appear.

Configuration summary

config.json next to the exe (the service writes every key):

{
  "port": 5001,
  "secret": "",
  "webui_remote": false,
  "shutdown_grace": true,
  "grace_seconds": 300,
  "telegram": {
    "enabled": false, "bot_token": "dpapi:...", "chat_id": "",
    "control_enabled": false, "allowed_chat_ids": [],
    "detail": "full", "lang": "en", "pc_name": "",
    "quiet_hours": { "enabled": false, "start": "22:00", "end": "07:00", "security_bypass": true, "digest": true }
  },
  "notify": {
    "remote":   { "received": true, "grace_scheduled": true, "grace_cancelled": true, "executed": true, "force": true },
    "schedule": { "created": false, "cancelled": false, "executed": true, "replaced": true },
    "power":    { "started": true, "resumed": true, "stopping": false },
    "security": { "unauthorized": true, "login_limited": true, "unknown_command": true, "config_changed": true, "unknown_chat": true },
    "system":   { "update_available": true, "updated": true, "exec_failed": true, "tray_wake_failed": true }
  }
}
  • Only port and webui_remote need a service restart; everything else applies on save.
  • bot_token is stored DPAPI-encrypted (machine scope). The app and API only ever see ****1234; send - to clear it. A config copied from another PC loses the token — enter it again.
  • allowed_chat_ids empty means only chat_id may send commands.
  • Quiet hours may cross midnight; held events are delivered as one digest when the window ends. Grace-started and force-shutdown alerts always go through.
  • Other files next to the exe: state.json (last run version, last announced release), service.log (rotates at 512 KB, keeps .1–.3), gui.log (self-update steps).

CLI

smartthings-pc-control.exe install          # register + start service, firewall rule (admin)
smartthings-pc-control.exe uninstall        # remove service + firewall rules (admin)
smartthings-pc-control.exe status           # service state, port, secret
smartthings-pc-control.exe version
smartthings-pc-control.exe run              # console mode for debugging (do not run alongside the installed service)
smartthings-pc-control.exe gui [--minimized]

The local API on port 5002 (/api/login, /api/config, /api/schedule, /api/test/{cmd}, /api/logs, /api/wol-status, /api/restart-service, /api/telegram/test|me|chats) needs a session cookie when a secret is set and the header X-Requested-With: XMLHttpRequest on every POST/DELETE.

Updating

The app checks GitHub Releases at startup and every 24 hours (the service also checks daily and can notify via Telegram). [Update now] verifies the release's signed manifest with the embedded public key, downloads the named exe, compares its SHA-256, then — after one UAC prompt — stops the service, swaps the exe (keeping the old one as .old), restarts the service and relaunches the app. Unsigned or unverifiable releases only get an [Open download page] button. Steps are logged to gui.log.

Building

CGO_ENABLED=1 go build -ldflags="-s -w -H=windowsgui -X main.Version=v1.0.0" -o smartthings-pc-control.exe .

Requires CGO with MinGW-w64 gcc (Fyne). Pushing a v* tag builds, signs and publishes the release through GitHub Actions. Developer notes (in Korean) are in 아키텍처; design documents in docs/design/ are also Korean.

Korean pages

Home · 설치와 첫 설정 (install) · 데스크톱 앱 가이드 (app guide) · SmartThings 연동 · SmartThings Edge 드라이버 (Edge driver) · 여러 PC 설정 (several PCs) · 원격 명령 유예와 예약 (grace & schedules) · 텔레그램 알림 설정 (Telegram notifications) · 텔레그램에서 PC 제어 (control from Telegram) · 알림 카테고리와 조용한 시간대 (event catalogue & quiet hours) · 자동 업데이트와 서명 (signed updates) · 설정 파일 레퍼런스 (config reference) · CLI와 API 레퍼런스 · 보안 (security) · 문제 해결과 FAQ (troubleshooting) · 아키텍처 (architecture)

Clone this wiki locally