miracle2k / onkyo-eiscp

Control Onkyo A/V receivers over the network; usuable as a script, or as a Python library.
MIT License
467 stars 110 forks source link

How to call this script from a web page. #85

Closed skynetster closed 6 years ago

skynetster commented 6 years ago

Apologies for an absolute noob of a question. I have managed to install the Onkyo library on my raspberry pi and can execute the network commands through a terminal window. What I want to be able to do is to call shell script to execute the commands from a php webpage. This will allows me to control the various onkyo amps from IFTTT or smartthings etc.

I also have a Denon amp that I would want to do the same for?

Sum total of what I trying to achieve is to turn all the amps in my house on, and to a particular input.

ouija commented 6 years ago

Yes this would be possible using PHP's shell_exec command.

Note however that you'll likely need to run the command as root for it to work in this manner, and likely want to nullify and 'disconnect it' from the running process so that the page doesn't wait for the output from the command.

For example: <?php shell_exec('echo rootPassword | /usr/bin/sudo -S /opt/bin/onkyo power=on > /dev/null 2>&1 &'); ?>

miracle2k commented 6 years ago

Closing due to not actionable here.