Adding Parameter to raspberry pi commands
-
I am trying to turn on/off monitor connected to raspberry pi using one command by passing two different parameter. Could you please help me with the command
-
@js, can you post the commands you're using to turn your monitor on and off?
You can use a script like this to handle the on and off parameters:
#!/bin/bash if [ "$1" = "on" ] ; then echo Turning it on fi if [ "$1" = "off" ] ; then echo Turning it off fi
-
Sorry for the delay. Please find the commands listed below
sudo cat /root/.TRIGGERcmdData/commands.json
[
{"trigger":"Monitor ON","command":"vcgencmd display_power 1","ground":"background","voice":"Monitor ON","allowParams": "false"},
{"trigger":"Monitor OFF","command":"vcgencmd display_power 0","ground":"background","voice":"Monitor OFF","allowParams": "false"}
] -
Ok @js, you could change your commands.json to this:
[ {"trigger":"Monitor","command":"/root/monitor.sh","ground":"background","voice":"Monitor","allowParams": "true"} ]
And put this in your /root/monitor.sh script:
#!/bin/bash if [ "$1" = "on" ] ; then echo Turning it on vcgencmd display_power 1 fi if [ "$1" = "off" ] ; then echo Turning it off vcgencmd display_power 0 fi
And say this to Alexa or Google Assistant:
ask TRIGGERcmd to run monitor with parameter on
Or use the TRIGGERcmd Smart Home Alexa skill or the SmartThings integration with Google Assistant, and say this:
turn on monitor
-
-
This post is deleted!