Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions grocy/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ or disabled:
- `shoppinglist`
- `stock`
- `tasks`
- `label_printer`
- `thermal_printer`

Set it `true` to enable it, `false` otherwise.

Expand Down Expand Up @@ -202,6 +204,27 @@ Allows you to specify a default ingress user if desired (e.g. `admin`).

If no ingress user is set, the default login authentication is used.

### Option: `Label Printer`

Allows posting to a webhook to print labels

- `label_printer_webhook` The URI that Grocy will POST to when asked to print a label
- `label_printer_run_server` Whether the webhook will be called server- or client-side
- `label_printer_params` Additional parameters supplied to the webhook
- `label_printer_hook_json`: TRUE to use JSON or FALSE to use normal POST request variables
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The formatting is inconsistent with other list items in the same section. Lines 211-213 use a plain description format without a colon, but this line includes a colon separator. For consistency, either remove the colon and reformat to match lines 211-213, or add colons to the other items.

Suggested change
- `label_printer_hook_json`: TRUE to use JSON or FALSE to use normal POST request variables
- `label_printer_hook_json` TRUE to use JSON or FALSE to use normal POST request variables

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch


### Option: `Thermal Printer`

Thermal printers are receipt printers, not regular printers,
the printer must support the ESC/POS protocol, see [ESC/POS protocol](https://github.com/mike42/escpos-php)

**Note:** Only network printers are supported when running as a Home Assistant add-on. Direct USB/serial printer connections are not available in the containerized environment.

- `tprinter_print_quantity_name` Set to false if you do not want to print the quantity names (related to the shopping list)
- `tprinter_print_notes` Set to false if you do not want to print notes (related to the shopping list)
- `tprinter_ip` IP of the network printer
- `tprinter_port` Port of the network printer

## Known issues and limitations

- Grocy support to provide custom lookup resources to lookup information
Expand Down
12 changes: 12 additions & 0 deletions grocy/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ options:
shoppinglist: true
stock: true
tasks: true
label_printer: false
thermal_printer: false
tweaks:
chores_assignment: true
multiple_shopping_lists: true
Expand Down Expand Up @@ -58,6 +60,8 @@ schema:
shoppinglist: bool
stock: bool
tasks: bool
label_printer: bool
thermal_printer: bool
tweaks:
calendar_first_day_of_week: int(0,6)?
chores_assignment: bool
Expand All @@ -69,6 +73,14 @@ schema:
stock_product_freezing: bool
stock_product_opened_tracking: bool
stock_count_opened_products_against_minimum_stock_amount: bool
label_printer_webhook: str
label_printer_run_server: bool
label_printer_params: str
label_printer_hook_json: bool
tprinter_print_quantity_name: bool
tprinter_print_notes: bool
tprinter_ip: str
Comment on lines +76 to +82
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The schema fields label_printer_webhook, label_printer_params, tprinter_ip, label_printer_run_server, label_printer_hook_json, tprinter_print_quantity_name, and tprinter_print_notes are defined as required fields (no ? suffix) but have no default values in the options section. This will cause validation errors when users don't provide these optional printer settings. Consider marking these as optional with str? and bool? or providing default values in the options section.

Suggested change
label_printer_webhook: str
label_printer_run_server: bool
label_printer_params: str
label_printer_hook_json: bool
tprinter_print_quantity_name: bool
tprinter_print_notes: bool
tprinter_ip: str
label_printer_webhook: str?
label_printer_run_server: bool?
label_printer_params: str?
label_printer_hook_json: bool?
tprinter_print_quantity_name: bool?
tprinter_print_notes: bool?
tprinter_ip: str?

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense to me.

tprinter_port: int(1,65535)?
ssl: bool
certfile: str
keyfile: str
Expand Down
49 changes: 49 additions & 0 deletions grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
# ==============================================================================
declare caldayweek
declare mealday
declare label_printer_webhook
declare label_printer_params
declare tprinter_ip
declare tprinter_port
export GROCY_CULTURE
export GROCY_CURRENCY
export GROCY_ENTRY_PAGE
Expand Down Expand Up @@ -44,6 +48,15 @@ if bashio::config.false 'features.tasks'; then
export GROCY_FEATURE_FLAG_TASKS=0
fi

if bashio::config.true 'features.label_printer'; then
export GROCY_FEATURE_FLAG_LABEL_PRINTER=1
fi

if bashio::config.true 'features.thermal_printer'; then
export FEATURE_FLAG_THERMAL_PRINTER=1
export GROCY_TPRINTER_IS_NETWORK_PRINTER=1
fi
Comment on lines +55 to +58
Copy link

@coderabbitai coderabbitai bot Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

Fix the feature flag naming convention.

Line 56 exports FEATURE_FLAG_THERMAL_PRINTER without the GROCY_ prefix, which is inconsistent with all other feature flags in the file (e.g., GROCY_FEATURE_FLAG_BATTERIES, GROCY_FEATURE_FLAG_CALENDAR, GROCY_FEATURE_FLAG_LABEL_PRINTER).

Apply this diff to fix the naming convention:

 if bashio::config.true 'features.thermal_printer'; then
-    export FEATURE_FLAG_THERMAL_PRINTER=1
+    export GROCY_FEATURE_FLAG_THERMAL_PRINTER=1
     export GROCY_TPRINTER_IS_NETWORK_PRINTER=1
 fi

Please also verify that Grocy expects GROCY_FEATURE_FLAG_THERMAL_PRINTER and that the opt-in pattern (setting to 1 when enabled) matches Grocy's default behavior.


🌐 Web query:

What is the correct environment variable name for thermal printer feature flag in Grocy?

💡 Result:

The feature flag is FEATURE_FLAG_THERMAL_PRINTER — exposed as an environment variable with the GROCY_ prefix, i.e. GROCY_FEATURE_FLAG_THERMAL_PRINTER. [1][2][3]

Sources:

  • Grocy changelog (feature flag name). [1]
  • grocy config (env var prefix GROCY_). [2]
  • config-dist.php (TPRINTER / feature-flag settings). [3]

Fix the feature flag naming convention.

Line 56 exports FEATURE_FLAG_THERMAL_PRINTER without the GROCY_ prefix, which is incorrect. The correct environment variable name is GROCY_FEATURE_FLAG_THERMAL_PRINTER, consistent with all other feature flags in the file.

Apply this diff:

 if bashio::config.true 'features.thermal_printer'; then
-    export FEATURE_FLAG_THERMAL_PRINTER=1
+    export GROCY_FEATURE_FLAG_THERMAL_PRINTER=1
     export GROCY_TPRINTER_IS_NETWORK_PRINTER=1
 fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if bashio::config.true 'features.thermal_printer'; then
export FEATURE_FLAG_THERMAL_PRINTER=1
export GROCY_TPRINTER_IS_NETWORK_PRINTER=1
fi
if bashio::config.true 'features.thermal_printer'; then
export GROCY_FEATURE_FLAG_THERMAL_PRINTER=1
export GROCY_TPRINTER_IS_NETWORK_PRINTER=1
fi
🤖 Prompt for AI Agents
In grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run around lines 55 to 58, the
feature flag is exported as FEATURE_FLAG_THERMAL_PRINTER but should follow the
GROCY_ prefix convention; change the exported environment variable name to
GROCY_FEATURE_FLAG_THERMAL_PRINTER (and keep export
GROCY_TPRINTER_IS_NETWORK_PRINTER=1) so it matches the other feature flags in
the file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opps missed one, I agree with this suggestion

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@valadas, thank you for confirming! Looking forward to seeing this fixed in the next update. 👍


if bashio::config.has_value 'tweaks.calendar_first_day_of_week'; then
caldayweek=$(bashio::config 'tweaks.calendar_first_day_of_week')
export GROCY_CALENDAR_FIRST_DAY_OF_WEEK=${caldayweek}
Expand Down Expand Up @@ -86,6 +99,42 @@ if bashio::config.false 'tweaks.stock_count_opened_products_against_minimum_stoc
export GROCY_FEATURE_SETTING_STOCK_COUNT_OPENED_PRODUCTS_AGAINST_MINIMUM_STOCK_AMOUNT=0
fi

if bashio::config.has_value 'tweaks.label_printer_webhook'; then
label_printer_webhook=$(bashio::config 'tweaks.label_printer_webhook')
export GROCY_LABEL_PRINTER_WEBHOOK=${label_printer_webhook}
fi

if bashio::config.false 'tweaks.label_printer_run_server'; then
export GROCY_LABEL_PRINTER_RUN_SERVER=0
fi

if bashio::config.has_value 'tweaks.label_printer_params'; then
label_printer_params=$(bashio::config 'tweaks.label_printer_params')
export GROCY_LABEL_PRINTER_PARAMS=${label_printer_params}
fi

if bashio::config.true 'tweaks.label_printer_hook_json'; then
export GROCY_LABEL_PRINTER_HOOK_JSON=1
fi

if bashio::config.false 'tweaks.tprinter_print_quantity_name'; then
export GROCY_TPRINTER_PRINT_QUANTITY_NAME=0
fi

if bashio::config.false 'tweaks.tprinter_print_notes'; then
export GROCY_TPRINTER_PRINT_NOTES=0
fi

if bashio::config.has_value 'tweaks.tprinter_ip'; then
tprinter_ip=$(bashio::config 'tweaks.tprinter_ip')
export GROCY_TPRINTER_IP=${tprinter_ip}
fi

if bashio::config.has_value 'tweaks.tprinter_port'; then
tprinter_port=$(bashio::config 'tweaks.tprinter_port')
export GROCY_TPRINTER_PORT=${tprinter_port}
fi

GROCY_CULTURE=$(bashio::config "culture")
GROCY_CURRENCY=$(bashio::config "currency")
GROCY_ENTRY_PAGE=$(bashio::config 'entry_page')
Expand Down