#!/bin/bash
# yamaha-remote.sh : power ON/OFF a yamaha amplifier
#
# Author: Mr Xhark -> @xhark
# License : Creative Commons http://creativecommons.org/licenses/by-nd/4.0/deed.fr
# Website : http://blogmotion.fr
VERSION="2016.02.07"
# Yamaha IP Address
IP="192.168.0.16"
URL="YamahaRemoteControl/ctrl"
ORDRE="\r\n"
POWER_ON="On"
POWER_OFF="Standby"
if [[ $# -eq 1 && $1 == "ON" ]]; then
ORDRE+=$POWER_ON
echo "ON"
elif [[ $# -eq 1 && $1 == "OFF" ]]; then
ORDRE+=$POWER_OFF
echo "OFF"
else
echo -e "Usage : `basename $0` |" && exit 0
fi
curl -v -H "Content-Type: text/xml" -X POST -d "${ORDRE}" http://${IP}/${URL}
echo