# Feature Spec: QR Codes & Hardware Integration

**Priority**: 🟡 Medium  
**Phase**: 12  
**Status**: 🟡 Partial (QR done, NFC/E-ink TODO)

---

## Overview

Enable quick plant/batch lookup via QR codes. Support for thermal label printing, RFID/NFC tags, and e-ink displays for room status.

---

## QR Code System

### Implementation Status: ✅ Complete

### QR Data Format

```json
{
  "type": "batch" | "plant" | "room" | "visitor",
  "id": "uuid",
  "name": "Display Name",
  "meta": { /* additional data */ }
}
```

### Features

- Generate QR codes for batches, plants, rooms, visitors
- Print labels with QR codes
- Scan to navigate to entity
- Bulk label generation

### API

- `generateBatchQRData(id, name, strain)` - Create batch QR
- `generatePlantQRData(id, batchId, position)` - Create plant QR
- `generateVisitorQRData(id, name, badge)` - Create visitor QR
- `parseQRData(data)` - Parse scanned QR

### Components

- `QRCodeGenerator` - Display/download QR
- `VisitorBadge` - Printable badge with QR

---

## Label Printing

### Supported Printers

- Zebra thermal printers (ZPL)
- DYMO LabelWriter
- Standard inkjet (PDF fallback)

### Label Sizes

- 2" x 1" - Plant tags
- 4" x 6" - Batch labels
- 3" x 2" - Visitor badges

### Print Features

- Batch print queue
- Print preview
- Template selection
- Auto-scaling

---

## NFC/RFID Tags (TODO)

### Use Cases

1. Plant tag scanning
2. Room access logging
3. Equipment tracking
4. Staff badge check-in

### Implementation Plan

1. Web NFC API for compatible devices
2. USB RFID reader support
3. Tag write capability for provisioning

---

## E-Ink Displays (TODO)

### Use Cases

1. Room status displays (temp, humidity, stage)
2. Batch status boards
3. Task queue displays

### Hardware Options

- Waveshare e-paper HAT
- InkPlate displays
- Custom ESP32-based

### Data Protocol

- MQTT for real-time updates
- HTTP polling fallback
- Low-power mode support

---

## Integration Architecture

```
┌─────────────────┐     ┌─────────────────┐
│   Mobile App    │────▶│   Backend API   │
│  (Scanner/NFC)  │     │                 │
└─────────────────┘     └────────┬────────┘
                                 │
        ┌────────────────────────┼────────────────────────┐
        │                        │                        │
        ▼                        ▼                        ▼
┌───────────────┐      ┌─────────────────┐      ┌─────────────────┐
│ Label Printer │      │  E-Ink Display  │      │   RFID Reader   │
│    (ZPL/PDF)  │      │    (MQTT)       │      │    (USB/BLE)    │
└───────────────┘      └─────────────────┘      └─────────────────┘
```
