IFTTT Bravia commands for Google Assistant and Alexa
This is a DIY Bravia project to allow Alexa or Googgle Assistant to control any TV button press on your Bravia TV. This has been tested on Sony Android TV's
An example would be "Ok Google, TV On" or "Alexa, trigger, TV Input 1"
This process has several preequistes that might not make it possible or advisable to use for some users. There are offical methods that maybe better for some users, but this method gives me greater flexibility. If you have any suggestions please create an issue.
Get Node-Red using the following command
bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)
This should install Node.JS which is used for BST and PM2
Make sure your TV has a fixed IP otherwise commands won't work if IP is changed.
Keep note of the PIN and IP address of the TV this will be used later.
Make sure you are using at least v1.0.7 for better security with a key in the url
If v1.0.7 is not out yet add @1.0.7 to end of below command
Installed BST using
npm install bespoken-tools -g
To test BST Proxy we use the following command after BST is installed.
bst proxy http 1880
It will then say something similar to.
Your public URL for accessing your local service:
https://myskill.bespoken.link?bespoken-key=XXXXXXXX-XXXX-XXXX-XXXX-XXXX-XXXXXXXX
This URL will be used for our webhook commands in the IFTTT section.
To make this run in background we use PM2.
npm install pm2 -g
Create a directory to store the BST command in.
Eg make a directory called "bst"
Store a file in there called proxy.sh
In that file save the same command as above
bst proxy http 80 --secure
Now to save that command to BST, we do the following in the same directory as the script.
pm2 start proxy.sh --name="bst-proxy"
pm2 startup
This will save the script under the name "bst-proxy" and make sure it starts on boot.
What we want to do with ifttt is to create a trigger using either Alexa or Google Assistant depending on your platform. Choose what you want to say. (If you have multiple rooms, it's best to include the room name in the command)
It really doesn't matter what you choose for the action, choose something that is easy for you to remember. For a list of commands refer to bravia-commands.json. This application will only send actions to the TV that match commands in this file. #is for number $ is for text
Title Action https://[myskill].bespoken.link/bravia?bespoken-key=XXXXXXXX-XXXX-XXXX-XXXX-XXXX-XXXXXXXX/ Method Content Type application/json {"command":"{{TextField}}" ,"type": "TVCommand", "pin": " [PIN] ", "tv_ip": " [TV_IP] "}The body of the request is broken down into several values to be used to determine the action you want to perform
ValueOn the next step give it a descriptive name and save.
Once you have Node-Red up and running. Copy bravia-ifttt.json to clipboard.
Menu > Clipboard > Import > paste the example and press deploy.
This should create a HTTP endpoint which will accept HTTP POST requests at /bravia
Now assuming that everything is setup correctly, you should be able to say "Ok Google, TV On" and the TV will turn on.
Feel free to modify the list to suit your needs.