From 7a596a5086079ee62350ed2911a15704ae35901f Mon Sep 17 00:00:00 2001 From: Jake XPS Date: Sat, 3 Sep 2022 11:27:29 -0700 Subject: [PATCH 1/5] Adding TOC --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e49c0ea..cd94076 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Vizio SmartCast API (2016+ Models) +[[_TOC_]] + ## API Clients The following API clients are available based on these API docs: From b159f75233071a8b33af6346bf08cd7932d96dfc Mon Sep 17 00:00:00 2001 From: Jake XPS Date: Sat, 3 Sep 2022 11:28:15 -0700 Subject: [PATCH 2/5] rolling back --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index cd94076..e49c0ea 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Vizio SmartCast API (2016+ Models) -[[_TOC_]] - ## API Clients The following API clients are available based on these API docs: From c294bb5a10c50a4772caae831e8a42e1b5e2f3e8 Mon Sep 17 00:00:00 2001 From: Jake XPS Date: Sat, 3 Sep 2022 11:33:45 -0700 Subject: [PATCH 3/5] Adding a postman folder --- Postman/01 - Pairing.postman_collection.json | 89 ++++++++++ Postman/Inputs.postman_collection.json | 165 +++++++++++++++++++ Postman/MyVizio.postman_environment.json | 59 +++++++ 3 files changed, 313 insertions(+) create mode 100644 Postman/01 - Pairing.postman_collection.json create mode 100644 Postman/Inputs.postman_collection.json create mode 100644 Postman/MyVizio.postman_environment.json diff --git a/Postman/01 - Pairing.postman_collection.json b/Postman/01 - Pairing.postman_collection.json new file mode 100644 index 0000000..3a4817f --- /dev/null +++ b/Postman/01 - Pairing.postman_collection.json @@ -0,0 +1,89 @@ +{ + "info": { + "_postman_id": "4053f1a8-d64c-4ea0-8702-5bee7cbc188e", + "name": "01 - Pairing", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "01 - Pairing Start", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "postman.setEnvironmentVariable(\"PAIRING_REQ_TOKEN\", jsonData.ITEM.PAIRING_REQ_TOKEN);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"DEVICE_NAME\": \"Vizio\",\r\n \"DEVICE_ID\": \"{{DEVICE_ID}}\"\r\n}" + }, + "url": { + "raw": "{{RootURI}}/pairing/start", + "host": [ + "{{RootURI}}" + ], + "path": [ + "pairing", + "start" + ] + } + }, + "response": [] + }, + { + "name": "02 - Pairing Challenge", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "postman.setEnvironmentVariable(\"AUTH_TOKEN\", jsonData.ITEM.AUTH_TOKEN);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"DEVICE_ID\": \"{{DEVICE_ID}}\",\r\n \"CHALLENGE_TYPE\": 1,\r\n \"RESPONSE_VALUE\": \"{{PIN}}\",\r\n \"PAIRING_REQ_TOKEN\": {{PAIRING_REQ_TOKEN}}\r\n}" + }, + "url": { + "raw": "{{RootURI}}/pairing/pair", + "host": [ + "{{RootURI}}" + ], + "path": [ + "pairing", + "pair" + ] + } + }, + "response": [] + } + ] +} \ No newline at end of file diff --git a/Postman/Inputs.postman_collection.json b/Postman/Inputs.postman_collection.json new file mode 100644 index 0000000..db874ae --- /dev/null +++ b/Postman/Inputs.postman_collection.json @@ -0,0 +1,165 @@ +{ + "info": { + "_postman_id": "9f0fd0cd-35cd-4a2c-98ba-1153bc98d0b1", + "name": "Inputs", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Change Input", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Auth", + "value": "{{AUTH_TOKEN}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"REQUEST\": \"MODIFY\",\r\n \"VALUE\": \"{{InputFireTVValue}}\",\r\n \"HASHVAL\": {{CurrentInputHash}}\r\n}" + }, + "url": { + "raw": "{{RootURI}}/menu_native/dynamic/tv_settings/devices/current_input", + "host": [ + "{{RootURI}}" + ], + "path": [ + "menu_native", + "dynamic", + "tv_settings", + "devices", + "current_input" + ] + } + }, + "response": [] + }, + { + "name": "List Inputs", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "\r", + "postman.setEnvironmentVariable(\"InputFireTVValue\", jsonData.ITEMS[1].NAME);\r", + "postman.setEnvironmentVariable(\"InputFireTVHash\", jsonData.ITEMS[1].HASHVAL);\r", + "\r", + "postman.setEnvironmentVariable(\"InputTVValue\", jsonData.ITEMS[7].NAME);\r", + "postman.setEnvironmentVariable(\"InputTVHash\", jsonData.ITEMS[7].HASHVAL);" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Auth", + "value": "{{AUTH_TOKEN}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{RootURI}}/menu_native/dynamic/tv_settings/devices/name_input", + "host": [ + "{{RootURI}}" + ], + "path": [ + "menu_native", + "dynamic", + "tv_settings", + "devices", + "name_input" + ] + } + }, + "response": [] + }, + { + "name": "Get Current Input", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "\r", + "postman.setEnvironmentVariable(\"CurrentInputHash\", jsonData.ITEMS[0].HASHVAL);\r", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Auth", + "value": "{{AUTH_TOKEN}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{RootURI}}/menu_native/dynamic/tv_settings/devices/current_input", + "host": [ + "{{RootURI}}" + ], + "path": [ + "menu_native", + "dynamic", + "tv_settings", + "devices", + "current_input" + ] + } + }, + "response": [] + } + ] +} \ No newline at end of file diff --git a/Postman/MyVizio.postman_environment.json b/Postman/MyVizio.postman_environment.json new file mode 100644 index 0000000..a47b2c9 --- /dev/null +++ b/Postman/MyVizio.postman_environment.json @@ -0,0 +1,59 @@ +{ + "id": "968fd247-eaff-432a-af81-2de650fb52f5", + "name": "MyVizio", + "values": [ + { + "key": "DEVICE_ID", + "value": "", + "enabled": true + }, + { + "key": "PAIRING_REQ_TOKEN", + "value": "", + "enabled": true + }, + { + "key": "AUTH_TOKEN", + "value": "", + "enabled": true + }, + { + "key": "RootURI", + "value": "https://192.168.1.xxx:7345", + "enabled": true + }, + { + "key": "PIN", + "value": "", + "enabled": true + }, + { + "key": "InputTVValue", + "value": "", + "enabled": true + }, + { + "key": "InputTVHash", + "value": "", + "enabled": true + }, + { + "key": "InputFireTVValue", + "value": "", + "enabled": true + }, + { + "key": "InputFireTVHash", + "value": "", + "enabled": true + }, + { + "key": "CurrentInputHash", + "value": "", + "enabled": true + } + ], + "_postman_variable_scope": "environment", + "_postman_exported_at": "2022-09-03T18:30:31.361Z", + "_postman_exported_using": "Postman/9.4.1" +} \ No newline at end of file From a97e7955ac76e9db49109d8458d072d3030123ac Mon Sep 17 00:00:00 2001 From: Jake XPS Date: Sat, 3 Sep 2022 11:59:45 -0700 Subject: [PATCH 4/5] adding power calls --- Postman/Inputs.postman_collection.json | 37 ++++++++------- Postman/MyVizio.postman_environment.json | 37 ++++++++++++--- Postman/Power.postman_collection.json | 60 ++++++++++++++++++++++++ 3 files changed, 110 insertions(+), 24 deletions(-) create mode 100644 Postman/Power.postman_collection.json diff --git a/Postman/Inputs.postman_collection.json b/Postman/Inputs.postman_collection.json index db874ae..d88b362 100644 --- a/Postman/Inputs.postman_collection.json +++ b/Postman/Inputs.postman_collection.json @@ -6,20 +6,26 @@ }, "item": [ { - "name": "Change Input", + "name": "01 - Get Current Input", "event": [ { "listen": "test", "script": { "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "\r", + "postman.setEnvironmentVariable(\"CurrentInputHash\", jsonData.ITEMS[0].HASHVAL);\r", "" ], "type": "text/javascript" } } ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, "request": { - "method": "PUT", + "method": "GET", "header": [ { "key": "Content-Type", @@ -34,7 +40,7 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"REQUEST\": \"MODIFY\",\r\n \"VALUE\": \"{{InputFireTVValue}}\",\r\n \"HASHVAL\": {{CurrentInputHash}}\r\n}" + "raw": "" }, "url": { "raw": "{{RootURI}}/menu_native/dynamic/tv_settings/devices/current_input", @@ -53,19 +59,20 @@ "response": [] }, { - "name": "List Inputs", + "name": "02 - List Inputs", "event": [ { "listen": "test", "script": { "exec": [ "var jsonData = JSON.parse(responseBody);\r", + "var thisInputName;\r", "\r", - "postman.setEnvironmentVariable(\"InputFireTVValue\", jsonData.ITEMS[1].NAME);\r", - "postman.setEnvironmentVariable(\"InputFireTVHash\", jsonData.ITEMS[1].HASHVAL);\r", - "\r", - "postman.setEnvironmentVariable(\"InputTVValue\", jsonData.ITEMS[7].NAME);\r", - "postman.setEnvironmentVariable(\"InputTVHash\", jsonData.ITEMS[7].HASHVAL);" + "// loop through inputs to create env vars\r", + "for (let i = 0; i <= 7; i++) {\r", + " thisInputName = jsonData.ITEMS[i].NAME\r", + " postman.setEnvironmentVariable(thisInputName, jsonData.ITEMS[i].NAME);\r", + "}" ], "type": "text/javascript" } @@ -109,26 +116,20 @@ "response": [] }, { - "name": "Get Current Input", + "name": "03 - Change Input", "event": [ { "listen": "test", "script": { "exec": [ - "var jsonData = JSON.parse(responseBody);\r", - "\r", - "postman.setEnvironmentVariable(\"CurrentInputHash\", jsonData.ITEMS[0].HASHVAL);\r", "" ], "type": "text/javascript" } } ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, "request": { - "method": "GET", + "method": "PUT", "header": [ { "key": "Content-Type", @@ -143,7 +144,7 @@ ], "body": { "mode": "raw", - "raw": "" + "raw": "{\r\n \"REQUEST\": \"MODIFY\",\r\n \"VALUE\": \"{{TV}}\",\r\n \"HASHVAL\": {{CurrentInputHash}}\r\n}" }, "url": { "raw": "{{RootURI}}/menu_native/dynamic/tv_settings/devices/current_input", diff --git a/Postman/MyVizio.postman_environment.json b/Postman/MyVizio.postman_environment.json index a47b2c9..9ea48d0 100644 --- a/Postman/MyVizio.postman_environment.json +++ b/Postman/MyVizio.postman_environment.json @@ -28,32 +28,57 @@ "enabled": true }, { - "key": "InputTVValue", + "key": "CurrentPowerState", "value": "", "enabled": true }, { - "key": "InputTVHash", + "key": "CurrentInputHash", "value": "", "enabled": true }, { - "key": "InputFireTVValue", + "key": "CAST", "value": "", "enabled": true }, { - "key": "InputFireTVHash", + "key": "HDMI-1", "value": "", "enabled": true }, { - "key": "CurrentInputHash", + "key": "HDMI-2", + "value": "", + "enabled": true + }, + { + "key": "HDMI-3", + "value": "", + "enabled": true + }, + { + "key": "HDMI-4", + "value": "", + "enabled": true + }, + { + "key": "HDMI-5", + "value": "", + "enabled": true + }, + { + "key": "COMP", + "value": "", + "enabled": true + }, + { + "key": "TV", "value": "", "enabled": true } ], "_postman_variable_scope": "environment", - "_postman_exported_at": "2022-09-03T18:30:31.361Z", + "_postman_exported_at": "2022-09-03T18:58:33.758Z", "_postman_exported_using": "Postman/9.4.1" } \ No newline at end of file diff --git a/Postman/Power.postman_collection.json b/Postman/Power.postman_collection.json new file mode 100644 index 0000000..b34b66c --- /dev/null +++ b/Postman/Power.postman_collection.json @@ -0,0 +1,60 @@ +{ + "info": { + "_postman_id": "726081a9-ba4d-48e6-aab2-a1f7087a77d8", + "name": "Power", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Get Power State", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "\r", + "postman.setEnvironmentVariable(\"CurrentPowerState\", jsonData.ITEMS[0].VALUE);\r", + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + }, + { + "key": "Auth", + "value": "{{AUTH_TOKEN}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{RootURI}}/state/device/power_mode", + "host": [ + "{{RootURI}}" + ], + "path": [ + "state", + "device", + "power_mode" + ] + } + }, + "response": [] + } + ] +} \ No newline at end of file From 3d15d84ecaef87ed81cc2d2138cf329c6deef79e Mon Sep 17 00:00:00 2001 From: Jake Date: Wed, 13 Sep 2023 13:06:16 -0700 Subject: [PATCH 5/5] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..27a798a --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,19 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +trigger: +- master + +pool: + vmImage: ubuntu-latest + +steps: +- script: echo Hello, world! + displayName: 'Run a one-line script' + +- script: | + echo Add other tasks to build, test, and deploy your project. + echo See https://aka.ms/yaml + displayName: 'Run a multi-line script'