Skip to content

Instantly share code, notes, and snippets.

@henrik
Last active August 6, 2023 23:08
Show Gist options
  • Save henrik/7d8123d8fe0a84fa7f69cbc5a90574a6 to your computer and use it in GitHub Desktop.
Save henrik/7d8123d8fe0a84fa7f69cbc5a90574a6 to your computer and use it in GitHub Desktop.
#!/bin/sh
set -e
if [ "$1" = "" ] || [ "$2" = "" ] ; then
echo "Usage: $0 <TV_IP> <PSK>"
exit 1
fi
# https://gist.github.com/henrik/32bb3b037b728b81a560d3676c7cfcf7
hdmi1="AAAAAgAAABoAAABaAw=="
hdmi2="AAAAAgAAABoAAABbAw=="
# https://pro-bravia.sony.net/develop/integrate/rest-api/spec/service/avcontent/v1_0/getPlayingContentInfo/index.html
status=$(curl --silent -H "X-Auth-PSK: $2" -XPOST http://$1/sony/avContent -d '{"method": "getPlayingContentInfo","id": 1, "params": [],"version": "1.0"}')
if [[ "$status" == *"hdmi?port=1"* ]]; then
~/Library/Scripts/send_sony_tv_command.sh "$1" "$hdmi2"
else
~/Library/Scripts/send_sony_tv_command.sh "$1" "$hdmi1"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment