Hi all,
I created a new shortcut for my Audio system. If i launch the itunes shortcut, a batch starts, which will will power on my speaker via cURL/the REST interface of OH and then start itunes.
On windows you need to install cygwin and within cygwin please install cURL.
create a batch script (itunes.bat)
Place the following in your batch: (On a x86 machine the path might be different)
@echo OFF
ping -n 1 172.20.0.1
if errorlevel 1 goto iTunes
if errorlevel 0 goto cURL
:cURL
c:\cygwin64\bin\bash.exe --login -i -c 'curl --header "Content-Type: text/plain" --request POST --data "ON" http://user:password@172.20.0.1:8080/rest/items/AUDIO'
:iTunes
start "" "C:\Program Files\iTunes\iTunes.exe"
exit
You’ll need to replace the target of your itunes shortcut with your batch.
Set the shortcut to start minimized, so you won’t notice the cmd window.
EDIT: Added Ping check before sending data to the OH-Server (if your Laptop is not at home, don’t send a command, that wouldn’t be transfered)