Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable satecmd check on startup[Support] #116

Closed
crbyxwpzfl opened this issue Nov 7, 2021 · 5 comments
Closed

disable satecmd check on startup[Support] #116

crbyxwpzfl opened this issue Nov 7, 2021 · 5 comments
Assignees

Comments

@crbyxwpzfl
Copy link

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:

  • Node.js Version: v16.13.0
  • NPM Version: 8.1.0
  • Homebridge Version: 1.3.5
  • Operating System: macOS
  • Process Supervisor: hb-service
@crbyxwpzfl
Copy link
Author

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.

@crbyxwpzfl crbyxwpzfl changed the title disable path checking for state cmd on startup[Support] disable satecmd check on startup[Support] Nov 7, 2021
@ztalbot2000
Copy link
Owner

ztalbot2000 commented Nov 7, 2021 via email

@ztalbot2000
Copy link
Owner

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
Copy link
Author

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

@ztalbot2000
Copy link
Owner

ztalbot2000 commented Nov 7, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants