-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
base: main
Are you sure you want to change the base?
Conversation
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. |
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. |
Well, can we unstale this, just nobody reviewed or answered... |
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. |
Adds support for printer configuration
There was a problem hiding this 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
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 oflabel_printer
andthermal_printer
options under thefeatures
section is well-implemented. This allows users to enable or disable these features as needed.
65-66
: The schema definitions forlabel_printer
andthermal_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 fortprinter_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 includelabel_printer
andthermal_printer
under thefeatures
section is clear and informative. It correctly guides the user on how to enable or disable these features.
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 |
There was a problem hiding this comment.
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.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in last commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
WalkthroughThe recent changes in Grocy introduce new configuration options for label and thermal printers, enhancing the add-on's printing capabilities. Documentation has been updated to include new sections detailing these features, including webhook configurations for label printers and requirements for thermal printers. Additionally, the PHP-FPM daemon script has been modified to incorporate new environment variables and conditional exports based on the printer configurations. Changes
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this 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
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
### 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 | ||
|
There was a problem hiding this comment.
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.
### 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`. |
There was a problem hiding this 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 forlabel_printer
andthermal_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
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
### 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 |
There was a problem hiding this comment.
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.
### 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>
Is there a problem blocking this PR from being merged? I bought a new label printer for Grocy and really want to use it. |
There was a problem hiding this 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
📒 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!
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
Configuration
Environment Variables