Beispiel #1
0
def get_data_for_sqlite():
    pv = omega.get_pv(),
    sv = omega.get_setpoint(),
    pid_running = omega.is_running(),
    hltToMash = str116.get_relay(settings.relays['hltToMash']),
    hlt = str116.get_relay(settings.relays['hlt']),
    rimsToMash = str116.get_relay(settings.relays['rimsToMash']),
    pump = str116.get_relay(settings.relays['pump']),
    timestamp = time.time(),
Beispiel #2
0
def write_latest_data():
    info = Info(
        pv=omega.get_pv(),
        sv=omega.get_setpoint(),
        pid_running=omega.is_running(),
        hltToMash=str116.get_relay(settings.relays['hltToMash']),
        hlt=str116.get_relay(settings.relays['hlt']),
        rimsToMash=str116.get_relay(settings.relays['rimsToMash']),
        pump=str116.get_relay(settings.relays['pump']),
        timestamp=time.time(),
    )
    db.begin()
    try:
        info.save()
    except ErrorSavingData:
        db.rollback()
    db.commit()
Beispiel #3
0
def toggle_pump():
    if str116.get_relay(settings.relays['pump']):
        print 'Turning pump OFF . . . ',
        str116.set_relay(settings.relays['pump'], 0)
    else:
        print 'Turning pump ON . . . ',
        str116.set_relay(settings.relays['pump'], 1)
    print 'DONE'
Beispiel #4
0
def toggle_relay(relay_address):
    if isinstance(relay_address, int) and relay_address < 3:
        if str116.get_relay(relay_address):
            print 'Turning valve OFF . . . ',
            str116.set_relay(relay_address, 0)
        else:
            print 'Turning valve ON . . . ',
            str116.set_relay(relay_address, 1)
        print 'DONE'
    else:
        print 'INVALID RELAY ADDRESS'
Beispiel #5
0
def toggle_relay_menu():
    STATE_0 = 'ON' if str116.get_relay(settings.relays["hltToMash"]) else 'OFF'
    STATE_1 = 'ON' if str116.get_relay(settings.relays["hlt"]) else 'OFF'
    STATE_2 = 'ON' if str116.get_relay(settings.relays["rimsToMash"]) else 'OFF'
    print '''
Please select an option:

   0. Sparge-to-mash valve (currently {})
   1. Sparge valve (currently {})
   2. RIMS-to-mash valve (currently {})

   9. Return to main menu
'''.format(STATE_0, STATE_1, STATE_2)

    choice = input("Select a valve from the choices above: ")
    if choice == 9:
        return
    if isinstance(choice, int) and choice < 3:
        toggle_relay(choice)
    else:
        print "Invalid option. Please select a number from the list above."
        toggle_relay_menu()
Beispiel #6
0
def show_main_menu():
    PUMP_STATE = 'ON' if str116.get_relay(settings.relays['pump']) else 'OFF'
    PID_STATE = 'ON' if instr.is_running() else 'OFF'
    TARGET_TEMP = instr.get_setpoint()
    CURRENT_TEMP = instr.get_pv()
    print '''
Please select an option:

   1. Toggle valve relay
   2. Toggle pump (pump currently {})
   3. Toggle PID (PID currently {})
   4. Set PID target temp (currently {}; actual temp {})
   5. Set brewer stage (currently in RIMS)

   9. Exit brew controller
'''.format(PUMP_STATE, PID_STATE, TARGET_TEMP, CURRENT_TEMP)
Beispiel #7
0
from str116 import get_relay

for x in range(100):
    print(get_relay(3))
Beispiel #8
0
import str116
import sys

if str116.get_relay(int(sys.argv[1])):
    print("relay 0" + sys.argv[1] + ": on")
else:
    print("relay 0" + sys.argv[1] + ": off")
    pass