Ejemplo n.º 1
0
def settings_pomp_times_put(index):

    ids = str(index)
    name = Register.BOTTLE_SETTINGS[str(index)]['name']

    weekly_dose_old = BottleLogic.get_weekly_dose(index)
    Register.BOTTLE_SETTINGS[ids]['times'] = request.json
    weekly_dose_new = BottleLogic.get_weekly_dose(index)
    settings.save_bottle()

    Helpers.log("Zmiana tygodniowej dawki: " + name + " " +
                str(weekly_dose_old) + " ppm na " + str(weekly_dose_new) +
                " ppm")
    return settings_pomp_times_get(index)
Ejemplo n.º 2
0
    def event(self):
        if not Register.LIRC_EVENTS:
            return

        lirc_event = LircEvents.get_event()
        if lirc_event == LircEvents.KEY_BACK:
            DisplayRegister.set_menuWindow()

        if lirc_event == LircEvents.KEY_LEFT:
            self.selectedIndex = (self.selectedIndex - 1) % 6
        if lirc_event == LircEvents.KEY_RIGHT:
            self.selectedIndex = (self.selectedIndex + 1) % 6

        if lirc_event == LircEvents.KEY_OK:
            if self.selectedIndex == 0:
                self.selected_bottle = (self.selected_bottle - 1) % len(
                    self.bottles_on)
            if self.selectedIndex == 1:
                self.selected_bottle = (self.selected_bottle + 1) % len(
                    self.bottles_on)
            if self.selectedIndex == 2:
                BottleLogic.up_dose(1)
            if self.selectedIndex == 3:
                BottleLogic.down_dose(1)
            if self.selectedIndex == 4:
                BottleLogic.set_bottle(self.bottles_on[self.selected_bottle])
            if self.selectedIndex == 5:
                BottleLogic.refill_bottle(
                    self.bottles_on[self.selected_bottle])
Ejemplo n.º 3
0
    def event(self):
        if not Register.LIRC_EVENTS:
            return

        lirc_event = LircEvents.get_event()
        if lirc_event == LircEvents.KEY_BACK:
            DisplayRegister.set_menuWindow()

        if lirc_event == LircEvents.KEY_LEFT:
            self.selectedIndex = (self.selectedIndex - 1) % 6
        if lirc_event == LircEvents.KEY_RIGHT:
            self.selectedIndex = (self.selectedIndex + 1) % 6

        if lirc_event == LircEvents.KEY_OK:
            if self.selectedIndex == 0:
                self.selected_bottle = (self.selected_bottle - 1) % len(self.bottles_on)
            if self.selectedIndex == 1:
                self.selected_bottle = (self.selected_bottle + 1) % len(self.bottles_on)
            if self.selectedIndex == 2:
                BottleLogic.up_dose(1)
            if self.selectedIndex == 3:
                BottleLogic.down_dose(1)
            if self.selectedIndex == 4:
                BottleLogic.set_bottle(self.bottles_on[self.selected_bottle])
            if self.selectedIndex == 5:
                BottleLogic.refill_bottle(self.bottles_on[self.selected_bottle])
Ejemplo n.º 4
0
    def __init__(self):
        threading.Thread.__init__(self)

        self.threads.append(TempThread())
        self.threads.append(LircThread())

        self.threads.append(Light1Logic.Light1Thread())
        self.threads.append(Light2Logic.Light2Thread())
        self.threads.append(BottleLogic.BottleThread())
        self.threads.append(DbDriver.DbThread())
        self.threads.append(PhThread.PhThread())
        self.threads.append(O2Thread.O2Thread())

        PowerModHelper.update_data()
Ejemplo n.º 5
0
def settings_pomp_state_get(index):

    ids = str(index)
    data = {
        'name': Register.BOTTLE_SETTINGS[ids]['name'],
        'on': Register.BOTTLE_SETTINGS[ids]['on'],
        'ml_per_sec': Register.BOTTLE_SETTINGS[ids]['ml_per_sec'],
        'ppm_per_ml': Register.BOTTLE_SETTINGS[ids]['ppm_per_ml'],
        'capacity': Register.BOTTLE_SETTINGS[ids]['capacity'],
        'state': Register.BOTTLE_SETTINGS[ids]['state'],
        'percent': Register.BOTTLE_SETTINGS[ids]['percent'],
        'connect_pomp': Register.BOTTLE_SETTINGS[ids]['connect_pomp'],
        'connect_ppm_per_ppm':
        Register.BOTTLE_SETTINGS[ids]['connect_ppm_per_ppm'],
        'connected_pomp_list': BottleLogic.get_connected_pomp_weekly_list(ids)
    }
    return jsonify({'data': data})
Ejemplo n.º 6
0
def actions_pomp_dose_put(index):
    BottleLogic.dose_from_bottle(str(index), request.json)
    return settings_pomp_dose_get(index)
Ejemplo n.º 7
0
def actions_pomp_refill_put(index):
    BottleLogic.refill_bottle(index)
    return settings_pomp_state_get(index)
Ejemplo n.º 8
0
def settings_pomp_summary_get():
    data = BottleLogic.get_bottles_summary()
    return jsonify({'data': data})