NetBox plugin to generate QR codes for assets
Go to file
Ivan Schaller ad247a8640 update renovate path 2023-12-05 13:38:41 +01:00
.woodpecker init 2023-06-21 23:31:47 +02:00
development add svg qr codes 2023-06-26 11:55:18 +02:00
netbox_qrgen add new models for qr codes 2023-07-03 23:12:51 +02:00
.dockerignore init 2023-06-21 23:31:47 +02:00
.envrc init 2023-06-21 23:31:47 +02:00
.gitignore add svg qr codes 2023-06-26 11:55:18 +02:00
.tool-versions init 2023-06-21 23:31:47 +02:00
CHANGELOG.md init 2023-06-21 23:31:47 +02:00
LICENSE init 2023-06-21 23:31:47 +02:00
MANIFEST.in init 2023-06-21 23:31:47 +02:00
README.md add svg qr codes 2023-06-26 11:55:18 +02:00
get_release_notes.sh init 2023-06-21 23:31:47 +02:00
justfile add lefthook and fix justfile 2023-06-22 09:14:38 +02:00
lefthook.yml add lefthook and fix justfile 2023-06-22 09:14:38 +02:00
pyproject.toml disable missing import error 2023-06-22 09:16:54 +02:00
renovate.json update renovate path 2023-12-05 13:38:41 +01:00
requirements.txt init 2023-06-21 23:31:47 +02:00
sonar-project.properties init 2023-06-21 23:31:47 +02:00

README.md

netbox-qrgen

NetBox plugin to generate QR codes for assets

Based on/inspired by: k01ek/netbox-qrcode

CI/CD

status-badge Last Release Version Version PyPi

Code Analysis

Quality Gate Status Bugs

Meta

Code style Linter Types License Compatibility


Description

test

Features (not complete)

  • Generate QR Codes for your assets
  • Download them either as PNG or SVG
  • Directly print them via the Web interface

Compatibility

This plugin requires Netbox version >=3.3 to work. (Older versions are not tested)

NetBox Version Plugin Version
3.3 >=0.0.1
3.4 >=0.0.1
3.5 >=0.0.1

Installing

Review the official Netbox plugin documentation for installation instructions.

With pip (pypi)

/opt/netbox/venv/bin/pip install --no-warn-script-location netbox-qrgen

In the Netbox docker container

For adding to a NetBox Docker setup see the general instructions for using netbox-docker with plugins.

FROM netboxcommunity/netbox:v3.5.4

RUN \
    && /opt/netbox/venv/bin/pip install --no-warn-script-location \
    netbox-qrgen

Configuration

PLUGINS = [
    'netbox_qrgen_'
]

# default settings
PLUGINS_CONFIG = {
    "netbox_qrgen": {
        "qr_with_text": True,
        "qr_text_fields": ["name", "serial"],
        "qr_font": "Tahoma",
        "qr_width": "200px",
        "qr_custom_text": None,
        "qr_text_location": "right",
        "qr_version": 2,
        "qr_error_correction": 1,
        "qr_box_size": 6,
        "qr_border_size": 4,
        "labels": {
            "dcim.cable": [
                "tenant",
                "a_terminations.device",
                "a_terminations.name",
                "b_terminations.device",
                "b_terminations.name",
            ],
            "dcim.rack": [
                "tenant",
                "site",
                "facility_id",
                "name",
            ],
            "dcim.device": ["tenant", "name", "serial"],
            "dcim.inventoryitem": ["tenant", "name", "serial"],
            "circuits.circuit": ["tenant", "name", "serial"],
        },
    },
}

Custom settings

Setting Type Default value Description
qr_with_text bool True Generate a text with the specified infos besides the QR code.
qr_text_fields list[str] ["name", "serial"] Fields to add as a text to the QR code. All object properties can be used.
qr_font str Tahoma Font to use to generate the text. Included fonts: ArialBlack,ArialMT,JetBrainsMono,JetBrainsMonoBold,Tahoma,TahomaBold.
qr_width str 200px Size for the SVG image to render. Can be any HTML valid size.
qr_custom_text str None Custom text to be added to every QR code.
qr_text_location str right Where the text fields are rendered relative to the QR code
qr_version int 2 An integer from 1 to 40 that controls the size of the QR Code (the smallest, version 1, is a 21x21 matrix). More details here
qr_error_correction int 1 Error corrector for the QR code. Available options: 1,2,3,4. See the package docs for more details. The integer mapping is here
qr_box_size int 6 Controls how many pixels each "box" of the QR code is
qr_border_size int 4 controls how many boxes thick the border should be (the default is 4, which is the minimum according to the specs).

Contribution / Bugs

For suggestions for improvement, just open a pull request.

If you encounter any bugs, also just open an issue with a description of the problem.

TODO's

  • test