diff --git a/cardlistener.py b/cardlistener.py index eb10906..06b2ea8 100755 --- a/cardlistener.py +++ b/cardlistener.py @@ -73,6 +73,7 @@ if __name__ == '__main__': GPIO.output(pin_config['tools_red_LED'], GPIO.LOW) wait = False # Open tools + subprocess.call("/home/pi/ELAB-RFID-I2C/RPi/i2c_challenge 0x30", shell=True) if data['fridge'] and GPIO.input(pin_config['fridge_btn']) == 0: GPIO.output(pin_config['fridge_grn_LED'], GPIO.LOW) GPIO.output(pin_config['tools_grn_LED'], GPIO.LOW) @@ -80,7 +81,7 @@ if __name__ == '__main__': GPIO.output(pin_config['tools_red_LED'], GPIO.LOW) wait = False # Open fridge - subprocess.call("/home/pi/ELAB-RFID-I2C/RPi/i2c_challenge", shell=True) + subprocess.call("/home/pi/ELAB-RFID-I2C/RPi/i2c_challenge 0x20", shell=True) if time.time() > timeout: GPIO.output(pin_config['fridge_grn_LED'], GPIO.LOW) diff --git a/server.py b/server.py index a04e112..92005c7 100644 --- a/server.py +++ b/server.py @@ -26,7 +26,7 @@ def requires_auth(f): @app.route('/') def index(): - return '{"onFire": false}' + return '{"onFire": false}\nGo to status.' @app.route('/status') @requires_auth @@ -37,8 +37,9 @@ def status(): @requires_auth def users(what): if what == "fridge": - subprocess.call("/home/pi/ELAB-RFID-I2C/RPi/i2c_challenge", shell=True) - + subprocess.call("/home/pi/ELAB-RFID-I2C/RPi/i2c_challenge 0x20", shell=True) + elif what == "tools": + subprocess.call("/home/pi/ELAB-RFID-I2C/RPi/i2c_challenge 0x30", shell=True) print 'opened', what return redirect(url_for('status')) diff --git a/static/script.js b/static/script.js index 514415f..58f851e 100644 --- a/static/script.js +++ b/static/script.js @@ -24,7 +24,7 @@ function save() { authCode += 1; if ($('#tools').is(':checked')) authCode += 2; - $.getJSON('http://127.0.0.1:5000/addcard/' + cardID + '/' + name + '/' + authCode, function(data) { + $.getJSON('http://130.237.3.207/addcard/' + cardID + '/' + name + '/' + authCode, function(data) { }); overlay_out(); @@ -32,7 +32,7 @@ function save() { $(document).ready(function() { jQuery.ajaxSetup({ cache: false }); - $.getJSON('http://127.0.0.1:5000/gethistory', function(data) { + $.getJSON('http://130.237.3.207/gethistory', function(data) { eventHistory = data.reverse(); var newHistory = '
'; @@ -57,7 +57,7 @@ $(document).ready(function() { $('.recent').on('click', '.event', function() { var cardID = $(this).attr('card-id'); $('.card-id').text(cardID); - $.getJSON('http://127.0.0.1:5000/getcardinfo/' + cardID, function(data) { + $.getJSON('http://130.237.3.207/getcardinfo/' + cardID, function(data) { $('#name').val(data.name); if (data.fridge) $('#fridge').prop('checked', true);