예제 #1
0
def get_db_indoor(Indoor):
    sheet_name = 'indoor_node_' + str(Indoor.get_name())
    query = "SELECT * FROM " + sheet_name + " WHERE id=(select max(id) from " + sheet_name + ")"
    row = query_db(query)
    Indoor.set_name(row[1])
    Indoor.set_update_time(row[2])
    Indoor.set_temperature(row[3])
    Indoor.set_humidity(row[4])
    Indoor.set_radiation(row[6])
    Indoor.set_co2(row[6])
예제 #2
0
파일: main.py 프로젝트: tj621/hzheng
from flask import Flask
from flask import abort
from flask import redirect

import time

app = Flask(__name__)

node0 = Indoor()
print "temperature", node0.temperature
print "humidity", node0.humidity
print "radiation", node0.radiation
print "co2", node0.co2
node0.set_temperature(20.0)
node0.set_humidity(80.0)
node0.set_radiation(8000)
node0.set_co2(500)
print "temperature", node0.temperature
print "humidity", node0.humidity
print "radiation", node0.radiation
print "co2", node0.co2


def get_now_time():
    return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))


print get_now_time()