def get_sensor_data(): res = list() for dev in devices.itervalues(): dev_data = dict() dev_data["name"] = dev["name"] dev_data["type"] = dev["type"] if dev["type"] == "power_cord": dev_data["data"] = get_power_coord_data(dev["ip_address"]) elif dev["type"] == "server": dev_data["data"] = {'output': ServerManager.server_is_up(dev["ip_address"])} res.append(dev_data) return res
def get_sensor_data(): res = list() for dev in devices.itervalues(): dev_data = dict() dev_data["name"] = dev["name"] dev_data["type"] = dev["type"] if dev["type"] == "power_cord": response_json, status_code = make_ubnt_request("GET", "http://" + dev["ip_address"] + "/sensors") dev_data["data"] = response_json["sensors"] elif dev["type"] == "server": dev_data["data"] = {"output": ServerManager.server_is_up(dev["ip_address"])} res.append(dev_data) return res