Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for printer configuration #422

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

valadas
Copy link

@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 options for Label Printer configuration, such as webhook URI and additional parameters.
    • Introduced Thermal Printer settings for network printer setup and receipt printing options.
  • Configuration

    • Updated configuration settings to accommodate new label and thermal printer options, including flags and schema changes.
  • Environment Variables

    • Added environment variables to handle label and thermal printer configurations based on user settings.

@valadas
Copy link
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.

Copy link

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
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
Copy link

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

@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.

grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run Outdated Show resolved Hide resolved
Comment on lines 102 to 145
if bashio::config.has_value 'tweaks.label_printer_webhook'; then
label_printer_webhook=$(bashio::config 'tweaks.label_printer_webhook')
export GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK=${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.true 'tweaks.tprinter_is_network_printer'; then
export GROCY_TPRINTER_IS_NETWORK_PRINTER=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_ip=$(bashio::config 'tweaks.tprinter_port')
export GROCY_TPRINTER_PORT=${tprinter_port}
fi

if bashio::config.has_value 'tweaks.tprinter_connector'; then
tprinter_connector=$(bashio::config 'tweaks.tprinter_connector')
export GROCY_TPRINTER_CONNECTOR=${tprinter_connector}
fi
Copy link

Choose a reason for hiding this comment

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

The handling of printer configuration values and their export as environment variables is well-implemented. However, there seems to be a copy-paste error on line 104 where GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK is mistakenly set to label_printer_webhook. This should be corrected.

- export GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK=${label_printer_webhook}
+ export GROCY_LABEL_PRINTER_WEBHOOK=${label_printer_webhook}

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.

Suggested change
if bashio::config.has_value 'tweaks.label_printer_webhook'; then
label_printer_webhook=$(bashio::config 'tweaks.label_printer_webhook')
export GROCY_MEAL_PLAN_FIRST_DAY_OF_WEEK=${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.true 'tweaks.tprinter_is_network_printer'; then
export GROCY_TPRINTER_IS_NETWORK_PRINTER=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_ip=$(bashio::config 'tweaks.tprinter_port')
export GROCY_TPRINTER_PORT=${tprinter_port}
fi
if bashio::config.has_value 'tweaks.tprinter_connector'; then
tprinter_connector=$(bashio::config 'tweaks.tprinter_connector')
export GROCY_TPRINTER_CONNECTOR=${tprinter_connector}
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.true 'tweaks.tprinter_is_network_printer'; then
export GROCY_TPRINTER_IS_NETWORK_PRINTER=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_ip=$(bashio::config 'tweaks.tprinter_port')
export GROCY_TPRINTER_PORT=${tprinter_port}
fi
if bashio::config.has_value 'tweaks.tprinter_connector'; then
tprinter_connector=$(bashio::config 'tweaks.tprinter_connector')
export GROCY_TPRINTER_CONNECTOR=${tprinter_connector}
fi

grocy/DOCS.md Outdated Show resolved Hide resolved
@hassio-addons hassio-addons unlocked this conversation May 20, 2024
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link

coderabbitai bot commented May 21, 2024

Warning

Rate Limit Exceeded

@valadas has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 34 minutes and 33 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between 84bc21d and 0fbc3fe.

Walkthrough

The recent changes in Grocy introduce new configuration options for label and thermal printers, enabling label printing via webhooks and configuring thermal printers for receipt printing. These updates are reflected in documentation, configuration files, and environment variable settings to support the enhanced printer functionalities.

Changes

File Path Change Summary
grocy/DOCS.md, grocy/config.yaml Added options and schema for label and thermal printers, including webhook configurations.
grocy/rootfs/.../s6-overlay/s6-rc.d/php-fpm/run Updated script to handle label and thermal printer configurations with new environment variables.

🐇
In Grocy's realm, printers now sing,
Labels and receipts, they bring.
Webhooks call, and thermal notes,
Configured well, they float like boats.
A rabbit's joy, in code's embrace,
Printing dreams fall into place.
🖨️✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

@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...

grocy/DOCS.md Outdated
Comment on lines 207 to 227
### 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
- `` TRUE to use JSON or FALSE to use normal POST request variables

### Option: `Thermal Printer`

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

- `tprinter_is_network_printer` Set to true if it's a 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 of the network printer (does only matter if it's a network printer)
- `tprinter_port` Port of the network printer (does only matter if it's a network printer)
- `tprinter_connector` Printer device (does only matter if you use a locally attached printer) For USB on Linux this is often '/dev/usb/lp0', for serial printers it could be similar to '/dev/ttyS0' Make sure that the user that runs the webserver has permissions to write to the printer - on Linux add your webserver user to the LP group with usermod -a -G lp www-data

Copy link

Choose a reason for hiding this comment

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

Update markdown formatting and refine the documentation for clarity.

- - `` 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

- the printer must support the ESC/POS protocol, see https://github.com/mike42/escpos-php
+ the printer must support the ESC/POS protocol, see [ESC/POS protocol](https://github.com/mike42/escpos-php)

- For USB on Linux this is often '/dev/usb/lp0', for serial printers it could be similar to '/dev/ttyS0' Make sure that the user that runs the webserver has permissions to write to the printer - on Linux add your webserver user to the LP group with usermod -a -G lp www-data
+ For USB on Linux, this is often '/dev/usb/lp0'. For serial printers, it could be similar to '/dev/ttyS0'. Ensure that the user who runs the webserver has permissions to write to the printer. On Linux, add your webserver user to the LP group with `usermod -a -G lp www-data`.

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.

Suggested change
### 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
- `` TRUE to use JSON or FALSE to use normal POST request variables
### Option: `Thermal Printer`
Thermal printers are receipt printers, not regular printers,
the printer must support the ESC/POS protocol, see https://github.com/mike42/escpos-php
- `tprinter_is_network_printer` Set to true if it's a 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 of the network printer (does only matter if it's a network printer)
- `tprinter_port` Port of the network printer (does only matter if it's a network printer)
- `tprinter_connector` Printer device (does only matter if you use a locally attached printer) For USB on Linux this is often '/dev/usb/lp0', for serial printers it could be similar to '/dev/ttyS0' Make sure that the user that runs the webserver has permissions to write to the printer - on Linux add your webserver user to the LP group with usermod -a -G lp www-data
### 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: `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)
- `tprinter_is_network_printer` Set to true if it's a 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 of the network printer (does only matter if it's a network printer)
- `tprinter_port` Port of the network printer (does only matter if it's a network printer)
- `tprinter_connector` Printer device (does only matter if you use a locally attached printer) For USB on Linux, this is often '/dev/usb/lp0'. For serial printers, it could be similar to '/dev/ttyS0'. Ensure that the user who runs the webserver has permissions to write to the printer. On Linux, add your webserver user to the LP group with `usermod -a -G lp www-data`.

Copy link

@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...

grocy/DOCS.md Outdated
Comment on lines 207 to 226
### 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: `Thermal Printer`

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

- `tprinter_is_network_printer` Set to true if it's a 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 of the network printer (does only matter if it's a network printer)
- `tprinter_port` Port of the network printer (does only matter if it's a network printer)
- `tprinter_connector` Printer device (does only matter if you use a locally attached printer) For USB on Linux this is often '/dev/usb/lp0', for serial printers it could be similar to '/dev/ttyS0' Make sure that the user that runs the webserver has permissions to write to the printer - on Linux add your webserver user to the LP group with usermod -a -G lp www-data
Copy link

Choose a reason for hiding this comment

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

Refine the documentation for clarity and correctness.

- Allows posting to a webhook to print labels
+ Allows posting to a webhook to print labels.

- the printer must support the ESC/POS protocol, see https://github.com/mike42/escpos-php
+ The printer must support the ESC/POS protocol, see [ESC/POS protocol](https://github.com/mike42/escpos-php).

- For USB on Linux this is often '/dev/usb/lp0', for serial printers it could be similar to '/dev/ttyS0' Make sure that the user that runs the webserver has permissions to write to the printer - on Linux add your webserver user to the LP group with usermod -a -G lp www-data
+ For USB on Linux, this is often '/dev/usb/lp0'. For serial printers, it could be similar to '/dev/ttyS0'. Ensure that the user who runs the webserver has permissions to write to the printer. On Linux, add your webserver user to the LP group with `usermod -a -G lp www-data`.

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.

Suggested change
### 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: `Thermal Printer`
Thermal printers are receipt printers, not regular printers,
the printer must support the ESC/POS protocol, see https://github.com/mike42/escpos-php
- `tprinter_is_network_printer` Set to true if it's a 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 of the network printer (does only matter if it's a network printer)
- `tprinter_port` Port of the network printer (does only matter if it's a network printer)
- `tprinter_connector` Printer device (does only matter if you use a locally attached printer) For USB on Linux this is often '/dev/usb/lp0', for serial printers it could be similar to '/dev/ttyS0' Make sure that the user that runs the webserver has permissions to write to the printer - on Linux add your webserver user to the LP group with usermod -a -G lp www-data
### 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: `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).
- `tprinter_is_network_printer` Set to true if it's a 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 of the network printer (does only matter if it's a network printer)
- `tprinter_port` Port of the network printer (does only matter if it's a network printer)
- `tprinter_connector` Printer device (does only matter if you use a locally attached printer) For USB on Linux, this is often '/dev/usb/lp0'. For serial printers, it could be similar to '/dev/ttyS0'. Ensure that the user who runs the webserver has permissions to write to the printer. On Linux, add your webserver user to the LP group with `usermod -a -G lp www-data`.

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
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.

None yet

2 participants