garytee / homebridge-remote-ssh

1 stars 2 forks source link

Non-Zero exit code Error #5

Closed helo-head closed 1 year ago

helo-head commented 1 year ago

Unfortunately this plugin does not seem to work for me (Linux Buster 5.10.103-v7+ / Nodejs v16.17.0 / Homebridge v1.6.0)

I really did hope this would solve my problem as the original homebridge-ssh gave up the ghost today after I updated my ATV's to 16.3.2. Granted the original version always caused me issues with slow response but at least in the past it worked.

My config file consists of three calls which return either 0 or 1

"on": "/mnt/homebridge/protect-up.sh",
"off": "/mnt/homebridge/protect-down.sh",
"state": "/mnt/homebridge/protect-status.sh",
"on_value": "1",
"exact_match": true

The protect-status.sh consists of the following: "ip link show eth10.104 | grep -o 'state UP' -c"

Here are my results -

[19/02/2023, 16:22:31] [Protect Cameras] State of Protect Cameras is 0 [19/02/2023, 16:22:31] [Protect Cameras] Error: Error: Non-zero exit code: 1 [19/02/2023, 16:22:31] Error: This callback function has already been called by someone else; it can only be called one time. at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/once.ts:12:13 at Duplexify. (/usr/local/lib/node_modules/homebridge-remote-ssh/src/accessory.ts:97:7) at Duplexify.emit (node:events:513:28) at Channel. (/usr/local/lib/node_modules/homebridge-remote-ssh/node_modules/remote-ssh-exec/index.js:84:18) at Channel.emit (node:events:513:28) at SSH2Stream. (/usr/local/lib/node_modules/homebridge-remote-ssh/node_modules/ssh2/lib/Channel.js:210:14) at SSH2Stream.emit (node:events:513:28) at parse_CHANNEL_REQUEST (/usr/local/lib/node_modules/homebridge-remote-ssh/node_modules/ssh2-streams/lib/ssh.js:4467:8) at parsePacket (/usr/local/lib/node_modules/homebridge-remote-ssh/node_modules/ssh2-streams/lib/ssh.js:3768:12) at SSH2Stream._transform (/usr/local/lib/node_modules/homebridge-remote-ssh/node_modules/ssh2-streams/lib/ssh.js:701:13) at SSH2Stream.Transform._write (node:internal/streams/transform:205:23) at writeOrBuffer (node:internal/streams/writable:391:12) at _write (node:internal/streams/writable:332:10) at SSH2Stream.Writable.write (node:internal/streams/writable:336:10) at Socket.ondata (node:internal/streams/readable:754:22) at Socket.emit (node:events:513:28)

garytee commented 1 year ago

I haven't updated to 16.3.2 so I'll update tonight and see if that is causing this issue. Have you tried running a simple script to test this?

testOn.sh

#!/bin/bash

echo "echo on" &>testStatus.sh

testOff.sh

#!/bin/bash

echo "echo off" &>testStatus.sh

testStatus.sh

echo on
helo-head commented 1 year ago

Based on your example I rewrote the status script as:

status="$(ip link show eth10.104 | grep -o 'state UP' -c)" echo $status

This appears to have solved the issue. Rule #25, never argue with success :)

Many thanks ...