def data(request): string = "this is my string" roomIdList = ["1", "2", "3", "6"] house_data = {} for roomId in roomIdList: room = {} room['id'] = roomId room['temperature'] = deoServer.getPersistantData( roomId, "room", "temperature") room['humidity'] = deoServer.getPersistantData(roomId, "room", "humidity") room['name'] = deoServer.getPersistantData(roomId, "room", "name") room['reference'] = deoServer.getPersistantData( roomId, "room", "reference") house_data[room.get('name')] = room return JsonResponse(house_data)
def status(request): string = "this is my string" roomIdList = ["1", "2", "3", "6"] room_list = [] for roomId in roomIdList: room = Room() room.id = roomId room.temperature = deoServer.getPersistantData(roomId, "room", "temperature") room.humidity = deoServer.getPersistantData(roomId, "room", "humidity") room.name = deoServer.getPersistantData(roomId, "room", "name") room.reference = deoServer.getPersistantData(roomId, "room", "reference") room_list.append(room) context = {'room_list': room_list} return render(request, 'web/status.html', context)
def cold(request): roomIdList = ["1", "2", "3", "6"] for roomId in roomIdList: temp = deoServer.getPersistantData(roomId, "room", "night") res = deoServer.setPersistantData(roomId, "room", "reference", temp) #return render(request, 'web/back.html') context = {'action': 'cold set'} return render(request, 'web/done.html', context)
def heat(request): roomIdList = ["1", "2", "3", "6"] for roomId in roomIdList: temp = deoServer.getPersistantData(roomId, "room", "day") res = deoServer.setPersistantData(roomId, "room", "reference", temp) #return HttpResponse("<a href='/web/'>BACK</a>") context = {'action': 'heat set'} return render(request, 'web/done.html', context)
def index(request): service_name = "Deoplace" roomIdList = ["1", "2", "3", "6"] room_list = [] for roomId in roomIdList: room = Room() room.id = roomId room.temperature = deoServer.getPersistantData(roomId, "room", "temperature") room.humidity = deoServer.getPersistantData(roomId, "room", "humidity") room.name = deoServer.getPersistantData(roomId, "room", "name") room.reference = deoServer.getPersistantData(roomId, "room", "reference") room.ref_temp_list = [ "10", "12", "13", "14", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25" ] room_list.append(room) context = {'service_name': service_name, 'room_list': room_list} return render(request, 'web/index.html', context)