Reputation: 59
I'm creating a simple web API using NodeJS express, for some home domotics. For my TV I'm using the following library --> https://github.com/hobbyquaker/lgtv2.
When I run my code locally, for example;
var lgtv = require('lgtv2')({
url: 'ws://192.168.178.31:3000'
});
lgtv.on('error', function(err) {
console.log(err);
});
lgtv.on('connect', function() {
console.log('connected');
lgtv.request('ssap://system/turnOff', function(err, res) {
lgtv.disconnect();
});
});
It run's fine. However, the same code, deployed to my Synology NAS, results in an error.
TypeError: Arguments to path.join must be strings
at path.js:360:15
at Array.filter (native)
at exports.join (path.js:358:36)
at module.exports (/volume1/web/NodeJS/node_modules/persist-path/index.js:19:22)
at new LGTV (/volume1/web/NodeJS/node_modules/lgtv2/index.js:47:16)
at LGTV (/volume1/web/NodeJS/node_modules/lgtv2/index.js:38:16)
at Object.module.exports.setNetflix (/volume1/web/NodeJS/controllers/tv.js:50:36)
at /volume1/web/NodeJS/routes/routes.js:43:12
at Layer.handle [as handle_request] (/volume1/web/NodeJS/node_modules/express/lib/router/layer.js:95:5)
at next (/volume1/web/NodeJS/node_modules/express/lib/router/route.js:137:13)
The only actual difference I can spot is the NPM version, which is v10.14.1 locally and v0.10.48 on my NAS. Is there any way to bypass this problem and get this working?
Randy
Upvotes: 0
Views: 559
Reputation: 2099
It is very strange library.
Try this code
console.log('Platform = ',process.platform);
var lgtv = require('lgtv2')({
url: 'ws://192.168.178.31:3000',
clientKey: ''
});
lgtv.on('error', function(err) {
console.log(err);
});
lgtv.on('connect', function() {
console.log('connected');
lgtv.request('ssap://system/turnOff', function(err, res) {
lgtv.disconnect();
});
});
Upvotes: 1