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 fiAnd say this to Alexa or Google Assistant:
ask TRIGGERcmd to run monitor with parameter onOr use the TRIGGERcmd Smart Home Alexa skill or the SmartThings integration with Google Assistant, and say this:
turn on monitor -
T tuicemen moved this topic from Instructions on
-
This post is deleted!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login