Skip to content

Instantly share code, notes, and snippets.

@balcsida
Created May 8, 2018 08:17
Show Gist options
  • Save balcsida/33d5cba90dbc3eed3f401d321a8c684f to your computer and use it in GitHub Desktop.
Save balcsida/33d5cba90dbc3eed3f401d321a8c684f to your computer and use it in GitHub Desktop.
Send commands to multiple WebOS TVs with LGWebOSRemote
#!/bin/bash
for filename in /home/pi/tvs/*.json; do
echo "-- $filename"
IP_ADDRESS="$(jq --raw-output '.ip' $filename)"
if ping -c1 $IP_ADDRESS 1>/dev/null 2>/dev/null
then
echo " Ping success"
cp $filename ~/.lgtv.json
/home/pi/LGWebOSRemote/lgtv.sh "$@"
else
echo " Ping failed"
fi
echo "--"
echo ""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment