树莓派运行Vorto-Dashboard无数据显示问题求助
Based on your description, the StatusCodeError: 401 - "" in your terminal output is the key clue here. Even though your backend successfully pulls 2 things, the authentication failure when fetching device images, combined with the black screen, points to issues with environment variable loading or frontend/backend authentication handoff. Here are targeted troubleshooting steps:
1. Verify Environment Variables Are Loaded Correctly
Variables set in ~/.bashrc only take effect in interactive shell sessions. When you run npm start directly, the shell might not load these variables. Try these fixes:
- Manual export before starting:
export BOSCH_CLIENT_ID="your-client-id" export BOSCH_CLIENT_SECRET="your-client-secret" export BOSCH_SCOPE="your-required-scope" # e.g., "things:read" export REACT_APP_DEVICE_REFRESH_MS=10000 npm start - Force load .bashrc:
Runsource ~/.bashrc && npm startto ensure all environment variables are available in the session. - Validate variable presence: Run
echo $BOSCH_CLIENT_IDbefore starting the dashboard. If it returns empty, your variables aren't being loaded.
2. Double-Check Environment Variable Naming & Scope Value
Ensure you're using the exact variable names required by the Vorto-Dashboard (since config.json is deprecated). Pay close attention to:
- The
BOSCH_SCOPEvalue: It needs to include the correct permissions for reading device data and images. Confirm with the latest Vorto docs for your dashboard version to get the valid scope string. - Frontend vs backend variables: Variables prefixed with
REACT_APP_are exposed to the React frontend, but backend-only variables (like client ID/secret) don't need this prefix—make sure you haven't mixed them up.
3. Inspect Frontend Network Requests
The black screen might be due to frontend failures not visible in the terminal. Open your browser's Developer Tools (F12), go to the Network tab, and refresh the dashboard:
- Look for 401 errors on API calls from the frontend: This means the frontend isn't receiving valid authentication tokens to fetch device data.
- If data requests succeed but the screen stays black, check the Console tab for JavaScript errors—this could indicate a mismatch between your device's info model and the dashboard's expected data structure.
4. Validate Device Info Model Compatibility
Even though your device data shows up in the Bosch Things API, the Vorto-Dashboard might require specific metadata or property naming in your info model:
- Confirm that your temperature sensor's property names (e.g.,
temperature) match what the dashboard's display components expect. - Check that your model includes all required metadata (like unit information) for the dashboard to render the data properly.
Since you can access sensor data via the Swagger UI, your device integration and data pipeline are working—focus on fixing the authentication handoff and frontend data parsing in the dashboard.
内容的提问来源于stack exchange,提问作者Mhd Eyad Almolki

