I run Hass.io on a Pi and I want to trigger a script (or turn of a switch) from a Windows computer on my LAN. Typically by running a manually triggered or scheduled batch/cmd/vbs script locally on the Windows computer.
I realized that you actually can use curl natively in Windows 10, build 17063 and later, so I went for that approach. The main hassle was to get the " right since it differs from Linux.
I use this to switch off a monitor from an old MCE remote.
MCE remote + MCE keyremapper (mapping keypress to keypress combination) + AutoHotKey (to run the command) + the command above = Profit
Works reliably, flawlessly and is actually really fast. No delay at all.
I got the switch working perfectly thanks to your sample, do you know how you would check for a state in a batch script? Like if media_player.tv == on then do this …
I think it would be to complex to do it in the batch script outside of HA.
But you could use the above to start a script in HA instead of toggle a switch.
And in that HA script, you could use conditions as usual.