Skip to content

Add support for changing GrocyCode type#513

Open
lazytarget wants to merge 2 commits intohassio-addons:mainfrom
lazytarget:feature/configurable-grocycode-type
Open

Add support for changing GrocyCode type#513
lazytarget wants to merge 2 commits intohassio-addons:mainfrom
lazytarget:feature/configurable-grocycode-type

Conversation

@lazytarget
Copy link
Copy Markdown

@lazytarget lazytarget commented Feb 26, 2026

Proposed Changes

Adds support for changing GrocyCode type. Grocy has an existing environment variable for configuring but it is not exposed in the add-on.
This can be very useful if your scanner doesn't support 2D barcodes.

Related Issues

Seems like this has been discussed before in #333, however it was never implemented.

Summary by CodeRabbit

  • New Features

    • Added grocycode_type configuration option to select barcode types: 1D (Code128) or 2D (DataMatrix). Default is 2D.
  • Documentation

    • Updated documentation with details about the new barcode type configuration option and its supported values.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0cf172e and bc093af.

📒 Files selected for processing (1)
  • grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run
🚧 Files skipped from review as they are similar to previous changes (1)
  • grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run

Walkthrough

This PR introduces a new grocycode_type configuration option to select barcode formats (1D Code128 or 2D DataMatrix). It updates documentation and the config schema, and exports GROCY_GROCYCODE_TYPE from the php-fpm startup script so the setting is available at runtime.

Changes

Cohort / File(s) Summary
Configuration & Documentation
grocy/DOCS.md, grocy/config.yaml
Added grocycode_type option with allowed values 1D and 2D and documentation; schema updated to validate the new option and default to 2D.
Startup Integration
grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run
Reads grocycode_type from bashio config and exports it as GROCY_GROCYCODE_TYPE before exec so downstream processes can access the value.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 I found a code that hops with glee,
1D or 2D — now you choose for me.
Docs updated, a config set with care,
Startup exports it into the air.
Hop on, little barcode — bright and free!

🚥 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 'Add support for changing GrocyCode type' clearly and concisely describes the main change: exposing a configuration option to allow users to change the barcode type from 2D to 1D.
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.

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@grocy/rootfs/etc/s6-overlay/s6-rc.d/php-fpm/run`:
- Line 9: The script declares an unused shell variable grocycode_type and
assigns GROCY_GROCYCODE_TYPE without exporting it so php-fpm82 won't see it;
remove the unused declare grocycode_type and change the assignment to export
GROCY_GROCYCODE_TYPE (match the pattern used for
GROCY_CULTURE/GROCY_CURRENCY/GROCY_ENTRY_PAGE) so the environment variable is
exported into the php-fpm82 process.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 84c3853 and 0cf172e.

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

@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 29, 2026
@lazytarget
Copy link
Copy Markdown
Author

For anyone else looking for this feature right now. have setup my own Home Assistant repostory and forked this Grocy integration.

Grocy add-on fork:

Repos:

@valadas
Copy link
Copy Markdown

valadas commented Mar 29, 2026

@lazytarget that is awesome, if one would want to migrate the data, do you happen to know how to do it?

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

lazytarget commented Mar 31, 2026

@lazytarget that is awesome, if one would want to migrate the data, do you happen to know how to do it?

@valadas Could you try following this guide? Might be a little complicated depending on skill set.
Provided a Python script that could be useful. Please let me know how it goes and how I can make improvements :)

lazytarget-homeassistant-apps#12

@valadas
Copy link
Copy Markdown

valadas commented Apr 5, 2026

@lazytarget thanks for the detailed instructions. I first had to do a lot of upgrades to HA to even be able to add the repository. Then I could not find any folders in /mnt as I think that security features were added to HA to block some stuff. But the backup manipulation worked flawlessly and I am up and running. Thank you so much for this!

@lazytarget
Copy link
Copy Markdown
Author

@lazytarget thanks for the detailed instructions. I first had to do a lot of upgrades to HA to even be able to add the repository. Then I could not find any folders in /mnt as I think that security features were added to HA to block some stuff. But the backup manipulation worked flawlessly and I am up and running. Thank you so much for this!

Fantastic! So glad I could help ❤️

Just out of interest and potentially for other users, why did you have an issue to add the repo?
What Home Assistant version are/were you running?

@valadas
Copy link
Copy Markdown

valadas commented Apr 6, 2026

Oh boy I can't remember the exact version but it was at least 2 years old (home assistant OS and Core) and the issue was not specific to this repo, I also had it with the Portainer repo. It said something along the lines of not being able to add it due to OS minimum requirements or something something.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants