@paul53 said in node-ssh für Javascript Adapter:
/opt/iobroker/node_modules/iobroker.javascript/node_modules
Hi Paul,
hier wird der adapter angezeigt:
pi@Raspi4B-ioBroker:/opt/iobroker/node_modules/iobroker.javascript/node_modules $ ls
@iobroker node-ssh qs request semver tough-cookie @types
leider funktioniert mein script trotzdem nicht.
javascript.0 2021-01-06 19:34:12.465 error (7367) at Immediate.setImmediate (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:5384:37)
javascript.0 2021-01-06 19:34:12.465 error (7367) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:472:25)
javascript.0 2021-01-06 19:34:12.464 error (7367) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1055:38)
javascript.0 2021-01-06 19:34:12.464 error (7367) at Object.on (script.js.common.Ambilight_Shutdown:10:15)
javascript.0 2021-01-06 19:34:12.463 error (7367) Error in callback: TypeError: node_ssh is not a constructor
Vielleicht liegt es ja gar nciht am node-ssh. Ist mein Script falsch?
node_ssh = require('node-ssh');
on({id:'0_userdata.0.Ambilight', change: 'ne'}, (dp) => {
if(dp.state.val == false) {
let ssh = new node_ssh();
ssh.connect({ host: '192.168.178.149',
username: 'pi',
password: '*******'}).then(()=> {
ssh.execCommand("sudo shutdown -h 1");
})
}
});
gruß
Thomas