# 3D Facility Viewer & METRC Integration - Verification Guide

## 1. Feature Overview

We have integrated METRC plant tracking with the 3D facility viewer and added advanced data visualizations.

- **Deep Linking**: Click "View in 3D" from the METRC Dashboard to fly directly to a plant's location.
- **Plant History**: View a timeline of plant movements in the METRC Dashboard.
- **Data Overlays**: Toggle "Health", "Temperature", "Humidity", and "Yield" modes in the 3D viewer.

## 2. Verification Steps

### A. METRC Dashboard Integration

1. Navigate to `/metrc`.
2. Find a plant in the "Live Plants" table.
3. **Test History**: Click the **"History"** button.
    - Verify a modal appears showing the plant's current location and movement log.
    - Click **"Locate in 3D"** within the modal.
4. **Test Direct Link**: Click the **"View in 3D"** button (box icon) in the table row.
    - Verify you are redirected to `/facility/3d`.
    - Verify the camera automatically flies to the room containing the plant.
    - Verify the specific plant is selected (popup overlay appears).

### B. 3D Data Visualization

1. Navigate to `/facility/3d`.
2. Look for the floating control panel on the **right side** of the screen.
3. Test the Modes:
    - **Standard**: Default view, plants colored by stage (Veg/Flower).
    - **Health**: Plants colored Green (Good), Yellow (Warning), Red (Critical). *Note: Uses simulated data for demo.*
    - **Temp**: Rooms colored by temperature heatmap (Blue -> Red). Hover/Look for temperature labels.
    - **VPD (Humidity)**: Rooms colored by humidity heatmap.
    - **Yield**: Plants colored by maturity gradient.
4. **Legend**: Verify the legend at the top of the screen updates to reflect the active mode.

## 3. Configuration & Troubleshooting

- **Data Source**: The environment and health data are currently simulated (`getMockRoomEnv`, `getMockPlantHealth`) for demonstration purposes. To connect real sensors, update the `useEffect` hook in `Facility3DViewerPage.tsx` to fetch from your IoT API.
- **Missing Plants**: If a plant is not found when deep-linking, a warning is logged to the console, and the viewer stays at the default view. Ensure the `seed-plants.js` script has been run to populate the facility.
