Skip to content

Instantly share code, notes, and snippets.

@vicegold
Last active January 27, 2017 19:02
Show Gist options
  • Save vicegold/7ec27b477f6c53a8695ab97a44360846 to your computer and use it in GitHub Desktop.
Save vicegold/7ec27b477f6c53a8695ab97a44360846 to your computer and use it in GitHub Desktop.
# UDN-UUID of your Raumfeld device and AMP input
rfDevice="udn-uuid"
ampInput="line2"
# IP address of RF and AMP
rfIp="192.168.10.100:8080"
ampIp="192.168.10.101"
raumfeldStatus=$(curl -s http://$rfIp/raumserver/data/getRendererState?id=Laurids)
ampStatus=$(curl -s http://$ampIp/YamahaExtendedControl/v1/main/getStatus)
rfVolumeSet=`cat rfVol.txt`
ampVolumeSet=`cat ampVol.txt`
# Check if amp is turned on and on correct input
if [[ $ampStatus != *$ampInput* ]] || [[ $ampStatus == *"standby"* ]];
then
if [[ $raumfeldStatus == *$rfDevice* ]];
then
curl -s http://$ampIp/YamahaExtendedControl/v1/main/setPower?power=on
curl -s http://$ampIp/YamahaExtendedControl/v1/main/setInput?input=line2
fi
fi
# Set volumes
if [[ $raumfeldStatus == *$rfDevice* ]];
then
# Check volume state
if [[ $ampVolumeSet == true ]];
then
# Set higher volume for Raumfeld
curl -s http://$ampIp/YamahaExtendedControl/v1/main/setVolume?volume=121
rfVolumeSet=true
ampVolumeSet=false
fi
else
# Check volume state (You could turn off your AMP here too.)
if [[ $ampVolumeSet == false ]];
then
# Set lower volume for all other sources
curl -s http://$ampIp/YamahaExtendedControl/v1/main/setVolume?volume=40
rfVolumeSet=false
ampVolumeSet=true
fi
fi
# Save volume states
echo $rfVolumeSet> rfVol.txt
echo $ampVolumeSet > ampVol.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment