Skip to content

Commit 7764b44

Browse files
committed
fix: fix handling of TV connection
1 parent 2da50c3 commit 7764b44

File tree

8 files changed

+183
-72
lines changed

8 files changed

+183
-72
lines changed

.devcontainer/Dockerfile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
FROM node:23
22

33
# Install additional dependencies if needed
4-
RUN apt-get update && apt-get install -y sudo vim git gnupg2 curl jq
4+
RUN apt-get update && apt-get install -y sudo vim git gnupg2 curl jq tcpdump
5+
RUN apt-get update && apt-get install -y sudo && \
6+
echo "node ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/node && \
7+
chmod 0440 /etc/sudoers.d/node
58
RUN npm install -g pkg
69

7-
# Set the working directory
8-
WORKDIR /lgtv-alexa-skill
10+
# Expose the ports
11+
EXPOSE 11000-11003
12+
EXPOSE 11101
13+
# Add WoL UDP port
14+
EXPOSE 9/udp
15+
EXPOSE 1900/udp
916

1017
# Copy the project files into the container
1118
COPY . /lgtv-alexa-skill
1219

20+
# Set the working directory
21+
WORKDIR /lgtv-alexa-skill
22+
1323
# Install project dependencies
1424
RUN npm install

.devcontainer/devcontainer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
}
1515
},
1616
"workspaceFolder": "/workspaces/lgtv-alexa-skill",
17-
"postCreateCommand": "npm install",
1817
"postAttachCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
18+
"runArgs": [
19+
"--network=host"
20+
],
1921
"remoteUser": "node"
20-
}
22+
}

app.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ function executeCommand(command, arg) {
5454
var setMute = (arg == 'true');
5555
mylgtv.execute(API.MUTE_TV, 'subscribe', {"mute" : setMute});
5656
break;
57+
case 'version':
58+
console.log('\nBridge for LG Smart TVs version: ' + PACKAGE.version + '\n');
59+
break;
5760
default:
5861
return;
5962
}
@@ -67,6 +70,7 @@ function checkArgs(command, arg) {
6770
case 'status':
6871
case 'tvoff':
6972
case 'tvon':
73+
case 'version':
7074
if(typeof arg == 'undefined')
7175
return true;
7276
break;
@@ -98,6 +102,7 @@ function showInstructions() {
98102
console.log('\t* tvoff - Turns off your TV');
99103
console.log('\t* tvon - Turns on your TV\n');
100104
console.log('\t* mute true|false - Mute/unmute your TV');
105+
console.log('\t* version - Displays the version of this bridge\n');
101106
}
102107

103108
__init(process.argv[2], process.argv[3]);

build_app.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fi
1919
# Check if target parameter is provided
2020
if [ -z "$1" ]
2121
then
22-
echo "No target provided. Usage: ./build_app.sh <target> (e.g. node18-linux-arm64)"
22+
echo "No target provided. Usage: ./build_app.sh <target> (e.g. node14-linux-arm64)"
2323
exit 1
2424
fi
2525

package-lock.json

Lines changed: 34 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lgtv-alexa-skill",
3-
"version": "1.1.0",
3+
"version": "1.1.5",
44
"description": "JS only bridge between LG TV and Amazon alexa",
55
"main": "index.js",
66
"scripts": {
@@ -26,7 +26,7 @@
2626
},
2727
"homepage": "https://github.com/lucone83/lgtv-alexa-skill#readme",
2828
"dependencies": {
29-
"lgtv2": "^1.4.1",
29+
"lgtv2": "^1.6.3",
3030
"node-fauxmo": "0.0.7",
3131
"node-wol": "^0.1.1",
3232
"npm-check-updates": "^17.1.14",

0 commit comments

Comments
 (0)