Grocy: Barcode Scanner Not Working — Fix

The Problem

You click the barcode scan button in Grocy and either the camera popup appears but never requests camera access, the camera doesn’t open at all, or scanned barcodes aren’t recognized. This affects product lookup, inventory management, and shopping list workflows.

Quick Diagnosis

SymptomLikely CauseJump To
Camera popup opens but no permission promptHTTPS not configuredMethod 1
Camera opens but won’t scan QR codesGrocy version too oldMethod 2
Special characters corrupted after scanEncoding bug in v4.4.0Method 2
Barcode button does nothingBrowser permissions deniedMethod 3
Using Home Assistant add-onKnown incompatibilityMethod 4
Camera works but scanning is unreliableHardware limitationMethod 5

The Cause

Grocy’s camera-based barcode scanning uses the browser’s MediaStream API, which modern browsers restrict to secure contexts (HTTPS). If you’re accessing Grocy over plain HTTP, the browser silently blocks camera access without showing an error. Additionally, Grocy versions before v4.5.0 used the older Quagga2 library which only supported linear barcodes (Code128, EAN) — QR codes and DataMatrix codes were not recognized.

The Fix

Method 1: Enable HTTPS

This is the most common cause. Browsers require HTTPS for camera access — no exceptions.

Check if this is your issue:

  1. Look at your Grocy URL in the browser address bar
  2. If it starts with http:// (not https://), this is your problem
  3. Open browser developer tools (F12) and check the console for enumerateDevices is not defined or similar media API errors

Fix with Nginx Proxy Manager:

If you’re already running Nginx Proxy Manager, add a proxy host:

  1. Go to Hosts → Proxy Hosts → Add Proxy Host
  2. Set Domain: grocy.yourdomain.com
  3. Forward to: http://[grocy-ip]:8080
  4. SSL tab: Request a new SSL certificate, enable Force SSL

Fix with Caddy:

grocy.yourdomain.com {
    reverse_proxy localhost:8080
}

Caddy automatically provisions SSL certificates via Let’s Encrypt.

Fix with a self-signed certificate (local network only):

openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes \
  -subj "/CN=grocy.local"

Then configure your reverse proxy to use these certificates. Note: browsers will show a security warning for self-signed certs, but camera access will work after accepting the warning.

See Reverse Proxy Setup for detailed instructions.

Method 2: Upgrade to v4.5.0+

Grocy v4.5.0 replaced the Quagga2 barcode library with ZXing, adding support for QR codes and DataMatrix codes. It also fixed a character encoding bug in the Open Food Facts plugin.

What v4.5.0 fixes:

  • QR code scanning (previously unsupported)
  • DataMatrix code scanning (previously unsupported)
  • Special characters corrupted when importing from Open Food Facts (e.g., “à” appearing as ”?”)

Upgrade your Docker container:

# Check current version
docker exec grocy cat /var/www/public/version.json

# Update to v4.5.0+
docker compose pull
docker compose up -d

If using the LinuxServer.io image:

services:
  grocy:
    image: lscr.io/linuxserver/grocy:4.5.0
    # ... rest of config

Method 3: Fix Browser Permissions

If you’ve previously denied camera access, the browser remembers that decision.

Chrome/Edge:

  1. Click the lock icon (or tune icon) in the address bar
  2. Find “Camera” in the permissions list
  3. Change from “Block” to “Allow”
  4. Reload the page

Firefox:

  1. Click the shield icon in the address bar
  2. Click “Connection secure” → “More information”
  3. Go to the Permissions tab
  4. Find “Use the Camera” and set to “Allow”
  5. Reload the page

Safari:

  1. Go to Safari → Settings → Websites → Camera
  2. Find your Grocy domain
  3. Set to “Allow”

Test camera access independently:

Open your browser’s developer console (F12) and run:

navigator.mediaDevices.enumerateDevices()
  .then(devices => console.log(devices))
  .catch(err => console.error(err));

If this returns an error, your browser or device doesn’t support camera access in this context.

Method 4: Home Assistant Workaround

Grocy running as a Home Assistant add-on cannot use camera barcode scanning. Home Assistant’s iframe sandboxing blocks the MediaStream API — this is a known, unfixable limitation of the add-on architecture.

Workarounds:

  1. Use a USB barcode scanner (recommended) — works regardless of browser restrictions
  2. Access Grocy directly — bypass Home Assistant’s iframe by navigating to the Grocy URL directly (e.g., https://homeassistant.local:9192)
  3. Run Grocy as a standalone Docker container instead of a Home Assistant add-on

Method 5: Use a USB Barcode Scanner

Camera-based barcode scanning is inherently unreliable. The Grocy maintainer recommends USB hardware scanners, stating they “work 1000% better, faster, under any lighting condition and from any angle.”

USB barcode scanners emulate keyboard input — they type the barcode value and press Enter. No driver installation needed, no HTTPS requirement, no browser permissions.

Recommended setup:

  1. Get any USB barcode scanner ($15-30 on Amazon)
  2. Plug it into the device running your browser
  3. Click into any barcode field in Grocy
  4. Scan — the barcode value is typed automatically

For mobile scanning: Use a Bluetooth barcode scanner paired to your phone or tablet. These work identically to USB scanners but wirelessly.

MethodCostReliabilitySpeedHTTPS Required
Camera (phone/webcam)$0Low-MediumSlowYes
USB barcode scanner$15-30Very HighInstantNo
Bluetooth scanner$25-50Very HighInstantNo

Prevention

  1. Always use HTTPS — set up a reverse proxy with SSL from the start
  2. Keep Grocy updated — run v4.5.0+ for the best scanning experience
  3. Invest in a USB scanner if you’ll be scanning regularly — the time savings pay for the device within a week of use
  4. Test camera access after any browser update — browser security policies change and can revoke previously granted permissions

Comments