Modified API calls and subprocess calls to work with the new system

master
Jared 7 years ago
parent b680ddf512
commit 9c7bf52e8f

@ -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)

@ -26,7 +26,7 @@ def requires_auth(f):
@app.route('/')
def index():
return '{"onFire": false}'
return '{"onFire": false}\nGo to <a href="status">status</a>.'
@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'))

@ -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 = '<div class="event-wrapper">';
@ -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);

Loading…
Cancel
Save