Hey folks. I need help from people who are smarter than me. We got two new Vizio TVs for Christmas and I need help getting the auth token to pair them with Home Assistant.
Here are my constraints: I’m running hassio, so I don’t have easy access to a command line. And my only other computer at the moment is a Windows laptop for work that I can’t install anything on.
I know that hassio has the pyvizio component built in, so my solution so far has been to create two command line sensors – one to initiate pairing and one to submit the pairing request with the PIN and pairing token. As convoluted of a solution as it is, it mostly works. I can get a pin to display on the TV and I can also submit a command with hard-coded pin and token (which, obviously, gets denied). When I template the command to pull in a PIN and token from other sensors (that I manually set), it just times out.
Here’s the hard-coded request I’m sending:
command: "/usr/bin/curl -k -H \"Content-Type: application/json\" -X PUT -d '{\"DEVICE_ID\": \"pyvizio\",\"CHALLENGE_TYPE\": 1,\"RESPONSE_VALUE\": \"'\"4444\"'\",\"PAIRING_REQ_TOKEN\": '\"666666\"'}' https://192.168.0.40:7345/pairing/pair"
And here’s the templated command:
command: "/usr/bin/curl -k -H \"Content-Type: application/json\" -X PUT -d '{\"DEVICE_ID\": \"pyvizio\",\"CHALLENGE_TYPE\": 1,\"RESPONSE_VALUE\": \"'\"{{ states('sensor.pin') }}\"'\",\"PAIRING_REQ_TOKEN\": '\"{{ states('sensor.pair_token') }}\"'}' https://192.168.0.40:7345/pairing/pair"
As you can see, I’ve escaped all the double-quotes in both commands. It seems, however, that these are getting stripped out when it’s sent by Home assistant. Here is what I see in the logs:
Timeout for command: /usr/bin/curl -k -H Content-Type: application/json -X PUT -d {"DEVICE_ID": "pyvizio","CHALLENGE_TYPE": 1,"RESPONSE_VALUE": "9129","PAIRING_REQ_TOKEN": 805943} https://192.168.0.40:7345/pairing/pair
So, I need someone who can help me properly format my command, so that it will be accepted. Or suggest an alternative approach, keeping in mind my constraints above. Any help is appreciated.