Control the power state of a Windows PC from Home Assistant using:
- ๐ Wake-on-LAN to turn it on
- ๐ SSH to safely shut it down
- โ๏ธ Full configuration from the Home Assistant UI
- Turn on your PC using Wake-on-LAN
- Turn off your PC over SSH with proper shutdown command
- Status detection using ping
- Works with Windows PCs (SSH server required)
- Configure and edit PC settings directly from Home Assistant UI
- Supports multiple PCs as separate entries
- Prevents duplicates based on IP and MAC address
You can install this integration using either HACS (recommended) or manual setup.
-
Open Home Assistant and go to HACS โ Integrations.
-
Click the โฎ menu (top right) โ Custom repositories.
-
Add this repository:
https://github.com/Timman70/home-assistant-pc-power -
Set category to Integration, then click Add.
-
Go back to HACS โ Integrations, search for PC Power Control, and install it.
-
Restart Home Assistant.
-
Go to Settings โ Devices & Services โ + Add Integration, then search for PC Power Control.
If you donโt use HACS:
-
Download this repository as a ZIP:
https://github.com/Timman70/home-assistant-pc-power/archive/refs/heads/main.zip -
Extract it.
-
Copy the folder
pc_power_controlto your Home Assistant config:/config/custom_components/pc_power_control/You should now have files like:
/config/custom_components/pc_power_control/__init__.py /config/custom_components/pc_power_control/manifest.json /config/custom_components/pc_power_control/switch.py -
Restart Home Assistant.
-
Go to Settings โ Devices & Services โ + Add Integration, then search for PC Power Control.
When adding the integration, you'll need:
| Field | Description |
|---|---|
Name |
Friendly name for the PC |
Host |
IP address of the PC |
MAC |
MAC address for Wake-on-LAN |
Username |
Windows user with SSH access |
Password |
SSH password |
โ
Use 00:11:22:33:44:55 format for MAC address.
After setup, click Configure on the integration to change:
- IP address
- MAC address
- Username
- Password
- Name
All settings are editable directly in the Home Assistant UI.
- Enable Wake-on-LAN in BIOS and network adapter settings.
- Install and configure OpenSSH Server:
- Run
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0in PowerShell (as Admin) - Start service:
Start-Service sshd - Run on boot:
Set-Service -Name sshd -StartupType 'Automatic'
- Run
- Allow SSH in Windows Firewall.
- The switch entity reflects real-time power state using ping.
- Turning on uses Wake-on-LAN magic packet
- Turning off uses:
C:\Windows\System32\shutdown.exe /s /f /t 0 - Logging shows success/error for debugging.
If you see:
Config flow could not be loaded: 500 Internal Server Error
Make sure:
- You deleted all
__pycache__folders from/config/custom_components/pc_power_control/ - You're using the latest version of the integration
- You restarted Home Assistant fully after installing
To fully remove entities:
- Delete the integration from Home Assistant.
- Remove any leftover entities from Settings โ Entities.
- Or use Developer Tools to disable/hide them.
alias: Shut down PC at night
trigger:
- platform: time
at: "23:30:00"
condition: []
action:
- service: switch.turn_off
target:
entity_id: switch.my_pc
mode: singleCreated by TimCloud
๐ github.com/Timman70
Use at your own risk. Ensure your PCโs SSH server and network access are securely configured.