diff --git a/lgtv-broadlink-nvdia-shield-automation/LICENSE b/lgtv-broadlink-nvdia-shield-automation/LICENSE new file mode 100644 index 000000000..eef5b540e --- /dev/null +++ b/lgtv-broadlink-nvdia-shield-automation/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Dwan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lgtv-broadlink-nvdia-shield-automation/README.md b/lgtv-broadlink-nvdia-shield-automation/README.md new file mode 100644 index 000000000..9683e3209 --- /dev/null +++ b/lgtv-broadlink-nvdia-shield-automation/README.md @@ -0,0 +1,3 @@ +# LG TV, Broadlink, and NVIDIA Shield Automation + +Node.js script using various Node.js library to automatically turn on/off several devices based LG TV status diff --git a/lgtv-broadlink-nvdia-shield-automation/code/bedac18.bin b/lgtv-broadlink-nvdia-shield-automation/code/bedac18.bin new file mode 100644 index 000000000..303774d7d Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/bedac18.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/bedac19.bin b/lgtv-broadlink-nvdia-shield-automation/code/bedac19.bin new file mode 100644 index 000000000..f6746a206 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/bedac19.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/bedac20.bin b/lgtv-broadlink-nvdia-shield-automation/code/bedac20.bin new file mode 100644 index 000000000..6956e5041 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/bedac20.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/bedac21.bin b/lgtv-broadlink-nvdia-shield-automation/code/bedac21.bin new file mode 100644 index 000000000..31709193f Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/bedac21.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/bedac22.bin b/lgtv-broadlink-nvdia-shield-automation/code/bedac22.bin new file mode 100644 index 000000000..1cb869429 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/bedac22.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/bedac23.bin b/lgtv-broadlink-nvdia-shield-automation/code/bedac23.bin new file mode 100644 index 000000000..e86901f12 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/bedac23.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/bedac24.bin b/lgtv-broadlink-nvdia-shield-automation/code/bedac24.bin new file mode 100644 index 000000000..c82cf2190 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/bedac24.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/bedac25.bin b/lgtv-broadlink-nvdia-shield-automation/code/bedac25.bin new file mode 100644 index 000000000..f8324da64 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/bedac25.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/bedac26.bin b/lgtv-broadlink-nvdia-shield-automation/code/bedac26.bin new file mode 100644 index 000000000..8d2e336b5 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/bedac26.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/bedac27.bin b/lgtv-broadlink-nvdia-shield-automation/code/bedac27.bin new file mode 100644 index 000000000..231029df9 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/bedac27.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/bedac28.bin b/lgtv-broadlink-nvdia-shield-automation/code/bedac28.bin new file mode 100644 index 000000000..b2ceea672 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/bedac28.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/bedac29.bin b/lgtv-broadlink-nvdia-shield-automation/code/bedac29.bin new file mode 100644 index 000000000..74c6a2a45 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/bedac29.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/bedac30.bin b/lgtv-broadlink-nvdia-shield-automation/code/bedac30.bin new file mode 100644 index 000000000..350daed05 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/bedac30.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/bedaccont.bin b/lgtv-broadlink-nvdia-shield-automation/code/bedaccont.bin new file mode 100644 index 000000000..c3faf150c Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/bedaccont.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/bedacoff.bin b/lgtv-broadlink-nvdia-shield-automation/code/bedacoff.bin new file mode 100644 index 000000000..fd0dd302f Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/bedacoff.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/inputswitch.bin b/lgtv-broadlink-nvdia-shield-automation/code/inputswitch.bin new file mode 100644 index 000000000..060e48b5f Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/inputswitch.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/inputtv.bin b/lgtv-broadlink-nvdia-shield-automation/code/inputtv.bin new file mode 100644 index 000000000..1b1d8b196 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/inputtv.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/inputwiiu.bin b/lgtv-broadlink-nvdia-shield-automation/code/inputwiiu.bin new file mode 100644 index 000000000..059ee41c9 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/inputwiiu.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledblue.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledblue.bin new file mode 100644 index 000000000..7a7a1e9a7 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledblue.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledbrightnestdown.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledbrightnestdown.bin new file mode 100644 index 000000000..5f8dee8af Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledbrightnestdown.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledbrightnestup.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledbrightnestup.bin new file mode 100644 index 000000000..368bd341c Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledbrightnestup.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledcyan.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledcyan.bin new file mode 100644 index 000000000..1001c7b10 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledcyan.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledcyan2.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledcyan2.bin new file mode 100644 index 000000000..9dc663cbd Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledcyan2.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledcyan3.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledcyan3.bin new file mode 100644 index 000000000..04e3fdc4d Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledcyan3.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledcyan4.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledcyan4.bin new file mode 100644 index 000000000..663a877de Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledcyan4.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledgreen.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledgreen.bin new file mode 100644 index 000000000..aa34f6bd0 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledgreen.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledoff.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledoff.bin new file mode 100644 index 000000000..6b9e563ec Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledoff.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledon.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledon.bin new file mode 100644 index 000000000..001900c94 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledon.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledpurple.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledpurple.bin new file mode 100644 index 000000000..59432546f Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledpurple.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledpurple2.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledpurple2.bin new file mode 100644 index 000000000..3e1a96e12 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledpurple2.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledpurple3.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledpurple3.bin new file mode 100644 index 000000000..c0a02f655 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledpurple3.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledpurple4.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledpurple4.bin new file mode 100644 index 000000000..3fd1e1a38 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledpurple4.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledred.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledred.bin new file mode 100644 index 000000000..d330dafbb Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledred.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledwhite.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledwhite.bin new file mode 100644 index 000000000..5a4e76154 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledwhite.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledyellow.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledyellow.bin new file mode 100644 index 000000000..9132a9052 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledyellow.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledyellow2.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledyellow2.bin new file mode 100644 index 000000000..36580a15e Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledyellow2.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledyellow3.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledyellow3.bin new file mode 100644 index 000000000..0bce67af1 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledyellow3.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/ledyellow4.bin b/lgtv-broadlink-nvdia-shield-automation/code/ledyellow4.bin new file mode 100644 index 000000000..b3e9f7b6d Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/ledyellow4.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/mute.bin b/lgtv-broadlink-nvdia-shield-automation/code/mute.bin new file mode 100644 index 000000000..1f4b2a3ec Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/mute.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recieverarrowdown.bin b/lgtv-broadlink-nvdia-shield-automation/code/recieverarrowdown.bin new file mode 100644 index 000000000..6d78d7003 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recieverarrowdown.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recieverarrowleft.bin b/lgtv-broadlink-nvdia-shield-automation/code/recieverarrowleft.bin new file mode 100644 index 000000000..36ad397ba Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recieverarrowleft.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recieverarrowright.bin b/lgtv-broadlink-nvdia-shield-automation/code/recieverarrowright.bin new file mode 100644 index 000000000..73f8f7046 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recieverarrowright.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recieverarrowup.bin b/lgtv-broadlink-nvdia-shield-automation/code/recieverarrowup.bin new file mode 100644 index 000000000..50b594f7a Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recieverarrowup.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recieverback.bin b/lgtv-broadlink-nvdia-shield-automation/code/recieverback.bin new file mode 100644 index 000000000..360feef12 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recieverback.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recieverexit.bin b/lgtv-broadlink-nvdia-shield-automation/code/recieverexit.bin new file mode 100644 index 000000000..f1c4da811 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recieverexit.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recieverfastforward.bin b/lgtv-broadlink-nvdia-shield-automation/code/recieverfastforward.bin new file mode 100644 index 000000000..9436167bb Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recieverfastforward.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recieverinfo.bin b/lgtv-broadlink-nvdia-shield-automation/code/recieverinfo.bin new file mode 100644 index 000000000..591fce790 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recieverinfo.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recieverinputbd.bin b/lgtv-broadlink-nvdia-shield-automation/code/recieverinputbd.bin new file mode 100644 index 000000000..5ca8a51c8 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recieverinputbd.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recieverinputgame.bin b/lgtv-broadlink-nvdia-shield-automation/code/recieverinputgame.bin new file mode 100644 index 000000000..ae2004811 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recieverinputgame.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recieverinputsat.bin b/lgtv-broadlink-nvdia-shield-automation/code/recieverinputsat.bin new file mode 100644 index 000000000..a7054ef0a Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recieverinputsat.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recieverinputtv.bin b/lgtv-broadlink-nvdia-shield-automation/code/recieverinputtv.bin new file mode 100644 index 000000000..39a788292 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recieverinputtv.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recievernexttrack.bin b/lgtv-broadlink-nvdia-shield-automation/code/recievernexttrack.bin new file mode 100644 index 000000000..02796e18e Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recievernexttrack.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recievernprevioustrack.bin b/lgtv-broadlink-nvdia-shield-automation/code/recievernprevioustrack.bin new file mode 100644 index 000000000..a47e56f59 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recievernprevioustrack.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recieveronoff.bin b/lgtv-broadlink-nvdia-shield-automation/code/recieveronoff.bin new file mode 100644 index 000000000..d68d29632 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recieveronoff.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recieverplay.bin b/lgtv-broadlink-nvdia-shield-automation/code/recieverplay.bin new file mode 100644 index 000000000..0f7aa21be Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recieverplay.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recieverrewind.bin b/lgtv-broadlink-nvdia-shield-automation/code/recieverrewind.bin new file mode 100644 index 000000000..c9cb268b2 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recieverrewind.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recieverselect.bin b/lgtv-broadlink-nvdia-shield-automation/code/recieverselect.bin new file mode 100644 index 000000000..e4f56574d Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recieverselect.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recievervoldown.bin b/lgtv-broadlink-nvdia-shield-automation/code/recievervoldown.bin new file mode 100644 index 000000000..93c1ca981 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recievervoldown.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/recievervolup.bin b/lgtv-broadlink-nvdia-shield-automation/code/recievervolup.bin new file mode 100644 index 000000000..53fecbfdd Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/recievervolup.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/soundalc.bin b/lgtv-broadlink-nvdia-shield-automation/code/soundalc.bin new file mode 100644 index 000000000..4c0aab052 Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/soundalc.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/soundauto.bin b/lgtv-broadlink-nvdia-shield-automation/code/soundauto.bin new file mode 100644 index 000000000..e313d32eb Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/soundauto.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/code/soundstereo.bin b/lgtv-broadlink-nvdia-shield-automation/code/soundstereo.bin new file mode 100644 index 000000000..208ae69ce Binary files /dev/null and b/lgtv-broadlink-nvdia-shield-automation/code/soundstereo.bin differ diff --git a/lgtv-broadlink-nvdia-shield-automation/lgbroadlinknvidiaautomation.service b/lgtv-broadlink-nvdia-shield-automation/lgbroadlinknvidiaautomation.service new file mode 100644 index 000000000..df9563b79 --- /dev/null +++ b/lgtv-broadlink-nvdia-shield-automation/lgbroadlinknvidiaautomation.service @@ -0,0 +1,16 @@ +[Unit] +Description=Node.js LG TV, NVIDIA Shiled, and Broadlink connector +After=network-online.target + +[Service] +Type=simple +User=pi +WorkingDirectory=/home/pi/Scripts/lgtv +ExecStart=node lgtv.js +StandardOutput=inherit +StandardError=inherit +Restart=on-failure +RestartSec=10 + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/lgtv-broadlink-nvdia-shield-automation/lgtv.js b/lgtv-broadlink-nvdia-shield-automation/lgtv.js new file mode 100644 index 000000000..79b367ff7 --- /dev/null +++ b/lgtv-broadlink-nvdia-shield-automation/lgtv.js @@ -0,0 +1,501 @@ +'use strict'; + +const timestamp = false; + +let + fs = require('fs'), + path = require('path'), + EventEmitter = require('events'), + request = require('request'), + // LG TV + lgtv = require('lgtv2/index.js')({ + url: 'ws://192.168.1.105:3000' + }), + // NVIDIA Shield + nvidiaShieldAdb = require('nvidia-shield-adb'), + shield = new nvidiaShieldAdb('192.168.1.106'), + // Broadlink MP1 and RM Plus + broadlink = require('broadlinkjs'), + broadlinks = new broadlink(), + // NVIDIA Shield + powerStateWithPing = require('power-state-with-ping'), + nswitch = new powerStateWithPing('192.168.1.110', 10000), + // Costume vars + devices = {} +; + +let app_stereo = [ + "com.google.android.apps.mediashell", + "com.ionitech.airscreen", + "com.waxrain.airplaydmr3", + "com.cloudmosa.puffinTV", + "com.android.chrome", + "com.nickonline.android.nickapp", + "com.nvidia.bbciplayer", + "com.google.android.youtube.tv", + "com.turner.cnvideoapp", + "com.webos.app.livetv", + "com.apple.android.music", + "youtube.leanback.v4" +]; + + +function getDateTime() { + var date = new Date(); + + var hour = date.getHours(); + hour = (hour < 10 ? "0" : "") + hour; + + var min = date.getMinutes(); + min = (min < 10 ? "0" : "") + min; + + var sec = date.getSeconds(); + sec = (sec < 10 ? "0" : "") + sec; + + var year = date.getFullYear(); + + var month = date.getMonth() + 1; + month = (month < 10 ? "0" : "") + month; + + var day = date.getDate(); + day = (day < 10 ? "0" : "") + day; + + if (timestamp) return year + ":" + month + ":" + day + ":" + hour + ":" + min + ":" + sec; + else return ""; +} + + +// Make some object for all devices +devices.emitter = new EventEmitter(); +devices.on = devices.emitter.on; +devices.emit = devices.emitter.emit; +devices.lg = null; +devices.shield = null; +devices.mp1 = null; +devices.rmplus = null; +devices.rmmini3 = null; +devices.nswitch = null; + + +console.log('\n\x1b[4mConnecting...\x1b[0m', "\n"); + + +// Connect to Nintendo Switch +nswitch.debug = false; +nswitch.hdmi = "com.webos.app.hdmi2"; +nswitch.on('ready', function() { + devices.nswitch = this; + + console.log("\x1b[33mNintendo Switch\x1b[0m: \x1b[1mConnected\x1b[0m", getDateTime()); +}); +nswitch.connect(false); + +// Connect to NVIDIA Shield +shield.debug = false; +shield.hdmi = "com.webos.app.hdmi1"; +shield.on('ready', function() { + devices.shield = this; + console.log("\x1b[32mNvidia Shield\x1b[0m: \x1b[1mConnected\x1b[0m", getDateTime()); +}); +shield.connect(false); + +// Connect to Broadlink RM Plus, for Reciever IR blaster +// Connect to Broadlink MP1, for Reciever Power +broadlinks.on("deviceReady", (dev) => { + if (dev.type == "RM3") { + devices.rmmini3 = dev; + + console.log("\x1b[35mBroadlink RM Mini 3 C\x1b[0m: \x1b[1mConnected\x1b[0m", getDateTime()); + } else if (dev.type == "RMPro") { + function bufferFile(relPath) { + return fs.readFileSync(path.join(__dirname, relPath)); + } + + devices.rmplus = dev; + devices.rmplus.sendCode = function() { + var argv = arguments, + i= 0, + loop = setInterval(() => { + dev.sendData(bufferFile("code/" + argv[i++] + ".bin")); + if (i >= argv.length) clearInterval(loop); + }, 500); + } + + console.log("\x1b[35mBroadlink RM Pro+\x1b[0m: \x1b[1mConnected\x1b[0m", getDateTime()); + } else if (dev.type == "MP1") { + devices.mp1 = dev; + console.log("\x1b[33mBroadlink MP1\x1b[0m: \x1b[1mConnected\x1b[0m", getDateTime()); + } +}); +broadlinks.discover(); + +// Connect to LG TV +lgtv.on('connect', () => { + devices.lg = {}; + devices.lg.appId = ""; + devices.lg.emitter = new EventEmitter(); + devices.lg.on = devices.lg.emitter.on; + devices.lg.emit = devices.lg.emitter.emit; + + if(this.force_emit) { + this.force_emit = false; + devices.emit('ready'); + } + + console.log("\x1b[36mLG TV\x1b[0m: \x1b[1mConnected\x1b[0m", getDateTime()); +}); +// Prompt for security code +lgtv.on('prompt', () => { + console.log('\x1b[36mLG TV\x1b[0m: Please authorize on LG TV'); +}); +lgtv.on('close', () => { + this.force_emit = true; + if(this.lg != null) this.lg.appId = ""; + console.log('\x1b[36mLG TV\x1b[0m: Status -> Close', getDateTime()); +}); +lgtv.on('error', (err) => { + this.force_emit = true; + console.log("\x1b[36mLG TV\x1b[0m: TV -> No Response"); +}); + + +// When all devices is on +devices.on('ready', function() { + console.log('\n\x1b[4mAll devices are ready\x1b[0m', "\n"); + lgtv.request('ssap://system.notifications/createToast', {message: "All devices are connected"}); + + lgtv.subscribe('ssap://com.webos.service.tvpower/power/getPowerState', (err, res) => { + if (!res || err || res.errorCode) { + console.log('\x1b[36mLG TV\x1b[0m: TV -> Error while getting power status', err, res); + } else { + let statusState = (res && res.state ? res.state : null); + let statusProcessing = (res && res.processing ? res.processing : null); + let statusPowerOnReason = (res && res.powerOnReason ? res.powerOnReason : null); + let statuses = ""; + + if (statusState) { + statuses += 'State: ' + statusState; + } + if (statusProcessing) { + if(statuses != "") statuses += ", "; + statuses += 'Processing: ' + statusProcessing; + } + if (statusPowerOnReason) { + if(statuses != "") statuses += ", "; + statuses += 'Power on reason: ' + statusPowerOnReason; + } + + console.log('\x1b[36mLG TV\x1b[0m: Status -> ' + statuses); + } + }); + + lgtv.subscribe('ssap://com.webos.applicationManager/getForegroundAppInfo', (err, res) => { + if (res.appId == "") console.log("\x1b[36mLG TV\x1b[0m: TV -> \x1b[2mSleep\x1b[0m"); + else { + if(this.lg.appId == "") console.log(`\x1b[36mLG TV\x1b[0m: TV -> \x1b[1mWake\x1b[0m`); + console.log(`\x1b[36mLG TV\x1b[0m: TV app -> \x1b[4m\x1b[37m${res.appId}\x1b[0m`); + } + this.lg.appId = res.appId; + + if(res.appId == this.shield.hdmi && this.shield.is_sleep) { + // If input is hdmi1 make NVIDIA Shield awake + this.shield.wake(); + } else if(res.appId != this.shield.hdmi && !this.shield.is_sleep) { + // If input is not hdmi1 make NVIDIA Shield sleep + this.shield.sleep(); + } + + // Change sound mode in receiver + if(res.appId != "" && res.appId != this.shield.hdmi) this.current_media_app = res.appId; + + // Switch reciever sound mode accordingly + this.rmplus.emit("changevolume"); + + // If TV state change, trigger RM Plus event, to power on/off reciever + let __timer = 1000; + if (this.lg.appId != "") __timer = 0; + clearTimeout(this.mp1.timer); + this.mp1.timer = setTimeout(() => { + this.mp1.check_power(); + + // Then make sure reciever switch to appropiate input after reciever is on + if (this.lg.appId != "") { + clearTimeout(this.rmplus.timer2); + this.rmplus.timer2 = setTimeout(() => { + // Switch reciever sound mode accordingly + this.rmplus.emit("changevolume"); + + // This just a failsafe if the reciever didn't switch it automatically + if (res.appId == this.nswitch.hdmi) { + // Set reciever to Switch input + // this.rmplus.sendCode("inputswitch"); + } else { + // Set reciever to TV input + this.rmplus.sendCode("inputtv"); + } + }, 1000); + } + }, __timer); + }); + + lgtv.subscribe('ssap://com.webos.service.apiadapter/audio/getSoundOutput', (err, res) => { + if (!res || err || res.errorCode) { + console.log('\x1b[36mLG TV\x1b[0m: Sound Output -> Error while getting current sound output', err, res); + } else { + console.log('\x1b[36mLG TV\x1b[0m: Sound Output -> %s', res.soundOutput); + + if(res.soundOutput != 'external_arc') { + // Force sound output to HDMI-ARC + lgtv.request('ssap://com.webos.service.apiadapter/audio/changeSoundOutput', { + output: 'external_arc' + }, (err, res) => { + if (!res || err || res.errorCode || !res.returnValue) { + console.log('\x1b[36mLG TV\x1b[0m: Sound Output -> Error while changing sound output'); + } + }); + } + } + }); +}); +// When all devices except TV is on +devices.on('mostready', function() { + console.log('\n\x1b[4mMost devices are ready\x1b[0m', "\n"); + + + + // Listening to IR command in RM Mini 3 + + this.rmmini3.on("rawData", (data) => { + console.log("\x1b[35mBroadlink RM Mini 3 C\x1b[0m: \x1b[1mReceived\x1b[0m -> ", data.toString("hex")); + this.rmmini3.enterLearning(); + }); + + this.rmmini3.intervalCheck = setInterval(() =>{ + this.rmmini3.checkData(); + }, 250); + this.rmmini3.intervalLearning = setInterval(() =>{ + this.rmmini3.enterLearning(); + }, 10000); + + this.rmmini3.enterLearning(); + console.log("\x1b[35mBroadlink RM Mini 3 C\x1b[0m: \x1b[1mListening IR Code\x1b[0m", getDateTime()); + + + + // Pioner Reciever IR Command + + this.rmplus.on("changevolume", (data) => { + var dev = this.rmplus; + + clearTimeout(this.rmplus.timer); + this.rmplus.timer = setTimeout(() => { + // Check LG TV and NVIDIA Shield Active app + // Set reciever mode based on the stereo list + if (app_stereo.includes(this.current_media_app)) { + // Set reciever mode to extra-stereo + if(dev.sound_mode != "stereo") { + dev.sound_mode = "stereo"; + dev.sendCode("soundalc", "soundstereo"); // Add longer delay + console.log("\x1b[35mBroadlink\x1b[0m: Sound -> \x1b[4m\x1b[37mStereo Sound\x1b[0m"); + lgtv.request('ssap://system.notifications/createToast', {message: "Sound is Extra Stereo"}); + } + } else if (this.lg.appId != "") { + // Set reciever mode to auto surround sound for other + if(dev.sound_mode != "soundauto") { + dev.sound_mode = "soundauto"; + dev.sendCode("soundalc", "soundauto"); // Add longer delay + console.log("\x1b[35mBroadlink\x1b[0m: Sound -> \x1b[4m\x1b[37mSurround Sound\x1b[0m"); + lgtv.request('ssap://system.notifications/createToast', {message: "Sound is Auto Surround"}); + } + } + }, 1500); + }); + + // Pioner Reciever Power + + this.mp1.on("mp_power", (status_array) => { + // Device id is array index + 1 + if (this.lg.appId != "") { + // TV is on, turn on reciever when reciever is off + if(!status_array[2]) { + this.mp1.set_power(3,1); + console.log("\x1b[33mBroadlink MP\x1b[0m: Broadlink MP1 Switch #3 -> \x1b[1mON\x1b[0m") + } + } else { + // TV is off, turn off reciever when reciever is on + if(status_array[2]) { + this.mp1.set_power(3,0); + console.log("\x1b[33mBroadlink MP\x1b[0m: Broadlink MP1 Switch #3 -> \x1b[2mOFF\x1b[0m") + } + } + }); + + + // NVIDIA Switch + + this.shield.firstrun = true; + this.shield.status((status) => { + this.shield.is_sleep = !status; + if(!this.shield.is_sleep) { + console.log("\x1b[32mNvidia Shield\x1b[0m: Status -> \x1b[1mWake\x1b[0m"); + // maje + if (this.shield.firstrun) { + this.shield.wake(); + this.shield.firstrun = false; + } + } else console.log("\x1b[32mNvidia Shield\x1b[0m: Status -> \x1b[2mSleep\x1b[0m"); + }); + + this.shield.currentappchange_firstrun = true; + this.shield.on('currentappchange', (currentapp) => { + if(this.lg == null) this.lg = { appId: "" }; + + // If shield and tv are sleep while current app change, wake up everything + if (this.lg.appId == "" && !this.shield.currentappchange_firstrun) { + // Wake up shield + if (this.shield.is_sleep) this.shield.wake(); + + // Need to have delay + setTimeout(() => { + // Wake up tv and then the reciever automatically + if(this.lg.appId == "") this.rmplus.sendCode("tvpower"); + + // Set input to HDMI1 + lgtv.request('ssap://system.launcher/launch', {id: this.shield.hdmi}); + }, 1000); + } + this.shield.currentappchange_firstrun = false; + + if(currentapp == "org.xbmc.kodi") { + lgtv.request('ssap://system.notifications/createToast', {message: "Go to sleep 🐒"}); + // Display every 30 minutes + } + + console.log(`\x1b[32mNvidia Shield\x1b[0m: Active App -> \x1b[4m\x1b[37m${currentapp}\x1b[0m`); + }); + + this.shield.on('currentmediaappchange', (currentapp) => { + // If current media app change, trigger RM Plus event, to change sound mode in receiver + this.current_media_app = currentapp; + this.rmplus.emit("changevolume"); + + console.log(`\x1b[32mNvidia Shield\x1b[0m: Active Media App -> \x1b[4m\x1b[37m${this.current_media_app}\x1b[0m`); + }); + + this.shield.on('awake', () => { + this.shield.is_sleep = false; + + if(this.lg == null) this.lg = { appId: "" }; + + if(this.lg.appId == "") { + // Thus can make TV sleep, as appID could be slower to retrieve -> Fix with force emit in TV close and error + // Wake up tv and then the reciever automatically + this.rmplus.sendCode("tvpower"); + } + + // Delayed to make sure everything is on first + setTimeout(() => { + // Set input to HDMI1 + lgtv.request('ssap://system.launcher/launch', {id: this.shield.hdmi}); + + // Set reciever to TV input + this.rmplus.sendCode("inputtv"); + }, 1000); + + console.log("\x1b[32mNvidia Shield\x1b[0m: Status -> \x1b[1mWaking up\x1b[0m"); + // lgtv.request('ssap://system.notifications/createToast', {message: "Switching to NVIDIA Shield"}); + }); + + this.shield.on('sleep', () => { + this.shield.is_sleep = true; + + if(this.lg == null) this.lg = { appId: "" }; + + // If Shield is sleeping while in input HDMI1 then turn off TV + if(this.lg.appId == this.shield.hdmi) { + this.current_media_app = ""; + // Turn off tv and then the reciever automatically + clearTimeout(this.lg.timer); + this.lg.timer = setTimeout(() => { + lgtv.request('ssap://system/turnOff'); + }, 1000); + } + console.log("\x1b[32mNvidia Shield\x1b[0m: Status -> \x1b[2mGoing to Sleep\x1b[0m"); + }); + + this.shield.subscribe(); + + + // Nintendo Switch + + this.nswitch.on('awake', (current_app) => { + // Disabling this as it already handled by the HDMI and Home Automation + // if(this.lg == null) this.lg = { appId: "" }; + + // // Wake up tv and then the reciever automatically + // if(this.lg.appId == "") this.rmplus.sendCode("tvpower"); + + // // Switch to Pioneer input + // lgtv.request('ssap://system.launcher/launch', {id: this.nswitch.hdmi}); + + if(this.lg.appId == this.nswitch.hdmi) { + // Delayed to make sure everything is on first + setTimeout(() => { + // Set reciever to Switch input + this.rmplus.sendCode("inputswitch"); + }, 1000); + } + + console.log("\x1b[33mNintendo Switch\x1b[0m: Status -> \x1b[1mWake\x1b[0m"); + }); + + this.nswitch.on('sleep', (current_app) => { + // if(this.lg == null) this.lg = { appId: "" }; + + // If Switch is sleeping while in input HDMI2 then turn on NVIDIA Shield + if(this.lg.appId == this.nswitch.hdmi) { + this.current_media_app = ""; + this.shield.wake(); + } + + console.log("\x1b[33mNintendo Switch\x1b[0m: Status -> \x1b[2mSleep\x1b[0m"); + }); + + this.nswitch.subscribe(); +}); +// At the beginning loop until all devices are connected +devices.mostready = false; +let devicecheck = setInterval(() => { + if (devices.lg != null && devices.nswitch != null && devices.mp1 != null && devices.rmplus != null && devices.shield != null) { + if(!devices.mostready) devices.emit('mostready'); + devices.emit('ready'); + clearInterval(devicecheck); + } else if (devices.nswitch != null && devices.mp1 != null && devices.mp1 != null && devices.rmplus != null && devices.shield != null) { + this.force_emit = true; + devices.emit('mostready'); + devices.mostready = false; + clearInterval(devicecheck); + } +}, 1000); + + +// openweathermap.org API to get current temperature +let apiKey = '792a714c5972745a0c059538681b9d7c'; +let city = 'tel-aviv'; +let url = `http://api.openweathermap.org/data/2.5/weather?q=${city}&units=metric&appid=${apiKey}`; + +// Every 5 minutes the script will write temperature to temperature.txt +setInterval(() => { + request(url, function (err, response, body) { + var data = "25"; + + if(!err) { + let weather = JSON.parse(body); + data = weather.main.temp; + } + + fs.writeFile( "temperature.txt", data, function(err) { + if(err) return false; + }); + }); +}, 5 * 60 * 1000); \ No newline at end of file diff --git a/lgtv-broadlink-nvdia-shield-automation/mp.js b/lgtv-broadlink-nvdia-shield-automation/mp.js new file mode 100644 index 000000000..a9358cbf3 --- /dev/null +++ b/lgtv-broadlink-nvdia-shield-automation/mp.js @@ -0,0 +1,37 @@ +'use strict'; +let broadlink = require('broadlinkjs-sm'); +let fs = require('fs'); + +var b = new broadlink(); + +b.discover(); + +b.on("deviceReady", (dev) => { + if (dev.type == "MP1") { + var status = []; + + console.clear(); + console.log("Check Power..."); + dev.check_power(); + + dev.on("mp_power", (status_array) => { + status = status_array; + + console.log(""); + console.log("Switch Power -> " + status_array[0]); + console.log("Shield Power -> " + status_array[1]); + console.log("Pioneer Power -> " + status_array[2]); + console.log("Amlogic Power -> " + status_array[3]); + console.log(status_array); + }); + + setTimeout(function() { + // Array index + 1 + dev.set_power(4,0); + console.log(""); + }, 1000); + } else { + console.log(dev.type + "@" + dev.host.address + " found... not MP1!"); + dev.exit(); + } +}); \ No newline at end of file diff --git a/lgtv-broadlink-nvdia-shield-automation/package-lock.json b/lgtv-broadlink-nvdia-shield-automation/package-lock.json new file mode 100644 index 000000000..f0a1c6fc7 --- /dev/null +++ b/lgtv-broadlink-nvdia-shield-automation/package-lock.json @@ -0,0 +1,725 @@ +{ + "name": "lgtv", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@babel/runtime-corejs3": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.10.4.tgz", + "integrity": "sha512-BFlgP2SoLO9HJX9WBwN67gHWMBhDX/eDz64Jajd6mR/UAUzqrNMm99d4qHnVaKscAElZoFiPv+JpR/Siud5lXw==", + "requires": { + "core-js-pure": "^3.0.0", + "regenerator-runtime": "^0.13.4" + } + }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" + }, + "@types/node": { + "version": "7.10.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-7.10.11.tgz", + "integrity": "sha512-uEqP1HlJFhsgD8DOBFdC72/5selvor0mzdQY97zlyo8Q6qPl849cFBWkNpgTXw3jIvb7iNyWsId51/A8HYKzbQ==" + }, + "ajv": { + "version": "6.12.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz", + "integrity": "sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==", + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.0.tgz", + "integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "broadlinkjs": { + "version": "git+https://github.com/dwaan/broadlinkjs.git#99a65c3c6896943d1c29a577c421bc91151a28cf", + "from": "git+https://github.com/dwaan/broadlinkjs.git", + "requires": { + "@types/node": "^7.0.5" + } + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "core-js-pure": { + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.6.5.tgz", + "integrity": "sha512-lacdXOimsiD0QyNf9BC/mxivNJ/ybBGJXQFKzRekp1WTHoVUWsUHEn+2T8GJAzzIhyOuXA+gOxCVN3l+5PLPUA==" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "d": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", + "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", + "requires": { + "es5-ext": "^0.10.50", + "type": "^1.0.1" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-3.2.0.tgz", + "integrity": "sha512-4TgkVUsmmu7oCSyGBm5FvfMoACuoh9EOidm7V5/J2X2djAwwt57qb3F2KMP2ITqODTCSwb+YRV+0Zqrv18k/hw==", + "requires": { + "xregexp": "^4.2.4" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "es5-ext": { + "version": "0.10.53", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.53.tgz", + "integrity": "sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q==", + "requires": { + "es6-iterator": "~2.0.3", + "es6-symbol": "~3.1.3", + "next-tick": "~1.0.0" + } + }, + "es6-iterator": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", + "requires": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, + "es6-symbol": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", + "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", + "requires": { + "d": "^1.0.1", + "ext": "^1.1.2" + } + }, + "ext": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ext/-/ext-1.4.0.tgz", + "integrity": "sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A==", + "requires": { + "type": "^2.0.0" + }, + "dependencies": { + "type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/type/-/type-2.0.0.tgz", + "integrity": "sha512-KBt58xCHry4Cejnc2ISQAF7QY+ORngsWfxezO68+12hKV6lQY8P/psIkcbjeHWn7MqcgciWJyCCevFMJdIXpow==" + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "lgtv2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/lgtv2/-/lgtv2-1.4.1.tgz", + "integrity": "sha1-9Fqs9peGLSvFcvrzSvixRN7CncM=", + "requires": { + "mkdirp": "^0.5.1", + "persist-path": "^1.0.2", + "websocket": "^1.0.24" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "requires": { + "p-locate": "^4.1.0" + } + }, + "mime-db": { + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" + }, + "mime-types": { + "version": "2.1.27", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", + "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", + "requires": { + "mime-db": "1.44.0" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "requires": { + "minimist": "^1.2.5" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" + }, + "next-tick": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", + "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" + }, + "nvidia-shield-adb": { + "version": "git+https://github.com/dwaan/nvidia-shield-adb.git#ceca06f3fd8a52f6ae2c077fd54baa161791f543", + "from": "git+https://github.com/dwaan/nvidia-shield-adb.git" + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "persist-path": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/persist-path/-/persist-path-1.0.2.tgz", + "integrity": "sha1-t7lHU2W1zPA4qvpVrxKw3YxBjXo=" + }, + "power-state-with-ping": { + "version": "git+https://github.com/dwaan/power-state-with-ping.git#893b17fc800a1f034805ed8a1eedfbf062d87f81", + "from": "git+https://github.com/dwaan/power-state-with-ping.git" + }, + "psl": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "regenerator-runtime": { + "version": "0.13.5", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz", + "integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==" + }, + "request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "type": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", + "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==" + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "requires": { + "punycode": "^2.1.0" + } + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "websocket": { + "version": "1.0.31", + "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.31.tgz", + "integrity": "sha512-VAouplvGKPiKFDTeCCO65vYHsyay8DqoBSlzIO3fayrfOgU94lQN5a1uWVnFrMLceTJw/+fQXR5PGbUVRaHshQ==", + "requires": { + "debug": "^2.2.0", + "es5-ext": "^0.10.50", + "nan": "^2.14.0", + "typedarray-to-buffer": "^3.1.5", + "yaeti": "^0.0.6" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "ws": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.3.1.tgz", + "integrity": "sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA==" + }, + "xregexp": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-4.3.0.tgz", + "integrity": "sha512-7jXDIFXh5yJ/orPn4SXjuVrWWoi4Cr8jfV1eHv9CixKSbU+jY4mxfrBwAuDvupPNKpMUY+FeIqsVw/JLT9+B8g==", + "requires": { + "@babel/runtime-corejs3": "^7.8.3" + } + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" + }, + "yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" + }, + "yargs": { + "version": "15.4.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.0.tgz", + "integrity": "sha512-D3fRFnZwLWp8jVAAhPZBsmeIHY8tTsb8ItV9KaAaopmC6wde2u6Yw29JBIZHXw14kgkRnYmDgmQU4FVMDlIsWw==", + "requires": { + "cliui": "^6.0.0", + "decamelize": "^3.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + } + }, + "yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "dependencies": { + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + } + } + } + } +} diff --git a/lgtv-broadlink-nvdia-shield-automation/package.json b/lgtv-broadlink-nvdia-shield-automation/package.json new file mode 100644 index 000000000..b02b15728 --- /dev/null +++ b/lgtv-broadlink-nvdia-shield-automation/package.json @@ -0,0 +1,20 @@ +{ + "name": "lgtv", + "version": "1.0.0", + "description": "", + "main": "test.js", + "dependencies": { + "broadlinkjs": "git+https://github.com/dwaan/broadlinkjs.git", + "lgtv2": "^1.4.1", + "nvidia-shield-adb": "git+https://github.com/dwaan/nvidia-shield-adb.git", + "power-state-with-ping": "git+https://github.com/dwaan/power-state-with-ping.git", + "request": "^2.88.2", + "ws": "^7.3.0", + "yargs": "^15.3.1" + }, + "scripts": { + "test": "start.sh" + }, + "author": "", + "license": "ISC" +} diff --git a/lgtv-broadlink-nvdia-shield-automation/rmpro.js b/lgtv-broadlink-nvdia-shield-automation/rmpro.js new file mode 100644 index 000000000..eb749c792 --- /dev/null +++ b/lgtv-broadlink-nvdia-shield-automation/rmpro.js @@ -0,0 +1,120 @@ +/* + usage: + + When you want to learn a code, it might took several times before the correct code saved + node rmpro.js learn input-name + + When you want to send the code + node rmpro.js send input-name + + When you want to read the code + node rmpro.js read input-name +*/ + +'use strict'; +let broadlink = require('broadlinkjs'); +let fs = require('fs'); +let path = require('path'); + +var b = new broadlink(); + +if (process.argv.length < 3) { + var _files = '', + i = 0; + + console.log("Usage:\n", "\tnode rmpro send (command)", "\n"); + console.log("Available command:") + fs.readdir("code/", (err, files) => { + files.forEach(file => { + if (i > 0) _files += ", "; + _files += file.replace(".bin", ""); + i++; + }); + + console.log(_files); + }) +} else { + var learn = process.argv[2]; + var file = process.argv[3]; + var _file = process.argv[4]; + + if (learn == "read" || learn == "r") { + // Buffer mydata + function bufferFile(relPath) { + return fs.readFileSync(path.join(__dirname, relPath)); // zzzz.... + } + + var data = bufferFile("code/" + file + ".bin"); + data = new Buffer.from(data, 'ascii').toString('hex'); + + console.log("Code -> " + data); + + process.exit(); + } else if (learn == "convert" || learn == "c") { + var data = Buffer.from(file, 'base64'); + + console.log(data); + + fs.writeFile("code/" + _file + ".bin", data, function(err) { + if(err) { + return console.log(err); + } + + console.log("The file was saved!"); + + process.exit(); + }); + } else { + b.on("deviceReady", (dev) => { + if(dev.type == "RMPro") { + // Buffer mydata + function bufferFile(relPath) { + return fs.readFileSync(path.join(__dirname, relPath)); // zzzz.... + } + + console.log("Connected -> " + dev.host.address) + if (learn == "learn" || learn == "l") { + console.log("Waiting for input ->", file); + var timer = setInterval(function(){ + dev.checkData(); + }, 500); + + dev.on("rawData", (data) => { + fs.writeFile("code/" + file + ".bin", data, function(err) { + if(err) { + return console.log(err); + } + + console.log("The file was saved!"); + + data = new Buffer.from(data, 'ascii').toString('hex'); + + console.log("Code -> " + data); + + process.exit(); + }); + }); + + dev.enterLearning(); + } else if (learn == "sendcode" || learn == "sc") { + console.log("Sending data ->", file); + + data = new Buffer.from(file, 'ascii'); + dev.sendData(data); + + process.exit(); + } else { + console.log("Sending data ->", file); + dev.sendData(bufferFile("code/" + file + ".bin")); + + var timer = setInterval(function(){ + clearInterval(timer); + process.exit(); + }, 500); + } + } + }); + } + + b.discover(); +} \ No newline at end of file diff --git a/lgtv-broadlink-nvdia-shield-automation/sendCode.py b/lgtv-broadlink-nvdia-shield-automation/sendCode.py new file mode 100644 index 000000000..7b90271be --- /dev/null +++ b/lgtv-broadlink-nvdia-shield-automation/sendCode.py @@ -0,0 +1,15 @@ +import broadlink +import time +import sys + +def sendCode(codeData): + device = broadlink.rm(host=("192.168.1.103",80), mac=bytearray.fromhex("780f7763c5a1"), devtype="rm") + + print "Connecting to Broadlink device...." + device.auth() + device.host + + # Replace with your code + device.send_data(codeData.decode('hex')) +if __name__ == '__main__': + sendCode(sys.argv[1]) \ No newline at end of file diff --git a/lgtv-broadlink-nvdia-shield-automation/sendCode.sh b/lgtv-broadlink-nvdia-shield-automation/sendCode.sh new file mode 100644 index 000000000..ef5f9e98d --- /dev/null +++ b/lgtv-broadlink-nvdia-shield-automation/sendCode.sh @@ -0,0 +1,24 @@ +SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" + +if [ ! -d ~/.homebridgestates ] +then + mkdir ~/.homebridgestates +fi + +if [ $1 = "on" ] +then + python "$SCRIPT_DIR/sendCode.py" $3 + echo $2 "is on" + echo "This is flag switch on for" $2 > ~/.homebridgestates/${2}.flag +elif [ $1 = "off" ] +then + python "$SCRIPT_DIR/sendCode.py" $3 + echo $2 "is off" + rm ~/.homebridgestates/${2}.flag +else + if [ -f ~/.homebridgestates/${2}.flag ]; then + echo "true" + else + echo "false" + fi +fi diff --git a/lgtv-broadlink-nvdia-shield-automation/shield.sh b/lgtv-broadlink-nvdia-shield-automation/shield.sh new file mode 100644 index 000000000..9ad7d7b76 --- /dev/null +++ b/lgtv-broadlink-nvdia-shield-automation/shield.sh @@ -0,0 +1,21 @@ +adb connect 192.168.1.106 > /dev/null + +if [ ! -d ~/.homebridgestates ] +then + mkdir ~/.homebridgestates +fi + +if [ $1 = "keyevent" ] +then + adb shell input keyevent $2 +elif [ $1 = "wake" ] +then + adb shell input keyevent KEYCODE_WAKEUP +elif [ $1 = "sleep" ] +then + adb shell input keyevent KEYCODE_SLEEP +elif [ $1 = "sleepstatus" ] +then + status=$(adb shell "dumpsys power | grep mHoldingDisplay | cut -d = -f 2"); + echo $status +fi \ No newline at end of file diff --git a/lgtv-broadlink-nvdia-shield-automation/temperature.js b/lgtv-broadlink-nvdia-shield-automation/temperature.js new file mode 100644 index 000000000..e88048c23 --- /dev/null +++ b/lgtv-broadlink-nvdia-shield-automation/temperature.js @@ -0,0 +1,15 @@ +const request = require('request'); +const argv = require('yargs').argv; + +let apiKey = '792a714c5972745a0c059538681b9d7c'; +let city = argv.c || 'tel-aviv'; +let url = `http://api.openweathermap.org/data/2.5/weather?q=${city}&units=metric&appid=${apiKey}` + +request(url, function (err, response, body) { + if(err){ + console.log("25"); + } else { + let weather = JSON.parse(body); + console.log(weather.main.temp); + } +}); \ No newline at end of file diff --git a/lgtv-broadlink-nvdia-shield-automation/temperature.txt b/lgtv-broadlink-nvdia-shield-automation/temperature.txt new file mode 100644 index 000000000..32d8e25ce --- /dev/null +++ b/lgtv-broadlink-nvdia-shield-automation/temperature.txt @@ -0,0 +1 @@ +29.96 \ No newline at end of file diff --git a/lgtv-broadlink-nvdia-shield-automation/webos/LICENSE-2.0.txt b/lgtv-broadlink-nvdia-shield-automation/webos/LICENSE-2.0.txt new file mode 100644 index 000000000..e06d20818 --- /dev/null +++ b/lgtv-broadlink-nvdia-shield-automation/webos/LICENSE-2.0.txt @@ -0,0 +1,202 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/lgtv-broadlink-nvdia-shield-automation/webos/webOSTV-dev.js b/lgtv-broadlink-nvdia-shield-automation/webos/webOSTV-dev.js new file mode 100644 index 000000000..ce99f4764 --- /dev/null +++ b/lgtv-broadlink-nvdia-shield-automation/webos/webOSTV-dev.js @@ -0,0 +1 @@ +window.webOSDev=function(e){var r={};function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var i in e)t.d(n,i,function(r){return e[r]}.bind(null,i));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=0)}([function(e,r,t){"use strict";function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var r=1;r0&&void 0!==arguments[0]?arguments[0]:function(){},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(!this.cancelled){var i={};try{i=JSON.parse(n)}catch(e){i={errorCode:-1,errorText:n,returnValue:!1}}var o=i,u=o.errorCode,c=o.returnValue;u||!1===c?(i.returnValue=!1,r(i)):(i.returnValue=!0,e(i)),t(i),this.subscribe||this.cancel()}}},{key:"cancel",value:function(){this.cancelled=!0,null!==this.bridge&&(this.bridge.cancel(),this.bridge=null),this.ts&&c[this.ts]&&delete c[this.ts]}}])&&u(r.prototype,t),n&&u(r,n),e}(),s={BROWSER:"APP_BROWSER"},l=function(e){var r=e.id,t=void 0===r?"":r,n=e.params,i=void 0===n?{}:n,o=e.onSuccess,u=void 0===o?function(){}:o,c=e.onFailure,l=void 0===c?function(){}:c,d={id:t,params:i};s.BROWSER===t&&(d.params.target=i.target||"",d.params.fullMode=!0,d.id="com.webos.app.browser"),function(e){var r=e.parameters,t=e.onSuccess,n=e.onFailure;(new a).send({service:"luna://com.webos.applicationManager",method:"launch",parameters:r,onComplete:function(e){var r=e.returnValue,i=e.errorCode,o=e.errorText;return!0===r?t():n({errorCode:i,errorText:o})}})}({parameters:d,onSuccess:u,onFailure:l})},d=function(){var e={};if(window.PalmSystem&&""!==window.PalmSystem.launchParams)try{e=JSON.parse(window.PalmSystem.launchParams)}catch(e){console.error("JSON parsing error")}return e},f=function(){return window.PalmSystem&&window.PalmSystem.identifier?window.PalmSystem.identifier.split(" ")[0]:""};function v(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function p(e){for(var r=1;r0&&void 0!==arguments[0]?arguments[0]:function(){},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};setTimeout((function(){return e(r)}),0)},j=function(e){return e.state===w&&""!==e.getClientId()},D=function(e,r){var t=r.errorCode,n=void 0===t?h.UNKNOWN_ERROR:t,i=r.errorText,o={errorCode:n,errorText:void 0===i?"Unknown error.":i};return e.setError(o),o},E={errorCode:h.CLIENT_NOT_LOADED,errorText:"DRM client is not loaded."},I=function(){function e(r){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),this.clientId="",this.drmType=r,this.errorCode=h.NOT_ERROR,this.errorText="",this.state=O}var r,t,n;return r=e,(t=[{key:"getClientId",value:function(){return this.clientId}},{key:"getDrmType",value:function(){return this.drmType}},{key:"getErrorCode",value:function(){return this.errorCode}},{key:"getErrorText",value:function(){return this.errorText}},{key:"setError",value:function(e){var r=e.errorCode,t=e.errorText;this.errorCode=r,this.errorText=t}},{key:"isLoaded",value:function(e){var r=this,t=e.onSuccess,n=void 0===t?function(){}:t,i=e.onFailure,o=void 0===i?function(){}:i;S({method:"isLoaded",parameters:{appId:f()},onComplete:function(e){if(!0===e.returnValue){if(r.clientId=e.clientId||"",r.state=e.loadStatus?w:O,!0===e.loadStatus&&e.drmType!==r.drmType)return o(D(r,{errorCode:h.UNKNOWN_ERROR,errorText:"DRM types of set and loaded are not matched."}));var t=p({},e);return delete t.returnValue,n(t)}return o(D(r,e))}})}},{key:"load",value:function(e){var r=this,t=e.onSuccess,n=void 0===t?function(){}:t,i=e.onFailure,o=void 0===i?function(){}:i;if(this.state!==g&&this.state!==w){var u={appId:f(),drmType:this.drmType};this.state=g,S({method:"load",onComplete:function(e){return!0===e.returnValue?(r.clientId=e.clientId,r.state=w,n({clientId:r.clientId})):o(D(r,e))},parameters:u})}else T(n,{isLoaded:!0,clientId:this.clientId})}},{key:"unload",value:function(e){var r=this,t=e.onSuccess,n=void 0===t?function(){}:t,i=e.onFailure,o=void 0===i?function(){}:i;if(j(this)){var u={clientId:this.clientId};this.state=P,S({method:"unload",onComplete:function(e){return!0===e.returnValue?(r.clientId="",r.state=O,n()):o(D(r,e))},parameters:u})}else T(o,D(this,E))}},{key:"getRightsError",value:function(e){var r=this,t=e.onSuccess,n=void 0===t?function(){}:t,i=e.onFailure,o=void 0===i?function(){}:i;j(this)?S({method:"getRightsError",parameters:{clientId:this.clientId,subscribe:!0},onComplete:function(e){if(!0===e.returnValue){var t=p({},e);return delete t.returnValue,n(t)}return o(D(r,e))}}):T(o,D(this,E))}},{key:"sendDrmMessage",value:function(e){var r=this,t=e.msg,n=void 0===t?"":t,i=e.onSuccess,o=void 0===i?function(){}:i,u=e.onFailure,c=void 0===u?function(){}:u;if(j(this)){var a=function(e){var r="",t="";switch(e){case y.PLAYREADY:r="application/vnd.ms-playready.initiator+xml",t="urn:dvb:casystemid:19219";break;case y.WIDEVINE:r="application/widevine+xml",t="urn:dvb:casystemid:19156"}return{msgType:r,drmSystemId:t}}(this.drmType),s=p({clientId:this.clientId,msg:n},a);S({method:"sendDrmMessage",onComplete:function(e){if(!0===e.returnValue){var t=p({},e);return delete t.returnValue,o(t)}return c(D(r,e))},parameters:s})}else T(c,D(this,E))}}])&&m(r.prototype,t),n&&m(r,n),e}(),R={Error:h,Type:y},C=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return""===e?null:new I(e)};function N(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var x=function(e){var r=e.service,t=e.subscribe,n=e.onSuccess,i=e.onFailure;(new a).send({service:r,method:"getStatus",parameters:{subscribe:t},onComplete:function(e){var r=function(e){for(var r=1;r-1&&(c="palm"),x({service:"luna://com.".concat(c,".connectionmanager"),subscribe:u,onSuccess:t,onFailure:i})}},k=function(e){var r=e.onSuccess,t=void 0===r?function(){}:r,n=e.onFailure,i=void 0===n?function(){}:n;-1!==navigator.userAgent.indexOf("Chrome")?(new a).send({service:"luna://com.webos.service.sm",method:"deviceid/getIDs",parameters:{idType:["LGUDID"]},onComplete:function(e){if(!0!==e.returnValue)i({errorCode:e.errorCode,errorText:e.errorText});else{var r=e.idList.filter((function(e){return"LGUDID"===e.idType}))[0].idValue;t({id:r})}}}):setTimeout((function(){return i({errorCode:"ERROR.000",errorText:"Not supported."})}),0)}}]); \ No newline at end of file diff --git a/lgtv-broadlink-nvdia-shield-automation/webos/webOSTV.js b/lgtv-broadlink-nvdia-shield-automation/webos/webOSTV.js new file mode 100644 index 000000000..801481d8b --- /dev/null +++ b/lgtv-broadlink-nvdia-shield-automation/webos/webOSTV.js @@ -0,0 +1 @@ +window.webOS=function(e){var n={};function r(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=n,r.d=function(e,n,t){r.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:t})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,n){if(1&n&&(e=r(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(r.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)r.d(t,o,function(n){return e[n]}.bind(null,o));return t},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r.p="",r(r.s=0)}([function(e,n,r){"use strict";r.r(n),r.d(n,"deviceInfo",(function(){return j})),r.d(n,"fetchAppId",(function(){return t})),r.d(n,"fetchAppInfo",(function(){return i})),r.d(n,"fetchAppRootPath",(function(){return s})),r.d(n,"keyboard",(function(){return P})),r.d(n,"libVersion",(function(){return x})),r.d(n,"platformBack",(function(){return a})),r.d(n,"platform",(function(){return V})),r.d(n,"service",(function(){return w})),r.d(n,"systemInfo",(function(){return k}));var t=function(){return window.PalmSystem&&window.PalmSystem.identifier?window.PalmSystem.identifier.split(" ")[0]:""},o={},i=function(e,n){if(0===Object.keys(o).length){var r=function(n,r){if(!n&&r)try{o=JSON.parse(r),e&&e(o)}catch(n){console.error("Unable to parse appinfo.json file for",t()),e&&e()}else e&&e()},i=new window.XMLHttpRequest;i.onreadystatechange=function(){4===i.readyState&&(i.status>=200&&i.status<300||0===i.status?r(null,i.responseText):r({status:404}))};try{i.open("GET",n||"appinfo.json",!0),i.send(null)}catch(e){r({status:404})}}else e&&e(o)},s=function(){var e=window.location.href;if("baseURI"in window.document)e=window.document.baseURI;else{var n=window.document.getElementsByTagName("base");n.length>0&&(e=n[0].href)}var r=e.match(new RegExp(".*://[^#]*/"));return r?r[0]:""},a=function(){if(window.PalmSystem&&window.PalmSystem.platformBack)return window.PalmSystem.platformBack()};function c(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function u(e){for(var n=1;n0&&void 0!==arguments[0]?arguments[0]:function(){},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(!this.cancelled){var o={};try{o=JSON.parse(t)}catch(e){o={errorCode:-1,errorText:t,returnValue:!1}}var i=o,s=i.errorCode,a=i.returnValue;s||!1===a?(o.returnValue=!1,n(o)):(o.returnValue=!0,e(o)),r(o),this.subscribe||this.cancel()}}},{key:"cancel",value:function(){this.cancelled=!0,null!==this.bridge&&(this.bridge.cancel(),this.bridge=null),this.ts&&d[this.ts]&&delete d[this.ts]}}])&&f(n.prototype,r),t&&f(n,t),e}(),w={request:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=u({service:e},n);return(new m).send(r)}};function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var p={};if("object"===("undefined"==typeof window?"undefined":v(window))&&window.PalmSystem){if(window.navigator.userAgent.indexOf("SmartWatch")>-1)p.watch=!0;else if(window.navigator.userAgent.indexOf("SmartTV")>-1||window.navigator.userAgent.indexOf("Large Screen")>-1)p.tv=!0;else{try{var y=JSON.parse(window.PalmSystem.deviceInfo||"{}");if(y.platformVersionMajor&&y.platformVersionMinor){var h=Number(y.platformVersionMajor),g=Number(y.platformVersionMinor);h<3||3===h&&g<=0?p.legacy=!0:p.open=!0}}catch(e){p.open=!0}window.Mojo=window.Mojo||{relaunch:function(){}},window.PalmSystem.stageReady&&window.PalmSystem.stageReady()}if(window.navigator.userAgent.indexOf("Chr0me")>-1||window.navigator.userAgent.indexOf("Chrome")>-1){var b=window.navigator.userAgent.indexOf("Chr0me")>-1?window.navigator.userAgent.indexOf("Chr0me"):window.navigator.userAgent.indexOf("Chrome"),S=window.navigator.userAgent.slice(b).indexOf(" ");window.navigator.userAgent.slice(b+7,b+S).split(".")[0]>=68?p.jcl=!0:p.jcl=!1}else p.jcl=!1}else p.unknown=!0;var V=p,O={},j=function(e){if(0===Object.keys(O).length){try{var n=JSON.parse(window.PalmSystem.deviceInfo);O.modelName=n.modelName,O.version=n.platformVersion,O.versionMajor=n.platformVersionMajor,O.versionMinor=n.platformVersionMinor,O.versionDot=n.platformVersionDot,O.sdkVersion=n.platformVersion,O.screenWidth=n.screenWidth,O.screenHeight=n.screenHeight}catch(e){O.modelName="webOS Device"}O.screenHeight=O.screenHeight||window.screen.height,O.screenWidth=O.screenWidth||window.screen.width,V.tv&&(V.jcl?(new m).send({service:"luna://com.webos.service.config",method:"getConfigs",parameters:{configNames:["tv.nyx.firmwareVersion","tv.nyx.platformVersion","tv.hw.panelResolution","tv.model.modelname"]},onSuccess:function(n){if(O.modelName=n.configs["tv.model.modelname"]||O.modelName,O.sdkVersion=n.configs["tv.nyx.platformVersion"]||O.sdkVersion,O.uhd="UD"===n.configs["tv.hw.panelResolution"]||"8K"===n.configs["tv.hw.panelResolution"],O.uhd8K="8K"===n.configs["tv.hw.panelResolution"],n.configs["tv.nyx.firmwareVersion"]&&"0.0.0"!==n.configs["tv.nyx.firmwareVersion"]||(n.configs["tv.nyx.firmwareVersion"]=n.configs["tv.nyx.platformVersion"]),n.configs["tv.nyx.firmwareVersion"]){O.version=n.configs["tv.nyx.firmwareVersion"];for(var r=O.version.split("."),t=["versionMajor","versionMinor","versionDot"],o=0;o=5&&(new m).send({service:"luna://com.webos.service.config",method:"getConfigs",parameters:{configNames:["tv.model.supportTemp8K"]},onSuccess:function(n){n.configs&&(O.uhd8K=!0===n.configs["tv.model.supportTemp8K"]),e(O)},onFailure:function(){e(O)}})}e(O)},onFailure:function(){e(O)}}))}else e(O)},P={isShowing:function(){return PalmSystem&&PalmSystem.isKeyboardVisible||!1}},k=function(){var e={};if(window.PalmSystem){if(window.PalmSystem.country){var n=JSON.parse(window.PalmSystem.country);e.country=n.country,e.smartServiceCountry=n.smartServiceCountry}window.PalmSystem.timeZone&&(e.timezone=window.PalmSystem.timeZone)}return e},x="1.2.1"}]); \ No newline at end of file