raw data
This commit is contained in:
16
app.py
16
app.py
@ -161,22 +161,26 @@ def status():
|
|||||||
|
|
||||||
@app.route('/api/diagnostics')
|
@app.route('/api/diagnostics')
|
||||||
def get_diagnostics():
|
def get_diagnostics():
|
||||||
logger.info("Diagnostics endpoint called")
|
|
||||||
try:
|
try:
|
||||||
config = load_config()
|
config = load_config()
|
||||||
unifi = UnifiAPI(config)
|
unifi = UnifiAPI(config)
|
||||||
|
logger.debug("Getting all devices...")
|
||||||
devices = unifi.get_all_devices()
|
devices = unifi.get_all_devices()
|
||||||
logger.info(f"Found {len(devices)} devices")
|
logger.debug(f"Raw devices response: {devices}")
|
||||||
|
|
||||||
diagnostics = {}
|
diagnostics = {}
|
||||||
for device in config['devices']:
|
for device in config['devices']:
|
||||||
logger.info(f"Getting diagnostics for {device['name']}")
|
if device.get('device_id'):
|
||||||
device_details = unifi.get_device_details(device['ip'])
|
logger.debug(f"Getting diagnostics for {device['name']}")
|
||||||
if device_details:
|
device_details = unifi.get_device_details(device['device_id'])
|
||||||
|
logger.debug(f"Raw device details: {device_details}")
|
||||||
diagnostics[device['name']] = device_details
|
diagnostics[device['name']] = device_details
|
||||||
|
|
||||||
return jsonify(diagnostics)
|
return jsonify(diagnostics)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error in diagnostics endpoint: {str(e)}")
|
logger.error(f"Error in diagnostics endpoint: {str(e)}")
|
||||||
return jsonify({"error": str(e)})
|
logger.exception("Full traceback:")
|
||||||
|
return jsonify({"error": str(e)}), 500
|
||||||
|
|
||||||
# Application entry point
|
# Application entry point
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Reference in New Issue
Block a user