ztalbot2000 / homebridge-cmd4

CMD4 Plugin for Homebridge - Supports ~All Accessory Types & now all Characteristics too
Apache License 2.0
145 stars 14 forks source link

disable satecmd check on startup[Support] #116

Closed crbyxwpzfl closed 2 years ago

crbyxwpzfl commented 2 years ago

Describe Your Problem: I want to open a ssh session and call a remote python script via the sate_cmd

...
"state_cmd": "ssh user@ip python3 \"/home/pi/spinala/tisch.py\"
...

this results in an error when I start homebridge

 Error: The file: ""/home/pi/spinala/tisch.py"" does not exist, It is highly likely the state_cmd will fail. Hint: Do not use wildcards that would normally be expanded by a shell.
    at Cmd4Accessory.validateStateCmd (/usr/local/lib/node_modules/homebridge-cmd4/Cmd4Accessory.js:1270:22)
    at Cmd4Accessory.parseConfig (/usr/local/lib/node_modules/homebridge-cmd4/Cmd4Accessory.js:1752:15)
    at new Cmd4Accessory (/usr/local/lib/node_modules/homebridge-cmd4/Cmd4Accessory.js:254:12)
    at /usr/local/lib/node_modules/homebridge-cmd4/Cmd4Platform.js:543:25
    at Array.forEach (<anonymous>)
    at Cmd4Platform.discoverDevices (/usr/local/lib/node_modules/homebridge-cmd4/Cmd4Platform.js:406:58)
    at HomebridgeAPI.<anonymous> (/usr/local/lib/node_modules/homebridge-cmd4/Cmd4Platform.js:120:15)
    at HomebridgeAPI.emit (node:events:402:35)
    at HomebridgeAPI.signalFinished (/usr/local/lib/node_modules/homebridge/src/api.ts:275:10)
    at Server.start (/usr/local/lib/node_modules/homebridge/src/server.ts:173:14)

is there a simple way to disable this check? this is just a minor issue and probably very specific. I can work around this if there is no easy way to disable this check. any way I really love your plugin and you already heled me a bunch of times! I am very thankfull for your effort and time!

Environment:

crbyxwpzfl commented 2 years ago

ok I solved it for my specific case by commenting out parts of the validateStateCmd() in Cmd4Accessory.js so it always returns ture.

validateStateCmd( state_cmd )
{
/*
...
*/
return true
}

But I dont feel confident about this becasue I dont know if this causes other issues. anyway feel free to close this.

ztalbot2000 commented 2 years ago

Hi,

I have done just that too. Sorry, I'm trying to get something in at the same time. The fix should be later today. Sorry for the late response.

Ttyl, John

On Sun, Nov 7, 2021 at 10:48 AM f, @.***> wrote:

ok I solved it for my specific case by commenting out parts of the validateStateCmd() in Cmd4Accessory.js so it always returns ture.

validateStateCmd( state_cmd ) {/.../return true }

But I dont feel confident about this becasue I dont know if this causes other issues. anyway feel free to close this.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/116#issuecomment-962634021, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX63EE7ZFKOAPYF7Y2TUK2NTRANCNFSM5HQXBPFQ .

ztalbot2000 commented 2 years ago

Hi,

I just release v6.0.1 that did exactly what you wanted. That code has been there since the beginning and was never a really good thing to do. Sometimes trying to help people with code like the validateStateCmd function has brought me more trouble than it was worth.

Enjoy Cmd4, John Talbot

crbyxwpzfl commented 2 years ago

wow thank you again for your quick help! I appreciate this very much!

ztalbot2000 commented 2 years ago

Hi,

Your quite welcome.

John Talbot

On Sun, Nov 7, 2021 at 4:30 PM f, @.***> wrote:

wow thank you again for your quick help! I appreciate this very much!

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/116#issuecomment-962683903, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX3QSIISXSYJVAMAHNDUK3VYNANCNFSM5HQXBPFQ .