Skip to content

Adds support for printer configuration#422

Open
valadas wants to merge 11 commits intohassio-addons:mainfrom
valadas:grocy-print
Open

Adds support for printer configuration#422
valadas wants to merge 11 commits intohassio-addons:mainfrom
valadas:grocy-print

Conversation

@valadas
Copy link
Copy Markdown

@valadas valadas commented Jan 31, 2024

Proposed Changes

Adds support for printer configuration that grocy already supports but are not exposed in the add-on.

Related Issues

There was no issue for that, happy to create one if needed.

Summary by CodeRabbit

  • New Features

    • Added Label Printer and Thermal Printer feature toggles.
  • Configuration

    • New printer settings: label printer webhook/run-server option, hook params and JSON option; thermal printer network IP/port and options to print quantity names and notes.
  • Documentation

    • Expanded docs and known-issues to cover label and thermal printer setup and add-on/network limitations.

✏️ Tip: You can customize this high-level summary in your review settings.

@valadas
Copy link
Copy Markdown
Author

valadas commented Feb 8, 2024

Hi @frenck just wondering if everything is OK with this PR seeing as you have merged others... Don't hesitate to let me know if you spot any concerns, etc. and thanks for this great addon.

@github-actions
Copy link
Copy Markdown

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@github-actions github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label Mar 10, 2024
@valadas
Copy link
Copy Markdown
Author

valadas commented Mar 10, 2024

Well, can we unstale this, just nobody reviewed or answered...

@github-actions github-actions bot removed the stale There has not been activity on this issue or PR for quite some time. label Mar 11, 2024
@github-actions
Copy link
Copy Markdown

github-actions bot commented May 3, 2024

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@github-actions github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label May 3, 2024
@github-actions github-actions bot closed this May 10, 2024
@github-actions github-actions bot locked and limited conversation to collaborators May 11, 2024
@frenck frenck reopened this May 20, 2024
@frenck frenck added no-stale This issue or PR is exempted from the stable bot. and removed stale There has not been activity on this issue or PR for quite some time. labels May 20, 2024
Adds support for printer configuration
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 6ff0289 and b1a5a77.
Files selected for processing (3)
  • grocy/DOCS.md (2 hunks)
  • grocy/config.yaml (3 hunks)
  • grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run (3 hunks)
Additional Context Used
LanguageTool (16)
grocy/DOCS.md (16)

Near line 74: Loose punctuation mark.
Context: ...n issue. Possible values are: - trace: Show every detail, like all called inte...


Near line 75: Loose punctuation mark.
Context: ...all called internal functions. - debug: Shows detailed debug information. - `in...


Near line 76: Loose punctuation mark.
Context: ...ows detailed debug information. - info: Normal (usually) interesting events. - ...


Near line 77: Loose punctuation mark.
Context: ...usually) interesting events. - warning: Exceptional occurrences that are not er...


Near line 78: Loose punctuation mark.
Context: ...currences that are not errors. - error: Runtime errors that do not require imme...


Near line 79: Loose punctuation mark.
Context: ... not require immediate action. - fatal: Something went terribly wrong. Add-on b...


Near line 104: This sentence seems to be incomplete. Insert a noun before ‘Is’ to make the sentence complete.
Context: ...is the default_ ### Option: culture Is used for setting the language. Choose b...


Near line 144: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...on: entry_page Allows you to specify an custom homepage if desired. You can us...


Near line 146: Make sure that ‘the one of’ is correct and that ‘one’ is a pronoun. Possibly, the ‘the’ is unnecessary or ‘of’ is better expressed with a preposition such as ‘about’ or ‘in’.
Context: ...ustom homepage if desired. You can use the one of the following values: - batteries - ...


Near line 157: Did you mean: “By default,”?
Context: ...-shoppinglist-stock-tasks` By default the homepage is set to the stock overvi...


Near line 161: Possible missing preposition found.
Context: ...tock overview. ### Option: features Is used for enable or disable features in ...


Near line 162: The preposition ‘to’ seems more likely in this position.
Context: ...rview. ### Option: features Is used for enable or disable features in Grocy. Di...


Near line 226: Consider using “who” when you are referring to a person instead of an object.
Context: ...to '/dev/ttyS0' Make sure that the user that runs the webserver has permissions to w...


Near line 243: Loose punctuation mark.
Context: ...ented based on the following: - MAJOR: Incompatible or major changes. - `MINOR...


Near line 244: Loose punctuation mark.
Context: ...Incompatible or major changes. - MINOR: Backwards-compatible new features and e...


Near line 245: Loose punctuation mark.
Context: ...new features and enhancements. - PATCH: Backwards-compatible bugfixes and packa...

Additional comments not posted (6)
grocy/config.yaml (3)

36-37: The addition of label_printer and thermal_printer options under the features section is well-implemented. This allows users to enable or disable these features as needed.


65-66: The schema definitions for label_printer and thermal_printer as booleans are correctly added. This ensures that the configuration values for these features are validated as boolean types.


78-87: The schema additions for the new printer settings are comprehensive and well-detailed. However, ensure that the range for tprinter_port is appropriate and that the data types are consistent with the expected inputs.

grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run (2)

9-13: The declaration of variables related to printer configurations (label_printer_webhook, label_printer_params, tprinter_ip, tprinter_port, tprinter_connector) is correctly implemented. This prepares the script to handle these configurations effectively.


52-58: The conditional export of feature flags for label and thermal printers based on their configuration is correctly implemented. This ensures that the feature flags are only set when the features are enabled.

grocy/DOCS.md (1)

174-175: The documentation update to include label_printer and thermal_printer under the features section is clear and informative. It correctly guides the user on how to enable or disable these features.

@hassio-addons hassio-addons unlocked this conversation May 20, 2024
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented May 21, 2024

Walkthrough

Adds label and thermal printer configuration: docs updates, new feature toggles and tweak keys in config.yaml, and conditional environment-variable exports / feature flags in the PHP-FPM s6 run script to expose printer settings to the runtime.

Changes

Cohort / File(s) Summary
Documentation
grocy/DOCS.md
Added "Label Printer" and "Thermal Printer" documentation sections and notes about network-printer/add-on limitations; documents new tweak/options names and behaviour.
Configuration schema
grocy/config.yaml
Added feature toggles label_printer, thermal_printer and tweak keys: label_printer_webhook, label_printer_run_server, label_printer_params, label_printer_hook_json, tprinter_print_quantity_name, tprinter_print_notes, tprinter_ip, tprinter_port.
Runtime init script
grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run
Added local variables and conditional exports to set GROCY_FEATURE_FLAG_LABEL_PRINTER, GROCY_TPRINTER_IS_NETWORK_PRINTER, and GROCY_LABEL_PRINTER_* / GROCY_TPRINTER_* env vars based on features and tweaks before PHP-FPM startup.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Config as config.yaml
  participant Init as s6 php-fpm run
  participant Env as Environment
  participant App as Grocy PHP-FPM
  participant Printer as Label/Thermal Printer

  Note over Config,Init: Startup reads features & tweaks
  Config->>Init: feature toggles + tweak values (label_printer, thermal_printer, label_*, tprinter_*)
  Init->>Init: evaluate flags, set local vars, sanitize values
  Init->>Env: conditional export of GROCY_LABEL_PRINTER_* and GROCY_TPRINTER_*
  Env->>App: PHP-FPM inherits env
  alt label_printer enabled
    App->>Printer: invoke label webhook (params or JSON)
  end
  alt thermal_printer enabled
    App->>Printer: send ESC/POS job (network IP:PORT)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay extra attention to:
    • Validation and allowed range handling for tprinter_port.
    • Proper quoting/escaping when exporting label_printer_params and label_printer_hook_json.
    • Conditional export logic to avoid exporting empty values and ensure correct boolean handling of feature flags.

"I hopped through configs, tidy and spry,
Webhooks and receipts beneath the sky.
Tiny packets, ESC/POS hum,
Labels and notes — the printers come.
🐇🖨️"

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding printer configuration support. It is concise, clear, and directly related to all the modifications across config.yaml, DOCS.md, and the run script.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range and nitpick comments (4)
grocy/DOCS.md (4)

Line range hint 144-146: Clarify the language for setting a custom homepage.

- Allows you to specify an custom homepage if desired.
+ Allows you to specify a custom homepage if desired.

- You can use the one of the following values:
+ You can use one of the following values:

Line range hint 157-157: Clarify default setting language.

- By default the homepage is set to the stock overview.
+ By default, the homepage is set to the stock overview.

Line range hint 161-161: Improve grammar in feature description.

- Is used for enable or disable features in Grocy.
+ Is used to enable or disable features in Grocy.

Line range hint 104-104: Clarify language setting description.

- Is used for setting the language.
+ Is used to set the language.
Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 6ff0289 and 372c259.
Files selected for processing (3)
  • grocy/DOCS.md (2 hunks)
  • grocy/config.yaml (3 hunks)
  • grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run (3 hunks)
Files skipped from review as they are similar to previous changes (2)
  • grocy/config.yaml
  • grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run
Additional Context Used
LanguageTool (15)
grocy/DOCS.md (15)

Near line 74: Loose punctuation mark.
Context: ...n issue. Possible values are: - trace: Show every detail, like all called inte...


Near line 75: Loose punctuation mark.
Context: ...all called internal functions. - debug: Shows detailed debug information. - `in...


Near line 76: Loose punctuation mark.
Context: ...ows detailed debug information. - info: Normal (usually) interesting events. - ...


Near line 77: Loose punctuation mark.
Context: ...usually) interesting events. - warning: Exceptional occurrences that are not er...


Near line 78: Loose punctuation mark.
Context: ...currences that are not errors. - error: Runtime errors that do not require imme...


Near line 79: Loose punctuation mark.
Context: ... not require immediate action. - fatal: Something went terribly wrong. Add-on b...


Near line 104: This sentence seems to be incomplete. Insert a noun before ‘Is’ to make the sentence complete.
Context: ...is the default_ ### Option: culture Is used for setting the language. Choose b...


Near line 144: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...on: entry_page Allows you to specify an custom homepage if desired. You can us...


Near line 146: Make sure that ‘the one of’ is correct and that ‘one’ is a pronoun. Possibly, the ‘the’ is unnecessary or ‘of’ is better expressed with a preposition such as ‘about’ or ‘in’.
Context: ...ustom homepage if desired. You can use the one of the following values: - batteries - ...


Near line 157: Did you mean: “By default,”?
Context: ...-shoppinglist-stock-tasks` By default the homepage is set to the stock overvi...


Near line 161: This sentence seems to be incomplete. Insert a noun before ‘Is’ to make the sentence complete.
Context: ...tock overview. ### Option: features Is used for enable or disable features in ...


Near line 226: Consider using “who” when you are referring to a person instead of an object.
Context: ...to '/dev/ttyS0' Make sure that the user that runs the webserver has permissions to w...


Near line 243: Loose punctuation mark.
Context: ...ented based on the following: - MAJOR: Incompatible or major changes. - `MINOR...


Near line 244: Loose punctuation mark.
Context: ...Incompatible or major changes. - MINOR: Backwards-compatible new features and e...


Near line 245: Loose punctuation mark.
Context: ...new features and enhancements. - PATCH: Backwards-compatible bugfixes and packa...

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range and nitpick comments (5)
grocy/DOCS.md (5)

174-175: Add a brief description for label_printer and thermal_printer options.

It would enhance clarity to include a brief description of what these options do, similar to other feature descriptions in the document.


Line range hint 144-146: Correct grammatical errors in the documentation.

- Allows you to specify an custom homepage if desired.
+ Allows you to specify a custom homepage if desired.

- You can use the one of the following values:
+ You can use one of the following values:

Line range hint 157-157: Clarify the default setting description.

- By default the homepage is set to the stock overview.
+ By default, the homepage is set to the stock overview.

Line range hint 161-161: Improve the sentence structure for feature options.

- Is used for enable or disable features in Grocy.
+ This option is used to enable or disable features in Grocy.

Line range hint 104-104: Clarify the language option description.

- Is used for setting the language.
+ This option is used for setting the language.
Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 372c259 and 84bc21d.
Files selected for processing (1)
  • grocy/DOCS.md (2 hunks)
Additional Context Used
LanguageTool (15)
grocy/DOCS.md (15)

Near line 74: Loose punctuation mark.
Context: ...n issue. Possible values are: - trace: Show every detail, like all called inte...


Near line 75: Loose punctuation mark.
Context: ...all called internal functions. - debug: Shows detailed debug information. - `in...


Near line 76: Loose punctuation mark.
Context: ...ows detailed debug information. - info: Normal (usually) interesting events. - ...


Near line 77: Loose punctuation mark.
Context: ...usually) interesting events. - warning: Exceptional occurrences that are not er...


Near line 78: Loose punctuation mark.
Context: ...currences that are not errors. - error: Runtime errors that do not require imme...


Near line 79: Loose punctuation mark.
Context: ... not require immediate action. - fatal: Something went terribly wrong. Add-on b...


Near line 104: This sentence seems to be incomplete. Insert a noun before ‘Is’ to make the sentence complete.
Context: ...is the default_ ### Option: culture Is used for setting the language. Choose b...


Near line 144: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...on: entry_page Allows you to specify an custom homepage if desired. You can us...


Near line 146: Make sure that ‘the one of’ is correct and that ‘one’ is a pronoun. Possibly, the ‘the’ is unnecessary or ‘of’ is better expressed with a preposition such as ‘about’ or ‘in’.
Context: ...ustom homepage if desired. You can use the one of the following values: - batteries - ...


Near line 157: Did you mean: “By default,”?
Context: ...-shoppinglist-stock-tasks` By default the homepage is set to the stock overvi...


Near line 161: This sentence seems to be incomplete. Insert a noun before ‘Is’ to make the sentence complete.
Context: ...tock overview. ### Option: features Is used for enable or disable features in ...


Near line 226: Consider using “who” when you are referring to a person instead of an object.
Context: ...to '/dev/ttyS0' Make sure that the user that runs the webserver has permissions to w...


Near line 242: Loose punctuation mark.
Context: ...ented based on the following: - MAJOR: Incompatible or major changes. - `MINOR...


Near line 243: Loose punctuation mark.
Context: ...Incompatible or major changes. - MINOR: Backwards-compatible new features and e...


Near line 244: Loose punctuation mark.
Context: ...new features and enhancements. - PATCH: Backwards-compatible bugfixes and packa...

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@frenck frenck added the new-feature New features or options. label May 21, 2024
@saya6k
Copy link
Copy Markdown

saya6k commented Oct 13, 2024

Is there a problem blocking this PR from being merged? I bought a new label printer for Grocy and really want to use it.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run (2)

9-13: Consider prefixing all environment variables consistently.

Currently, label printer environment variables are prefixed sometimes with “LABEL_PRINTER_” (e.g., LABEL_PRINTER_WEBHOOK) and sometimes with “GROCY_LABEL_PRINTER_” (e.g., GROCY_LABEL_PRINTER_RUN_SERVER). Similarly, the thermal printer feature flag is missing the “GROCY_” prefix. This mismatch may cause confusion.


52-59: Align naming conventions of feature flags.

The label printer feature flag is exported as “GROCY_FEATURE_FLAG_LABEL_PRINTER,” while the thermal printer feature flag is exported as “FEATURE_FLAG_THERMAL_PRINTER.” For consistency, consider using the same prefix.

grocy/DOCS.md (1)

218-226: Minor grammar improvement suggestion: use “who” instead of “that.”

In “the user that runs the webserver,” consider using “who” for better clarity.

Proposed edit:

- Make sure that the user that runs the webserver has permissions
+ Make sure that the user who runs the webserver has permissions
🧰 Tools
🪛 LanguageTool

[style] ~226-~226: Consider using “who” when you are referring to a person instead of an object.
Context: ...to '/dev/ttyS0' Make sure that the user that runs the webserver has permissions to w...

(THAT_WHO)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 84bc21d and 0cb55af.

📒 Files selected for processing (2)
  • grocy/DOCS.md (2 hunks)
  • grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run (3 hunks)
🧰 Additional context used
🪛 LanguageTool
grocy/DOCS.md

[style] ~226-~226: Consider using “who” when you are referring to a person instead of an object.
Context: ...to '/dev/ttyS0' Make sure that the user that runs the webserver has permissions to w...

(THAT_WHO)

🔇 Additional comments (5)
grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run (3)

102-105: Good addition for label printer integration.

This logic dynamically sets and exports the webhook environment variable for label printing. Straightforward and clear.


120-145: Thermal printer environment variables look consistent.

The conditionals to set different parameters (IP, port, connector) are clean and straightforward. Nicely done!


116-118: Verify JSON vs. form-data usage.

Ensure that external code or scripts checking this variable handle the difference between JSON and form-data correctly, to avoid unexpected parsing errors on the receiving side.

grocy/DOCS.md (2)

174-175: Feature flags successfully documented.

The references to label_printer and thermal_printer under “features” are clear, ensuring users can easily enable or disable them.


207-215: Comprehensive documentation for label printer configuration.

The step-by-step explanation of each parameter (webhook, run_server, additional params) helps users set up label printing easily. Good job!

@123marvin123
Copy link
Copy Markdown

Is there a specific reason why this isn't merged yet?

@npasslick
Copy link
Copy Markdown

@frenck Something missing for the merge?

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0cb55af and f86723c.

📒 Files selected for processing (2)
  • grocy/DOCS.md (2 hunks)
  • grocy/config.yaml (3 hunks)
🧰 Additional context used
🪛 LanguageTool
grocy/DOCS.md

[style] ~226-~226: Consider using “who” when you are referring to a person instead of an object.
Context: ...to '/dev/ttyS0' Make sure that the user that runs the webserver has permissions to w...

(THAT_WHO)

🔇 Additional comments (3)
grocy/config.yaml (1)

34-35: Configuration structure looks solid.

The printer feature toggles and tweaks are properly defined with consistent naming, correct schema types, and valid ranges. The port validation int(1,65535)? follows best practices.

Also applies to: 63-64, 76-85

grocy/DOCS.md (2)

174-175: Feature list documentation is clean.

The new printer features are properly added to the features list following existing format.


207-225: Printer documentation is clear and well-structured.

Good use of markdown link for ESC/POS protocol reference, and the option descriptions are detailed and helpful.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for label printer and thermal printer configuration options that grocy already supports but were not previously exposed in the Home Assistant add-on.

Key changes:

  • Added feature flags for label printer and thermal printer with configurable options
  • Exposed printer-related environment variables to grocy via the PHP-FPM run script
  • Added comprehensive documentation for both printer types

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run Added environment variable exports for label printer and thermal printer configuration options
grocy/config.yaml Added schema and default values for label printer and thermal printer features and their respective tweak options
grocy/DOCS.md Added documentation sections describing label printer and thermal printer configuration parameters

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run (1)

9-12: Printer tweak env wiring looks good; verify webhook env var name

The new declarations and exports for printer tweaks (GROCY_LABEL_PRINTER_RUN_SERVER, GROCY_LABEL_PRINTER_PARAMS, GROCY_LABEL_PRINTER_HOOK_JSON, GROCY_TPRINTER_IP, GROCY_TPRINTER_PORT, quantity-name and notes flags) are consistent with config.yaml and follow the existing pattern for other tweaks. That part looks solid.

One thing to double-check is the name of the webhook variable:

label_printer_webhook=$(bashio::config 'tweaks.label_printer_webhook')
export LABEL_PRINTER_WEBHOOK=${label_printer_webhook}

Given the rest of the env naming (GROCY_*), you may actually want:

-if bashio::config.has_value 'tweaks.label_printer_webhook'; then
-    label_printer_webhook=$(bashio::config 'tweaks.label_printer_webhook')
-    export LABEL_PRINTER_WEBHOOK=${label_printer_webhook}
-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

assuming Grocy reads GROCY_LABEL_PRINTER_WEBHOOK like the other settings. Please confirm against the upstream Grocy config/env docs before changing.

Which env var does Grocy use for the label printer webhook: `LABEL_PRINTER_WEBHOOK` or `GROCY_LABEL_PRINTER_WEBHOOK`?

Also applies to: 102-136

🧹 Nitpick comments (2)
grocy/DOCS.md (1)

207-227: Optional doc polish for printer option bullets

The content is accurate, but you could tighten wording and punctuation for consistency with the rest of the doc (colon after option names, clearer wording on server/client side). For example:

-### 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
+### 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 is called server-side (from the add-on container) or client-side (from the browser).
+- `label_printer_params`: Additional parameters supplied to the webhook.
+- `label_printer_hook_json`: Set to `true` to use JSON, or `false` to use form-encoded POST variables.
@@
-- `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
+- `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 address of the network printer.
+- `tprinter_port`: TCP port of the network printer.

Purely cosmetic; feel free to keep as-is if you prefer.

grocy/config.yaml (1)

76-83: Consider making printer tweak fields optional or providing defaults

These printer-related tweak fields are required in the schema (str/bool/int(...) without ?) but have no defaults under options.tweaks. That can make configuration noisy for users who never enable printer features, and the runtime already handles “unset” reasonably via bashio::config.has_value/true/false.

Consider either:

  • Marking them optional, e.g.:
    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?
    tprinter_port: int(1,65535)?
    or
  • Adding sane defaults to options.tweaks so the required fields are always populated.

This would better match the pattern used for other optional tweaks like calendar_first_day_of_week.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f86723c and c7a862e.

📒 Files selected for processing (3)
  • grocy/DOCS.md (2 hunks)
  • grocy/config.yaml (3 hunks)
  • grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run (3 hunks)
🔇 Additional comments (3)
grocy/DOCS.md (1)

174-175: Printer feature flags documentation aligns with config and runtime

The added label_printer and thermal_printer entries in the features list match the new options/schema fields and the startup script wiring. No issues here.

grocy/config.yaml (1)

34-35: Printer feature toggles are wired consistently

options.features.label_printer/thermal_printer and the corresponding schema.features booleans are consistent and match the new runtime checks in the PHP-FPM run script. Defaulting both to false is a safe choice.

Also applies to: 63-64

grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run (1)

51-58: Original review comment is incorrect—the code is already using Grocy's correct naming convention.

The correct environment variable name is FEATURE_FLAG_THERMAL_PRINTER (without GROCY_ prefix), as confirmed by Grocy's configuration documentation and changelog. The PR code already uses the correct name. Changing it to GROCY_FEATURE_FLAG_THERMAL_PRINTER would break the feature.

Likely an incorrect or invalid review comment.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c7a862e and c4b3a99.

📒 Files selected for processing (1)
  • grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Agent
  • GitHub Check: workflows / Build aarch64
  • GitHub Check: workflows / Build amd64
🔇 Additional comments (6)
grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run (6)

9-12: LGTM!

Variable declarations for printer configuration are properly declared and follow the existing pattern in the script.


102-105: LGTM!

Label printer webhook configuration is correctly retrieved and exported.


107-114: LGTM!

Label printer run server flag and params configuration are correctly implemented.


116-118: LGTM!

Label printer hook JSON configuration is correctly implemented.


120-136: LGTM!

All thermal printer configuration exports are correctly implemented and follow the established patterns.


51-53: Code pattern is correct—label printer feature defaults to disabled.

The default for GROCY_FEATURE_FLAG_LABEL_PRINTER is disabled (false), which aligns with the opt-in pattern used here. The code correctly enables the feature only when explicitly configured as true.

@ryan-winkler
Copy link
Copy Markdown

How is this going? Would love to use this @frenck @valadas !

valadas and others added 2 commits January 31, 2026 12:57
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@valadas
Copy link
Copy Markdown
Author

valadas commented Jan 31, 2026

How is this going? Would love to use this @frenck @valadas !

I just applied all copilot suggestions, I do not have permissions to do anything more though (merge/release), so we just need to wait.

@lazytarget
Copy link
Copy Markdown

Hey, due to the high inactivity here. I have setup my own Home Assistant repostory and forked this Grocy integration.
Please have a look and feel free to create a PR against it :)

I am keen on keeping this repo alive and up to date with the latest versions. Feels wrong that currently everyone has to make their own fork to update to the latest version. I'm currently quite invested in my own Grocy ecosystem, so I would like it updated.

Grocy add-on fork:

Repos:

@lazytarget
Copy link
Copy Markdown

@valadas Successfully verified your changes and implemented them in my fork :)
lazytarget-homeassistant-apps#10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature New features or options. no-stale This issue or PR is exempted from the stable bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants