0

I have a problem that I hope you guys can help me out with. Im making a home automation system with RPi + Piface to control devices on the network.

#----------------------------------------------------------------------------------------
#                           LIGHTS Automation
#----------------------------------------------------------------------------------------
  room=0

  listen_for /Turn on kitchen lights/i do
    lights('kitchen')
    request_completed
  end

  def lights(varible)
     IO.popen("python /root/SiriProxy/plugins/siriproxy-teamsiri/TeamsiriPython/test.py varible")
  end

this is my line of code. Im calling a python script and it works fine but I want use functions "varible"will be the varible to pass to the script but it does not send it as a varible but a string. Any one got some good ideas how to solve it

1 Answer 1

2

Change

IO.popen("python /root/SiriProxy/plugins/siriproxy-teamsiri/TeamsiriPython/test.py varible")

to

IO.popen("python /root/SiriProxy/plugins/siriproxy-teamsiri/TeamsiriPython/test.py #{variable}")

and the variable value will be substituted into the string.

Note that this only works inside double-quoted strings.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.