def powerOffEquipmentsRoom(self): for roomTemp in self.rooms.items(): print("---------------------------------", roomTemp) nameRoomTemp = roomTemp[0] ipRoomTemp = roomTemp[1][0] portRoomTemp = roomTemp[1][1] result = util.httpGetRequest(ipRoomTemp, portRoomTemp, "getNumeroDePessoas") if result == "Error in connection": self.removeRoom(nameRoomTemp) elif result == "0": method = "controlEquipment?equipment=" + "all" + "&command=" + "poweroff" util.httpGetRequest(ipRoomTemp, portRoomTemp, method) time.sleep(15) self.powerOffEquipmentsRoom()
def sendCommand(self, nameRoom, equipment, command): nameRoom = nameRoom.lower() infoRoom = self.__searchRoom(nameRoom) if infoRoom != False: ip = infoRoom[0] port = infoRoom[1] method = "controlEquipment?equipment=" + equipment + "&command=" + command return util.httpGetRequest(ip, port, method) else: return "Comodo nao existe"