示例#1
0
def getSettings():
    if request.method == 'GET':
        sensordata = {}
        pollingdata = {}
        timelimits = []
        Sensors = DataRepository.read_sensor_settings()
        polling = DataRepository.read_data_settings_all()
        limits = DataRepository.read_time_limits()
        i = 1
        for sensor in Sensors:
            SensorID = sensor['DeviceID']
            LowerLimit = sensor['LowerLimit']
            UpperLimit = sensor['UpperLimit']
            Active = sensor['Active']
            sensordata.update(
                {f'{i}': [SensorID, UpperLimit, LowerLimit, Active]})
            i += 1
        i = 1
        for setting in polling:
            Name = setting['Name']
            Speed = float(setting['SpeedInSeconds'])
            pollingdata.update({f'{i}': [Name, Speed]})
            i += 1
        timelimits.append(f'{limits["startTime"]}')
        timelimits.append(f'{limits["stopTime"]}')
        return jsonify([sensordata, pollingdata, timelimits]), 200
示例#2
0
def klant(id):
    if request.method == 'GET':
        # READ
        data = DataRepository.read_klant(id)
        if data is not None:
            return jsonify(data), 200
        else:
            return jsonify(message="error"), 404
    elif request.method == 'PUT':
        # UPDATE
        gegevens = DataRepository.json_or_formdata(request)
        data = DataRepository.update_klant(
            gegevens['FNaam'],
            gegevens['VNaam'],
            gegevens['Straat'],
            gegevens['Nummer'],
            gegevens['Postcode'],
            gegevens['Gemeente'],
            id
        )
        if data > 0:
            return jsonify(KlantID=id), 200
        elif data == 0:
            # geen fouten in sql maar alle data was identiek
            return jsonify(message="Geen aanpassingen"), 200
        else:
            # fouten in sql
            return jsonify(message="error"), 404
    elif request.method == 'DELETE':
        data = DataRepository.delete_klant(id)
        return jsonify(status=data), 200
示例#3
0
def klant(id):
    if request.method == 'GET':
        data = DataRepository.read_klant(id)
        if data is not None:
            return jsonify(data), 200
        else:
            return jsonify(message='error'), 404

    elif request.method == 'PUT':  # update
        gegevens = DataRepository.json_or_formdata(request)
        data = DataRepository.update_klant(
            gegevens['FNaam'], gegevens['VNaam'], gegevens['Straat'],
            gegevens['Nummer'], gegevens['Postcode'], gegevens['Gemeente'], id)
        if data is not None:
            if data > 0:
                return jsonify(KlantID=id), 200
            else:
                return jsonify(status=data), 200
        else:
            return jsonify(message='error'), 404

    elif request.method == 'DELETE':
        data = DataRepository.delete_klant(id)
        print(data)
        return jsonify(status=data), 200
示例#4
0
def fill(data):
    global gewicht_voederbak, gewicht_voederbak_huidig, gewicht_voederbak_live

    hoeveelheid = int(data['hoeveelheid'])

    servo = Servo(pin_servo)
    gewicht_voederbak_vorig = max(0, int(hx.get_weight(5)))
    i = 0
    while (gewicht_voederbak_vorig + hoeveelheid >= gewicht_voederbak_live):
        if (i % 2 == 0):
            servo.start()
        else:
            servo.start_links()
        data = DataRepository.servo_on()

        print(
            f"Vorig: {gewicht_voederbak_vorig} {hoeveelheid} Huidig gewicht: {gewicht_voederbak_live}"
        )
        data = DataRepository.opslag_legen(hoeveelheid)

        time.sleep(1)
        i += 1
    else:
        servo.stop()
        data = DataRepository.servo_off()
        gewicht_voederbak_vorig = gewicht_voederbak_huidig
示例#5
0
def get_programmas():
    if request.method == "GET":
        try:
            data = DataRepository.get_programmas()
            if data is not None:
                return jsonify(programmas=data), 200

            else:
                return jsonify(error="data is none"), 404

        except Exception as ex:
            print(ex)
            return jsonify(error="some exception"), 404

    elif request.method == "POST":
        try:
            gegevens = request.get_json()
            data = DataRepository.create_programma(
                gegevens['Duurtijd'], gegevens['Temperatuur'],
                gegevens['HoeveelheidProduct'], gegevens['Naam'])
            if data is not None:
                return jsonify(programmas=data), 200

            else:
                return jsonify(error="data is none"), 404

        except Exception as ex:
            print(ex)
            return jsonify(error="some exception"), 404
示例#6
0
def keycheck():
    global place_inKey_notename
    global last_scale_number
    global idnoten_in_scale_midi
    global scale_number
    global scalenotes
    global leadinstr
    global backinginstr
    last_scale_number = scale_number
    print(scale_number)
    idnoten_in_scale_midi = DataRepository.read_noten_by_keyid(scale_number)
    print(idnoten_in_scale_midi)
    i = -2
    for idnoot in idnoten_in_scale_midi:
        if i == -2:
            scale_name = idnoten_in_scale_midi[idnoot]
            i += 1
        elif i == -1:
            leadinstr = idnoten_in_scale_midi['Leadinst']
            i += 1
        elif i == 0:
            backinginstr = idnoten_in_scale_midi['Backinst']
            i += 1
        else:
            place_inKey_notename[i] = DataRepository.read_notename_by_id(
                idnoten_in_scale_midi[idnoot])['NoteName']
            scalenotes[idnoten_in_scale_midi[
                idnoot]] = DataRepository.read_notename_by_id(
                    idnoten_in_scale_midi[idnoot])['NoteName']
            i += 1
    socketio.emit('B2F_noten_in_scale', place_inKey_notename)
    print(place_inKey_notename)
    print(scale_name)
    lcd.clear_display()
    lcd.write_message(scale_name)
示例#7
0
def lees_thermistor():
    print("Reading Temperature")
    old_temp = 24
    while True:
        new_temp = float(MCP().read_channel(1))
        rntc = 10000 / ((1023 / new_temp) - 1)
        tkelvin = 1 / (1 / 298.15 + 1 / 45700 * math.log(rntc / 10000))
        tcelsiusraw = tkelvin - 273.15
        global tcelsius
        tcelsius = int(tcelsiusraw)
        if tcelsius is not old_temp:
            # print(f"Temperatuur gewijzigd naar : {tcelsius}")
            socketio.emit('B2F_temperature',
                          {'currentTemperature': f"{tcelsius}"},
                          broadcast=True)
            time_string = time.strftime("%Y-%m-%d %H:%M:%S")
            socketio.emit('B2F_temperature_time',
                          {'currentTime': f"{time_string}"},
                          broadcast=True)
            deviceid_string = "Temp"
            DataRepository.measure_device(deviceid_string, tcelsius,
                                          time_string)
            # print(time_string)
            old_temp = tcelsius
            time.sleep(3)
        elif tcelsius == old_temp:
            # print("Temperatuur ongewijzigd")
            time.sleep(3)
示例#8
0
def toggle_status(status):
    if status.get('status') == 'OFF':
        GPIO.output(relay, GPIO.LOW)
    if status.get('status') == 'ON':
        GPIO.output(relay, GPIO.HIGH)
    DataRepository.insert_status(status.get('status'))
    socketio.emit('B2F_toggle_status', {'status': status})
示例#9
0
def edit_activiteiten(idOrDate):
    if request.method == "GET":
        return jsonify(activiteiten=DataRepository.read_activiteiten(idOrDate)), 200
    elif request.method == "PUT":
        link = DataRepository.get_activiteiten_link(idOrDate)

        if link["LinkID"] is None:
            info = DataRepository.json_or_formdata(request)
            event = info["event"]
            date = info["date"].replace("T", " ")
            data = DataRepository.update_activiteit(idOrDate, event, date)
            
            if data is not None:
                if data == -1:
                    return jsonify(message="Fout: Deze activiteit bestaat niet of is gelinkt aan een externe kalender"), 404
                elif data == 0:
                    return jsonify(message="Geen gegevens aangepast"), 200
                else:
                    return jsonify(message="Succesvol aangepast", date=date.split(" ")[0]), 200
            else:
                return jsonify(message="error"), 404
        else:
            return jsonify(message="Fout: Deze activiteit is gelinkt aan een externe kalender"), 406
    elif request.method == "DELETE":
        data = DataRepository.delete_activiteit(idOrDate)
        if data > 0:
            return jsonify(message="Succesvol verwijderd"), 201
        else:
            return jsonify(message="Niks verwijderd"), 201
示例#10
0
def user_info():
    print('getting user info')
    while True:
        u_id = DataRepository.get_current_user()['currentUser']
        global current_user
        current_user = DataRepository.get_user(u_id)
        time.sleep(2)
示例#11
0
def lees_waterniveau_manual():
    print("Inlezen van het waterniveau")
    waterlevel = ReadChannel(2)

    watermm = ""

    if waterlevel <= 440:
        watermm = 0
    if waterlevel >= 440 and waterlevel <= 490:
        watermm = 5
    if waterlevel >= 490 and waterlevel <= 530:
        watermm = 10
    if waterlevel >= 530 and waterlevel <= 550:
        watermm = 15
    if waterlevel >= 550 and waterlevel <= 565:
        watermm = 20
    if waterlevel >= 565 and waterlevel <= 575:
        watermm = 25
    if waterlevel >= 575 and waterlevel <= 580:
        watermm = 30
    if waterlevel >= 580 and waterlevel <= 585:
        watermm = 35
    if waterlevel >= 585:
        watermm = 40
    DataRepository.update_waarde_sensor_by_id('WATER', watermm)
    socketio.emit('B2F_waterniveau', {'waterniveau': watermm})
示例#12
0
def read_sensors():
    global temp, hum, moist, light, water_applied, irrigation_mode
    while True:
        print("sensors inlezen")
        hum_raw, temp_raw = Adafruit_DHT.read(DHT_sensor, dht)
        if hum_raw is not None and temp_raw is not None:
            temp = round(temp_raw, 0)
            hum = round(hum_raw, 0)

        moist = abs(
            round((moist_sensor.read_channel() - 350) / 673 * 100, 0) - 100)

        light = abs(round(LDR.read_channel() / 1023 * 100, 0) - 100)

        insert_sensordata()

        if irrigation_mode == "auto":
            if moist < 35:
                res = DataRepository.insert_measurement('SOLA', 4, 1, None)
                solenoid.apply_water()
                res = DataRepository.insert_measurement('SOLA', 4, 0, None)
                water_applied = 1
            else:
                water_applied = 0

        check_warnings()

        time.sleep(120)
示例#13
0
def activate_solenoid(data):
    global irrigation_mode
    print('Solenoid activated')
    if irrigation_mode == "man":
        res = DataRepository.insert_measurement('SOLM', 4, 1, None)
        solenoid.apply_water()
        res = DataRepository.insert_measurement('SOLM', 4, 0, None)
示例#14
0
def send_data(payload):
    if payload == 'temperatuur':
        data = DataRepository.read_temperature()
        for i in data:
            i['DateTime'] = str(i['DateTime'])
        socketio.emit('B2F_read_data', data)
    if payload == 'luchtvochtigheid':
        data = DataRepository.read_humidity()
        for i in data:
            i['DateTime'] = str(i['DateTime'])
        socketio.emit('B2F_read_data', data)
    if payload == 'grondvochtigheid':
        data = DataRepository.read_moisture()
        for i in data:
            i['DateTime'] = str(i['DateTime'])
        socketio.emit('B2F_read_data', data)
    if payload == 'licht':
        data = DataRepository.read_light()
        for i in data:
            i['DateTime'] = str(i['DateTime'])
        socketio.emit('B2F_read_data', data)
    if payload == 'water':
        data = DataRepository.read_solenoid()
        for i in data:
            i['DateTime'] = str(i['DateTime'])
        socketio.emit('B2F_read_data', data)
示例#15
0
def create_game(game_data):
    name = game_data['Name']
    desc = game_data['Description']
    decks = int(game_data['CardDecks'])
    cards = int(game_data['CardsPerPlayer'])
    age = int(game_data['MinimumAge'])
    min_players = int(game_data['MinimumPlayers'])
    max_players = int(game_data['MaximumPlayers'])
    playerinfoid = 0
    rulesetid = 0

    existing_playerinfoid = DataRepository.read_playerinfo_by_data(
        age, min_players, max_players)

    if existing_playerinfoid is not None:
        playerinfoid = int(existing_playerinfoid["ID"])
    else:
        playerinfoid = DataRepository.create_playerinfo(
            age, min_players, max_players)

    existing_rulesetid = DataRepository.read_ruleset_by_data(
        cards, playerinfoid)

    if existing_rulesetid is not None:
        rulesetid = int(existing_rulesetid["ID"])
    else:
        rulesetid = DataRepository.create_ruleset(playerinfoid, cards, 0)

    gameid = DataRepository.create_game(name, desc, decks, rulesetid)

    socketio.emit('B2F_game_created')
示例#16
0
def calendar():
    global calendarStop

    while True:
        links = DataRepository.get_links()
        
        if links:
            print("Import calendar begin")
            
            for linkInformation in links:
                if not calendarStop:
                    linkID = linkInformation["LinkID"]
                    link = linkInformation["Link"]
                    
                    try:
                        c = Calendar(requests.get(link).text)
                        e = list(c.timeline)

                        for event in e:
                            if not calendarStop:
                                time = event.begin
                                date = time.strftime("%Y-%m-%d %H:%M:%S")
                                event = event.name

                                DataRepository.add_activiteit_not_exists(event, date, linkID)
                            else:
                                DataRepository.delete_activiteiten(linkID)
                    except Exception as e:
                        print(e)
            
            print("Import calendar end")

        calendarStop = False
        sleep(15)
示例#17
0
 def MQ135(self, now):
     meetWaardeMQ = self.ReadChannel(0)
     calcVoltage = meetWaardeMQ * (3.3 / 1024.0)
     gas = round((calcVoltage * 303) + 0.1)
     DataRepository.add_measurement(gas, now.strftime("%Y-%m-%d %H:%M:%S"),
                                    "MQ", None)
     return meetWaardeMQ
示例#18
0
def switch_light(data):

    update = DataRepository.update_status_licht(1, data['verkeerslichtid'])
    licht1 = DataRepository.read_status_licht_by_id(1)
    """ licht2 = DataRepository.read_status_licht_by_id(2)
    print(licht1) """
    socketio.emit('B2F_verander_licht', {'licht1': licht1})
示例#19
0
def play():
    global playing
    global idnoten_in_scale_midi
    global place_inKey_notename
    global scale_name
    global current_track
    global may_rotate
    may_rotate = True
    idnoten_in_scale_midi = DataRepository.read_noten_by_keyid(scale_number)
    print(idnoten_in_scale_midi)
    i = -2
    for idnoot in idnoten_in_scale_midi:
        if i == -2:
            scale_name = idnoten_in_scale_midi[idnoot]
            i += 1
        elif i == -1:
            leadinstr = idnoten_in_scale_midi['Leadinst']
            i += 1
        elif i == 0:
            backinginstr = idnoten_in_scale_midi['Backinst']
            i += 1
        else:
            place_inKey_notename[i] = DataRepository.read_notename_by_id(
                idnoten_in_scale_midi[idnoot])['NoteName']
            scalenotes[idnoten_in_scale_midi[
                idnoot]] = DataRepository.read_notename_by_id(
                    idnoten_in_scale_midi[idnoot])['NoteName']
            i += 1

    socketio.emit('B2F_noten_in_scale1', place_inKey_notename)
    socketio.emit('B2F_current_track', {'current': current_track},
                  broadcast=False)
    print(place_inKey_notename)
    print(scale_name)
示例#20
0
def hourlyReadings():
    try:
        while True:
            date = datetime.now()
            print(date.strftime("%d/%m/%Y %H:%M:%S"))

            dateNext = (datetime.now() + timedelta(hours=1)).replace(minute=00,
                                                                     second=00)
            print(dateNext.strftime("%d/%m/%Y %H:%M:%S"))

            difference = dateNext - date
            print(difference.total_seconds())

            delay = difference.total_seconds()
            t_end = time.time() + delay

            check_status = GPIO.input(waterswitch)
            while time.time() < t_end:
                new_status = GPIO.input(waterswitch)
                if check_status != new_status:
                    DataRepository.insert_short_reading(
                        date, 8, GPIO.input(waterswitch))

            readMcp()
            print("Hourly scan - got and sent data")
    except KeyboardInterrupt as e:
        print(e)
        GPIO.cleanup()
示例#21
0
 def run(self):
     status = "IP"
     self.init_lcd()
     self.hide_cursor(True)
     previous_time = ''
     while True:
         current_time = self.get_time()
         if current_time != previous_time:
             self.first_row()
             self.write_message(current_time)
             self.second_row()
             if status == "IP":
                 status = "INFO"
                 self.write_message(self.get_ip().ljust(16))
             elif status == "INFO":
                 status = "IP"
                 self.write_message('T:' + str(
                     round(
                         DataRepository.get_latest_value(1).get('Value'),
                         1)) + 'ßC')
                 self.write_message(' ')
                 self.write_message('H:' + str(
                     round(
                         DataRepository.get_latest_value(2).get('Value'),
                         1)) + '%')
         previous_time = current_time
示例#22
0
    def run(self):

        while True:
            Temp = DataRepository.get_latest_value(1).get('Waarde')
            LDR = DataRepository.get_latest_value(2).get('Waarde')
            if LDR < 25:
                if Temp < 18:
                    self.write('PATTERN')
                    self.read()
                    self.write('DarkBlue')
                    self.read()
                elif Temp >= 18 and Temp < 21:
                    self.write('PATTERN')
                    self.read()
                    self.write('Blue')
                    self.read()
                elif Temp >= 21 and Temp < 24:
                    self.write('PATTERN')
                    self.read()
                    self.write('Red')
                    self.read()
                elif Temp >= 24:
                    self.write('PATTERN')
                    self.read()
                    self.write('DarkRed')
                    self.read()
示例#23
0
def update_value(type, value):
    global vorig_lichtp
    global vorige_GPS
    global vorige_RFID
    timestamp = datetime.datetime.now()

    if (type == "LDR"):
        if (value != vorig_lichtp):
            vorig_lichtp = value
            # LDR waarde toevoegen in database
            DataRepository.meting_toevoegen(2, value)
            # socketio.emit('B2F_MVP1_LDR', {"Waarde": value}, broadcast=True)
        else:
            print("LDR waarde niet veranderd. Niet updaten.")
    elif (type == "GPS"):
        if (value != vorige_GPS):
            vorige_GPS = value
            # GPS waarden toevoegen in database
            DataRepository.meting_toevoegen(1, value)
            # Emit naar frontend die open staat
            socketio.emit('B2F_GPS_locatie', {"Waarde": value}, broadcast=True)
        else:
            print("GPS waarde niet veranderd. Niet updaten.")
    elif (type == "RFID"):
        SpelBeheer.RFID_actie(value, timestamp)
        # socketio.emit("B2F_MVP1_RFID", {"UID": value})
    elif (sensor == "Error"):
        print(f"Arduino kon niet antwoorden op verzoek: {value}")
示例#24
0
def update_endtime():
    print("arrival btn pressed")
    datetime = time.strftime("%Y-%m-%d %H:%M:%S")
    orderid = (DataRepository.read_order_maxid())["maxid"]
    print(datetime)
    DataRepository.update_order_end(orderid, datetime)
    get_orders()
示例#25
0
def bestemming(id):
    if request.method == 'GET':
        # READ
        data = DataRepository.read_bestemming(id)
        if data is not None:
            return jsonify(data), 200
        else:
            return jsonify(message="error"), 404
    elif request.method == 'PUT':
        # UPDATE
        gegevens = DataRepository.json_or_formdata(request)
        data = DataRepository.update_bestemming(
            gegevens['Afkorting'],
            gegevens['Voluit'],
            gegevens['Land'],
            gegevens['TypeVlucht'],
            id
        )
        if data > 0:
            return jsonify(BestemmingID=id), 200
        elif data == 0:
            # geen fouten in sql maar alle data was identiek
            return jsonify(message="Geen aanpassingen"), 200
        else:
            # fouten in sql
            return jsonify(message="error"), 404
    elif request.method == 'DELETE':
        data = DataRepository.delete_bestemming(id)
        return jsonify(status=data), 200
示例#26
0
def get_GPS_data():
    uart = serial.Serial("/dev/ttyS0", baudrate=9600, timeout=10)
    gps = adafruit_gps.GPS(uart, debug=False)
    gps.send_command(b'PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0')
    gps.send_command(b'PMTK220,1000')

    gps.update()

    while not gps.has_fix:
        print(gps.nmea_sentence)
        print('Waiting for fix...')
        gps.update()
        time.sleep(1)
        continue

    # print('=' * 40)  # Print a separator line.
    print('Latitude: {0:.6f} degrees'.format(gps.latitude))
    print('Longitude: {0:.6f} degrees'.format(gps.longitude))
    print("Speed: " + str(gps.speed_knots) + "knots")

    idwp = (((DataRepository.read_waypoints_maxid())['maxid']) + 1)
    longitudewp = float("{:.4f}".format(gps.longitude))
    latitudewp = float("{:.5f}".format(gps.latitude))
    speedwp = gps.speed_knots

    DataRepository.insert_waypoint(idwp, longitudewp, latitudewp, speedwp)

    adafruitGPS_data = {
        'Latitude': latitudewp,
        'Longitude': longitudewp,
        'Speed': speedwp
    }
    socketio.emit('B2F_return_GPS_data', adafruitGPS_data)
示例#27
0
    def rechts_pressed(self):
        print("rechts pressed")
        if self.state == "cycling":
            if self.baskets['currentlyWashing'] is None:
                self.page += 1
                self.set_display_content()
            else:
                self.state = "asked_to_cancel"
                self.ask_to_cancel()

        elif self.state == "confirm_mand":
            # Switch tussen 1 en 2
            self.mand = 1 if self.mand == 2 else 2
            self.query_mand()

        elif self.state == "query_start_time":
            # optellen bij de uitsteltijd
            self.uitstel_start += 5
            self.query_start_time()

        elif self.state == "asked_to_cancel":
            self.state = "confirm_cancellation"
            self.ask_cancellation_confirmation()

        elif self.state == "confirm_cancellation":
            DataRepository.cancel_was(
                self.baskets['currentlyWashing']['Volgnummer'])
            self.update_baskets()

        elif self.state == "welcome":
            self.update_baskets()
示例#28
0
def game(game_id):
    if request.method == 'GET':
        data = DataRepository.read_game_by_id(game_id)
        if data is not None:
            return jsonify(game=data), 200
        else:
            return jsonify(message=f'ERROR: there is no game with this id: {game_id}'), 404
    elif request.method == 'PUT':
        gegevens = DataRepository.json_or_formdata(request)

        data = DataRepository.update_game_by_id(
            game_id, gegevens['name'], gegevens['description'], gegevens['cardDecks'], gegevens['rulesetID'])
        if data is not None:
            if data > 0:
                return jsonify(gameID=data), 200
            elif data == 0:
                return jsonify(message='There wasn\'t anything to update.'), 200
        else:
            return jsonify(message='ERROR: there went something wrong with updating the game.'), 404
    elif request.method == 'DELETE':
        data = DataRepository.delete_game(game_id)
        if data is not None:
            if data > 0:
                return jsonify(message='The game has been deleted.'), 200
            elif data == 0:
                return jsonify(message='No game has been deleted.'), 200
        else:
            return jsonify(message='ERROR: there went something wrong with deleting the game'), 404
示例#29
0
def plannen():
    tijd = 0
    indata = -1
    uitdata = -2
    inschtijd = -3
    uitschtijd = -4
    while True:
        #Huidige tijd omzetten naar zelfde formaat als in database
        tijd = str(datetime.now())
        tijd = tijd.replace(".", ":")
        tijd = tijd[:-10]
        #controleren of huidige tijd gelijk is aan tijd gegeven in json
        if (str(tijd) == str(inschtijd)):
            if GPIO.input(relais) == 0:
                toggle_relais()
            else:
                print("reeds ingeschakeld")
        if (str(tijd) == str(uitschtijd)):
            if GPIO.input(relais) == 1:
                toggle_relais()
            else:
                print("reeds uitgeschakeld")
        #telkens nieuwste in en uitschakel json ophalen
        indata = DataRepository.read_gepland(1)
        uitdata = DataRepository.read_gepland(0)
        socketio.emit("B2F_gepland")
        #inschakeltijd en uitschakeltijd uit json halen
        for data in indata:
            inschtijd = data["tijdstip"]
            inschtijd = str(inschtijd)[:-3]
        for data in uitdata:
            uitschtijd = data["tijdstip"]
            uitschtijd = str(uitschtijd)[:-3]
        time.sleep(59)
示例#30
0
def writesensordata(sensorvalues, databaseWriteInterval):
    while True:
        time.sleep(databaseWriteInterval)
        for i in range(len(sensorvalues)):
            currentTime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
            DataRepository.insert_sensordata(i + 1, currentTime,
                                             sensorvalues[i])