def cellz(cellN):
    alert = "Введите номер мобильного телефона клиента: " + str(naboox.get_ip()) + ":7777/robot-control/"
    i = int(cellN[4])
    j = int(cellN[5])

    if request.method == 'POST':  # If user POST by clicking submit button any text
        while 1:
            try:
                box = ard.connect_to_box()
                break
            except:
                pass
        ard.open_doar(i, j, box)
        ID = request.form['id']
        file = "cells_ID.json"
        data = naboox.read_json(file)
        data[int(i)][int(j)] = ID
        naboox.write_json(data, file)
        alert = "Выберите ячейку: " + str(naboox.get_ip()) + ":7777/robot-control/"
        cell = naboox.read_json(file)
        for i in range(len(cell)):
            for j in range(len(cell[i])):
                if cell[i][j] != 0:
                    value = "Занято"
                else:
                    value = "Свободно"
                exec("cell" + str(i) + str(j) + " = '" + value + "'")

        return render_template(
            "robot.html", **locals())
    return render_template(
        "cell.html", **locals())
Exemple #2
0
def homeway():
    print("Go Home!")
    msg = "Я поехал домой"
    naboox.send_tlg_msg(msg, ids)
    # x = input("Доехал домой?")
    alert = "Мой IP: " + str(naboox.get_ip()) + ":7777/robot-control/"
    msg = "Я приехал домой и мой IP: " + str(naboox.get_ip())
    naboox.send_tlg_msg(msg, ids)
    return render_template("hello.html", **locals())
def robot():
    alert = "Выберите ячейку и мой IP: " + str(naboox.get_ip()) + ":7777/robot-control/"
    file = "cells_ID.json"
    cell = naboox.read_json(file)

    for i in range(len(cell)):
        for j in range(len(cell[i])):
            if cell[i][j] != 0:
                value = "Занято"
            else:
                value = "Свободно"
            command = "cell" + str(i) + str(j) + " = '" + value + "'"
            exec(command)

    if request.method == "POST":
        passcode = request.form['passcode']
        ids, truepass, timer = read_config()
        if passcode == truepass:
            msg = "Кто-то зашел в кабинет"
            naboox.send_tlg_msg(msg, ids)
            return render_template(
                "robot.html", **locals())
        else:
            alert = "Вы ввели неправильный пароль"
            msg = "Кто-то пытался зайти в кабинет, используя неправильный пароль"
            naboox.send_tlg_msg(msg, ids)
            return render_template(
                "login.html", **locals())
    return render_template(
        "robot.html", **locals())
    alert = "Мой IP: " + str(naboox.get_ip()) + ":7777/robot-control/"
    msg = "Я приехал домой и мой IP: " + str(naboox.get_ip())
    naboox.send_tlg_msg(msg, ids)
    return render_template(
        "hello.html", **locals())

# Login page, no authorisation with password
@app.route("/sended/<i>/", methods=["GET", "POST"])
def sended(i):
    if int(i) == 0:
        # naboox.write_json(time.time(), "start.json")
        msg = "Я поехал доставлять посылки"
        naboox.send_tlg_msg(msg, ids)
        time.sleep(10)
        x = input("Доехал?")
        smsgate.send("real")
        msg = "Я приехал на АстанаХаб"
        naboox.send_tlg_msg(msg, ids)
    alert = "Чтобы получить посылку нажмите:"
    return render_template(
        "sended.html", **locals())


# Main flask app
if __name__ == "__main__":
    # time.sleep(300)
    id, passcode4, timer4 = read_config()
    msg = "Я включился, мой IP: " + str(naboox.get_ip())
    naboox.send_tlg_msg(msg, id)
    app.run("0.0.0.0", port=7777, debug=True)
Exemple #5
0
    alert = "Мой IP: " + str(naboox.get_ip()) + ":7777/robot-control/"
    msg = "Я приехал домой и мой IP: " + str(naboox.get_ip())
    naboox.send_tlg_msg(msg, ids)
    return render_template(
        "hello.html", **locals())

# Login page, no authorisation with password
@app.route("/sended/<i>/", methods=["GET", "POST"])
def sended(i):
    if int(i) == 0:
        # naboox.write_json(time.time(), "start.json")
        msg = "Я поехал доставлять посылки"
        naboox.send_tlg_msg(msg, ids)
        time.sleep(10)
        x = input("Доехал?")
        smsgate.send("real")
        msg = "Я приехал на АстанаХаб"
        naboox.send_tlg_msg(msg, ids)
    alert = "Чтобы получить посылку нажмите:"
    return render_template(
        "sended.html", **locals())


# Main flask app
if __name__ == "__main__":
    # time.sleep(300)
    id, passcode4, timer4 = read_config()
    msg = "Я включился, мой IP: " + str(naboox.get_ip())
    naboox.send_tlg_msg(msg, id)
    app.run(host=naboox.get_ip(), port=7777, debug=True)