No announcement yet.

Linux, Bash and event values

  • Filter
  • Time
  • Show
Clear All
new posts

    Linux, Bash and event values


    Quick question.. how can i pass a device value to a shell script ?

    I have no problem running script with parameters, but how can i get the value to be one of them ?

    Im running the script as "Run another program or process" with Bash as the program and script (.sh) with parameters as command parameters.
    Last edited by levring; January 11, 2017, 03:17 PM.

    Use replacement variables as described in the following link.


      Originally posted by lveatch View Post
      Use replacement variables as described in the following link.
      Thanks for the input..
      It works great while sending an email, but I cant get it to work then passing the variable to a script.

      Requesting program: "/bin/bash"
      With parameter: "/home/pi/HomeSeer/scripts/ volume $$DVR:128:"

      Any idea why the variable is not being replaced ?


        For those returning to this thread..

        As said in previous post the replacement variables are not supported in running program or process. But found a workaround here by modifying the speak script and using the speak functionality instead.


          I was just going to ask will check the other thread


            Any update on this?

            anyone tried to get the value with json homeseer api and put in into a variable then put this variable in a curl command?


              not with the curl command but with a Perl script that I wrote using my own Perl module implementing the JSON API. Typically used from outside of HS to get info from HS.

              ./ -r 1005 -a name,value
              Todays Rain Amount,0.02
              ./ -f 'Todays Rain Amount'  -a ref,name,value
              $VAR1 = 1005;
              1005,Todays Rain Amount,0.02

              It can be called several ways -r <refId>, -f 'search string' (not sure if this is fully working). -a comma separated JSON attributes.

              Before I moved my graphing to Influx / Grafana, I executed Perl scripts from HS passing in the reference ID. Used the same Perl module to get the value.

              Launch /usr/bin/perl With Parameters: /usr/HomeSeer/veatch/scripts/ -deviceCode 122 -s masterBR


                thanks !!

                with a lot a searching on the net ( not a programmer) i have been able to get it working :

                a=$(curl --max-time 5.0 '' | jq -r '.Devices[0] .value');b=$( echo $a *2.54 | bc) ; c=$( echo $b | awk '{print ($0-int($0)<0.499)?int($0):int($0)+1}'); curl --max-time 5.0 -X PUT -H "Content-Type: application/json" -d '{"on": true,"bri": '$c',"transitiontime": 1}' ""