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 http://192.168.0.31/api/app/com.internet/pc-audio-off

https://developers.home-assistant.io/docs/en/external_api_rest.html

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."}' \
       http://localhost:8123/api/events/computer_event

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.