Turn on\off tasmota switch via WebRequest (PC logon\off)

HI all,

I’ve just moved over from using a Homey device, one feature I’m stuck on converting is turning on\off a switch when my PC starts up\shuts down.This is turn turn a subwoofer and speaker amp on and off as needed.

I used to have a powershell script run on logon and off to send a webrequest, how would I do this with home assistant?

Invoke-WebRequest -usebasicparsing -URI


Pick your favorite type from there.

For example, this will send an event to HA.

curl -X POST -H "Authorization: Bearer ABCDEFGH" \
       -H "Content-Type: application/json" \
       -d '{"message": "PC turned on."}' \

Replace (ABCDEFGH) with a long lived key that you should generate for your PC event app

You could create your own sensor if you wanted and update that status with curl commands. Whatever you want to do.