I repeat myself:
Edit: that’s why I hate Windows. Let’s ask the AI - seems to be quite useful…
Absolutely — here’s the “extended” Windows version that covers sleep / hibernate / Modern Standby in addition to your boot = ON and shutdown = OFF requirement.
You can choose the policy you want:
- Policy 1 (pure power-state):
ON = boot / resume, OFF = shutdown / sleep / hibernate
- Policy 2 (strictly boot/shutdown only):
ON = boot, OFF = shutdown, ignore sleep/hibernate
(Still useful to detect sleep/modern-standby for troubleshooting.)
Below I’ll give you Policy 1, and I’ll point out what to skip if you want Policy 2.
SmartThings Virtual Switch from Windows power events (Boot / Shutdown / Sleep / Hibernate / Modern Standby)
Prerequisites (quick)
-
You have a SmartThings virtual switch (e.g. Laptop Active)
-
SmartThings CLI works manually:
smartthings devices:commands <DEVICE_ID> main:switch:on
smartthings devices:commands <DEVICE_ID> main:switch:off
1) Make the command as fast as possible
Recommended: call smartthings.exe directly (no PowerShell at shutdown)
This reduces “startup overhead” right when Windows is trying to power off.
Create two tiny .cmd files (fast to launch):
C:\SmartThings\st-laptop-on.cmd
@echo off
smartthings devices:commands <DEVICE_ID> main:switch:on
C:\SmartThings\st-laptop-off.cmd
@echo off
smartthings devices:commands <DEVICE_ID> main:switch:off
If smartthings is not in PATH, use the full path to smartthings.exe.
2) Boot → switch ON (reliable)
-
Task Scheduler → Create Task…
-
General
- Name:
ST Laptop ON (Startup)
Run whether user is logged on or not
Run with highest privileges
-
Triggers → New…
- Begin the task: At startup
- Optional: Delay task for 30 seconds (helps if Wi-Fi takes a moment)
-
Actions → New…
- Action: Start a program
- Program:
C:\SmartThings\st-laptop-on.cmd
- Start in:
C:\SmartThings\
3) Shutdown → switch OFF (best “planned shutdown” trigger)
3A) OFF on shutdown/restart initiation (Event ID 1074)
This is the common “shutdown initiated” event.
-
Task Scheduler → Create Task…
-
General
- Name:
ST Laptop OFF (Shutdown 1074)
Run whether user is logged on or not
Run with highest privileges
-
Triggers → New…
- Begin the task: On an event
- Log:
System
- Source:
User32
- Event ID:
1074
-
Actions
- Program:
C:\SmartThings\st-laptop-off.cmd
- Start in:
C:\SmartThings\
Important limitation
This won’t fire on hard power loss / crash (nothing can). Microsoft troubleshooting differentiates expected vs unexpected shutdowns (e.g. unexpected reboot/shutdown events).
4) Sleep / Hibernate (classic) — optional OFF/ON
4A) Entering sleep/hibernate → OFF (Kernel-Power 42)
Event ID 42 is widely used for “system is entering sleep.”
Create task:
4B) Resuming from sleep/hibernate → ON (Kernel-Power 107)
Event ID 107 appears as “system has resumed from sleep.”
Create task:
Alternative resume trigger (also common): Power-Troubleshooter 1
Many people trigger “wake” tasks using Power-Troubleshooter Event ID 1.
- Source:
Microsoft-Windows-Power-Troubleshooter
- Event ID:
1
Note: Some users report Power-Troubleshooter triggers aren’t always consistent on every system/power mode, so Kernel-Power 107 is often the simplest if it appears reliably for you.
5) Modern Standby (S0 “Connected Standby”) — optional OFF/ON
On Modern Standby systems, you may see Kernel-Power 506/507 for entering/exiting Modern Standby.
5A) Enter Modern Standby → OFF (Kernel-Power 506)
- Source:
Microsoft-Windows-Kernel-Power
- Event ID:
506
- Action:
st-laptop-off.cmd
5B) Exit Modern Standby → ON (Kernel-Power 507)
- Source:
Microsoft-Windows-Kernel-Power
- Event ID:
507
- Action:
st-laptop-on.cmd
6) If shutdown tasks are flaky: disable Fast Startup (highly recommended)
Fast Startup (hybrid shutdown) can make “shutdown” behave more like hibernate and can interfere with shutdown semantics. Disabling it often improves predictability.
Disable via Registry
Set HiberbootEnabled to 0.
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /v HiberbootEnabled /t REG_DWORD /d 0 /f
Reboot once afterward.
7) Choose your policy
Policy 1 (recommended if blinds should react to “laptop not running”)
Create all tasks:
- Startup → ON
- Shutdown 1074 → OFF
- Sleep 42 → OFF
- Resume 107 → ON
- Modern Standby 506 → OFF
- Modern Standby 507 → ON
Policy 2 (your original strict requirement)
Create only:
- Startup → ON
- Shutdown 1074 → OFF
…and skip sections 4 and 5.
8) Quick “what events does my laptop actually log?”
Event Viewer → Windows Logs → System → Filter Current Log…
Check these sources/IDs and see which appear on your machine:
User32 → 1074 (planned shutdown/restart)
Microsoft-Windows-Kernel-Power → 42 (enter sleep), 107 (resume)
Microsoft-Windows-Power-Troubleshooter → 1 (returned from low power state)
Microsoft-Windows-Kernel-Power → 506/507 (Modern Standby enter/exit)