Sending http request from Windows 10 to turn on/off virtual switch

Hi guys, looking for help/direction on my latest project.

Essentially I would like to flip a HE virtual switch when I run a specific windows program and then turn off the switch when I shutdown the PC.

Can anyone assist me what the http request command looks like? Is it as simple as using a windows batch file which includes the following command (+ Maker API):

curl 'http://HE_Address/apps/api/xxx/devices/[Device ID]/on (or off)/access_token=xxxxxxx'

or do I need some additional options in the curl command to make it work? Thanks!

Here's an example of a HTTP Request in a powershell script I wrote. The call is at the end of the script. I'm sure there would be a batch script equivalent, but powershell would give you plenty more options over time if you want to expand it later.

2 Likes

Thanks - Will try out a simple powershell script tomorrow. We have a cheap used tiny PC in our family room for (among other things) zoom use. The webcam is hidden away behind the TV via a retract system I made off thingiverse, the plan is to extend the camera when zoom is launched and retract it when I shutdown the PC, all to be controlled via maker API and MQTT. Should be a fun little project.

1 Like

Download the Hubitat app