import RPi.GPIO as GPIO
import time
import subprocess

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
GPIO.setup(25, GPIO.IN, pull_up_down=GPIO.PUD_UP)
On = False

def offButton(channel):
    if channel == 25:
        subprocess.call['ssh -T elmocli < /sesame-scripts/stop-elmo']
        

def onButton(channel):
    if channel == 25:
        subprocess.call['ssh -T elmocli < /sesame-scripts/start-elmo']

while True:
    if On:
        GPIO.add_event_detect(25, GPIO.FALLING, callback=offButton, bouncetime=5000)
        On = False
    else:
        GPIO.add_event_detect(25, GPIO.FALLING, callback=onButton, bouncetime=5000)
        On = True  