-
Notifications
You must be signed in to change notification settings - Fork 0
Add initial code for QR ACS integration #38
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
base: main
Are you sure you want to change the base?
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds a Telegraf bridge config, an exec helper script, and a README to forward FixedIT QR Code Decoder JSON detections (via a Unix domain socket) into AXIS Camera Station's ExternalDataFacade API with per-detection processing and posting. Changes
Sequence Diagram(s)sequenceDiagram
participant Decoder as QR Code Decoder (ACAP)
participant Socket as Unix Domain Socket
participant Telegraf as Telegraf Agent
participant Script as post_to_acs.sh
participant ACS as AXIS Camera Station API
Decoder->>Socket: Write JSON detection (decoded_data, coords, timestamp, type)
Socket->>Telegraf: Deliver message to socket_listener input
Telegraf->>Telegraf: Parse json_v2, flatten fields, tag source
Telegraf->>Telegraf: Starlark processor computes code_position_size
Telegraf->>Script: Exec each detection, pass JSON on stdin
Script->>Script: Validate env vars, extract fields, format timestamp
Script->>Script: Build addExternalDataRequest payload (jq)
Script->>ACS: POST payload to /ExternalDataFacade (basic auth)
ACS-->>Script: Return HTTP status and body
Script-->>Telegraf: Exit status returned to exec output
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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). (1)
Comment |
🎨 Code Formatting RequiredPrettier Formatting IssuesSome files need to be formatted with Prettier (JSON, YAML, Markdown). Files that need prettier formatting:
To fix prettier issues: npx [email protected] --write "**/*.{json,yml,yaml,md}" ".github/**/*.{json,yml,yaml,md}" ".*.{yml,yaml,json,md}" --ignore-unknownTrailing Whitespace IssuesSome files have trailing whitespace (spaces/tabs at end of lines). Files with trailing whitespace:
To fix: Remove the trailing spaces/tabs at the end of lines in your favorite editor. Markdown Table of Contents IssuesSome markdown files need their table of contents updated. Files that need TOC updates:
To fix TOC issues:
After fixing:
|
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: 3
🧹 Nitpick comments (3)
project-qr-code-decoder-axis-camera-station/post_to_acs.sh (2)
126-132:\nescape in printf may not be portable across all shells.Using
\ndirectly in printf format strings may not work consistently across all POSIX shells. Some shells require$'...'syntax or actual newlines.Consider using separate printf calls or actual newlines:
if [ -n "$_err_curl_error" ]; then - printf "\nCurl error: %s" "$_err_curl_error" >&2 + printf "\n" >&2 + printf "Curl error: %s" "$_err_curl_error" >&2 fi if [ -n "$_err_response_body" ]; then - printf "\nResponse: %s" "$_err_response_body" >&2 + printf "\n" >&2 + printf "Response: %s" "$_err_response_body" >&2 fi
136-138: Avoid logging sensitive context near password variable.Line 137 logs
ACS_USERNAMEalongside the debug context. While the password isn't directly logged, having the username in debug logs and the password variable in the same log statement pattern could encourage future modifications that accidentally log credentials.Consider separating sensitive variable context:
debug_log_file "Starting post_to_acs.sh script" -debug_log_file "Environment variables - ACS_SERVER_IP: $ACS_SERVER_IP, ACS_USERNAME: $ACS_USERNAME, DEBUG: $DEBUG" +debug_log_file "Environment variables - ACS_SERVER_IP: $ACS_SERVER_IP, DEBUG: $DEBUG" +debug_log_file "Authentication configured for user: $ACS_USERNAME"project-qr-code-decoder-axis-camera-station/combined.conf (1)
85-100: Verifydisable_prepend_keysbehavior with nested JSON.The comment on lines 90-93 mentions referencing fields "as if
disable_prepend_keyswas not set" for tags, but only"source"is listed which is a top-level field, not a nested one. This is correct, but the comment might be confusing sincesourcedoesn't get affected bydisable_prepend_keysanyway (it's already at the top level).Consider simplifying the comment to avoid confusion:
- # Mark which values should be used as tags. Note that we need to reference - # them as if 'disable_prepend_keys' was not set, but the names will be - # changed before sending them so that e.g. "message_pid" becomes a tag - # called "pid". + # Mark which values should be used as tags. + # The "source" field from the top-level JSON becomes a tag. tags = ["source"]
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
project-qr-code-decoder-axis-camera-station/README.md(1 hunks)project-qr-code-decoder-axis-camera-station/combined.conf(1 hunks)project-qr-code-decoder-axis-camera-station/post_to_acs.sh(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
project-*/**
⚙️ CodeRabbit configuration file
project-*/**: Each example project for the FixedIT Data Agent should be self-contained and designed as a standalone example / tutorial showing how to use the FixedIT Data Agent. The project should be well documented and include all the necessary files to run the example. A reader should be able to understand the background and the purpose of the project, and be able to understand the implementation details and how to use it. If the project includes a dashboard, it should be placed in a new folder in the repo-root/dashboard-deployments/ directory instead of being included in the project folder. In the README for the project, the first time the FixedIT Data Agent is mentioned, we should link to the product page: https://fixedit.ai/products-data-agent/ Emphasize that these solutions are accessible to system integrators and IT professionals without requiring complex C/C++ ACAP development. Highlight that custom edge intelligence can be implemented using familiar IT tools (configuration files, shell scripts, REST APIs) rather than traditional embedded programming approaches. Note that bash does not exist on the Axis devices, so .sh scripts should be written in portable shell syntax.
README Structure: All project README files should follow the standardized template at.project_readme_template.md. This template ensures consistent documentation that serves both audiences: (1) IT professionals who want plug-and-play solutions, and (2) developers who want to customize and extend the examples. The template enforces a logical structure: 1) Introduction and background (project purpose, how it works, why choose this approach) 2) Technical explanation and quick start guide (compatibility, setup, troubleshooting) 3) Developer-oriented notes (local testing, implementation details)
Key README Requirements: - Include compatibility sections for both AXIS OS and FixedIT Data Agent versions - Explain host testing and its limitations and why certain parts require actual Axis d...
Files:
project-qr-code-decoder-axis-camera-station/post_to_acs.shproject-qr-code-decoder-axis-camera-station/README.mdproject-qr-code-decoder-axis-camera-station/combined.conf
project-*/**/*.sh
⚙️ CodeRabbit configuration file
project-*/**/*.sh: Shell scripts should be written in portable shell (/bin/sh) syntax since bash is not installed on the Axis devices. Sincelocalis not supported in all cameras (like AXIS OS 9.80), it should be avoided unless the AXIS OS limitations are explicitly mentioned. If not usinglocal, it can be good to use a function specific prefix for the variable names to avoid conflicts with other variables.
Clearly document in the head of the file which environment variables they expect and if they are optional or required.
It's normally good to useset -eufor stricter error handling, but-o pipefailis not supported in the Axis devices' shell.
When an error occurs in a helper script that is used with the exec or execd plugin of Telegraf, then the script should at minimum log an descriptive error message to stderr and exit with a non-zero error code. The exit code should be unique enough to identify the problem type and the error codes should be documented in the top of the script. When errors are logged to stderr, Telegraf will only show the first line that was logged followed by three dots. Therefore, a longer line might make more sense than multiple shorter lines. The error logs should not end with a newline.
It is also good if the script respects theTELEGRAF_DEBUGvariable, and if this is set to "true", then the script should log debug messages to a file in theHELPER_FILES_DIRwith the .debug suffix. This log can be more verbose and make use of multiple lines. When TELEGRAF_DEBUG is not set, logging to file should not be enabled since it can fill the flash storage or wear out the storage chip.
Files:
project-qr-code-decoder-axis-camera-station/post_to_acs.sh
**/*
⚙️ CodeRabbit configuration file
This repository serves FixedIT Data Agent users across a spectrum from plug-and-play dashboard deployment to advanced edge device customization. Consider whether changes maintain accessibility for both DevOps professionals (server-side focus) and developers (edge customization focus). If new features are added or existing ones changed significantly, ensure documentation clearly explains the intended audience and usage level. We use prettier for formatting of common file formats like markdown, yaml, json, etc. Example projects should be placed in the repo-root in a directory named project-*/. Whenever referencing Axis device model names like "D4100-VE mk II" or "M3045", prefix it with "AXIS" in capital letters (e.g. "AXIS D4100-VE mk II"). When using Axis as a company name, use "Axis Communications", note that all-caps is only used when "AXIS" is used in their product names, not their company name. When using the name of an Axis product, google on the name to verify that it is correctly identified. Avoid using 'cameras' or 'Axis cameras' unless the solution in related to visual analytics, otherwise prefer using 'Axis devices' to show that the FixedIT Data Agent also works with strobes, speakers, door stations, etc. Images used for the README should be placed in a directory called .images/ in the affected project folder. These images might also be referred to from other sources like the top-level README.md file.
Files:
project-qr-code-decoder-axis-camera-station/post_to_acs.shproject-qr-code-decoder-axis-camera-station/README.mdproject-qr-code-decoder-axis-camera-station/combined.conf
**/*.md
⚙️ CodeRabbit configuration file
**/*.md: Documentation files should clearly communicate the dual audience: (1) server-side dashboard users who want to keep agent with bundled configs, and (2) edge device developers who want to customize agent behavior. Ensure examples and instructions are appropriate for the intended skill level and use case. Since this is a public repository, we should not include any sensitive information, the instructions should be easily understandable for a wide audience, and we should avoid using any jargon or technical terms that are not commonly used.
Headings should not include special characters like emojis or backticks. The table of contents should be generated with themarkdown-toctool, meaning that we should use the<!-- toc -->and<!-- tocstop -->tags.
Files:
project-qr-code-decoder-axis-camera-station/README.md
🧠 Learnings (4)
📓 Common learnings
Learnt from: daniel-falk
Repo: fixedit-ai/fixedit-data-agent-examples PR: 26
File: project-qr-code-decoder-http-push/API_SPEC.md:123-126
Timestamp: 2025-10-15T16:17:59.932Z
Learning: In FixedIT Data Agent integrations, device serial numbers (device_serial) and precise geolocation data (latitude/longitude) are commonly included in tags for internal integration purposes, specifically to identify which sensor/device detected the code or event. This is an expected and legitimate use case for internal systems.
Learnt from: daniel-falk
Repo: fixedit-ai/fixedit-data-agent-examples PR: 18
File: dashboard-deployments/system-monitoring-influxdb2-flux-grafana/provisioning/dashboards/overview_of_devices.json:1121-1130
Timestamp: 2025-09-03T14:18:52.406Z
Learning: When fixing unit mismatches in Grafana dashboards, daniel-falk prefers changing the panel unit configuration to match the data rather than transforming the query values, choosing simplicity over data conversion when both approaches are valid.
📚 Learning: 2025-08-10T14:54:48.316Z
Learnt from: daniel-falk
Repo: fixedit-ai/fixedit-data-agent-examples PR: 5
File: project-strobe-color-from-github-workflow/README.md:350-351
Timestamp: 2025-08-10T14:54:48.316Z
Learning: In the fixedit-data-agent-examples repository, shell portability requirements (such as Axis devices using POSIX /bin/sh instead of bash) should be documented in a general scripting guide rather than repeated in individual project README files. This approach was confirmed by daniel-falk for better documentation organization.
Applied to files:
project-qr-code-decoder-axis-camera-station/post_to_acs.sh
📚 Learning: 2025-10-16T16:49:09.181Z
Learnt from: daniel-falk
Repo: fixedit-ai/fixedit-data-agent-examples PR: 5
File: project-strobe-color-from-github-workflow/trigger_strobe.sh:130-135
Timestamp: 2025-10-16T16:49:09.181Z
Learning: In shell scripts for Axis devices (dash/shell), when extracting JSON fields with jq, use the pattern `if ! field="$(printf '%s\n' "$json_var" | jq -re '.path.to.field? // empty')"; then` instead of simple assignment `field=$(echo "$json_var" | jq -r '.path.to.field')`. This provides better error handling: `printf` is more portable than `echo`, the `-e` flag makes jq exit with error if no output, and `? // empty` safely handles missing fields.
Applied to files:
project-qr-code-decoder-axis-camera-station/post_to_acs.sh
📚 Learning: 2025-11-07T15:57:47.716Z
Learnt from: daniel-falk
Repo: fixedit-ai/fixedit-data-agent-examples PR: 26
File: project-qr-code-decoder-http-push/combined.conf:190-190
Timestamp: 2025-11-07T15:57:47.716Z
Learning: In project-qr-code-decoder-http-push/combined.conf (and similar Telegraf config files with embedded Starlark code), comments within Starlark source strings intentionally avoid apostrophes (e.g., "Dont" instead of "Don't") because single quotes break syntax highlighting in VS Code.
Applied to files:
project-qr-code-decoder-axis-camera-station/combined.conf
⏰ 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). (1)
- GitHub Check: Cursor Bugbot
🔇 Additional comments (6)
project-qr-code-decoder-axis-camera-station/post_to_acs.sh (4)
59-66: Good use of function-specific variable prefixes.The use of
_dbg_log_prefix for thedebug_log_filefunction and similar prefixes throughout the script (_check_,_err_,_api_) follows the coding guidelines for avoiding variable name conflicts without usinglocal(which isn't portable to older AXIS OS versions).
159-182: Good use of the recommended jq pattern for field extraction.The pattern using
printf '%s\n'withjq -reand? // emptyfollows the learned best practice for portable, error-safe JSON field extraction in shell scripts. Based on learnings, this approach provides better error handling than simple assignment.
194-200:date -d "@timestamp"is supported in modern BusyBox (since version 1.19+).The comment claiming that BusyBox does not support Unix timestamp format with the @ prefix is incorrect—this feature has been supported since at least BusyBox 1.19. The syntax
date -d "@$_decoded_time"should work on any reasonably modern Axis device that uses a current BusyBox version.While it's true that the
-doption differs between GNU date and some other implementations, BusyBox has had robust support for this syntax for many years. The suggested fix with fallback patterns is unnecessary complexity.If there are concerns about compatibility with very specific older Axis firmware, that should be validated against actual device specifications rather than assumed. Document any minimum AXIS OS version requirements if relevant.
244-244: Verifymktempavailability on Axis devices.The
mktempcommand may not be available on all Axis devices. Consider adding a fallback or checking availability.#!/bin/bash # Check how other scripts in the repo handle temporary files rg -n "mktemp" --type shproject-qr-code-decoder-axis-camera-station/combined.conf (2)
102-141: Well-structured Starlark processor.The Starlark code is clean and follows the learning about avoiding apostrophes in comments (e.g., "Dont" instead of "Don't") for VS Code syntax highlighting compatibility. The helper functions
has_allandto_whole_percentimprove readability, and the rounding logic usingint(normalized_value * 100 + 0.5)correctly implements rounding to nearest integer.
143-175: Good configuration for real-time processing.The exec output configuration properly:
- Uses
metric_batch_size = 1for immediate per-detection processing- Disables batch format to send single JSON objects
- Sets a 10-second timeout to prevent hanging scripts
- Filters with
namepassto only process relevant metricsThis configuration aligns well with the real-time requirements of a QR code detection system.
| _err_curl_error=$(cat "$_err_stderr_file" 2>/dev/null) | ||
| rm -f "$_err_stderr_file" | ||
| 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.
Clean up stderr file on success path.
The $_api_stderr_file temporary file is only removed in the error path (log_api_error), but not when the API call succeeds. This leaves temporary files behind on each successful execution.
Add cleanup after the success check:
# Check if API call has errors
if has_api_error "$_api_exit" "$_api_http_code"; then
log_api_error "$_api_stderr_file" "$_api_exit" "$_api_http_code" "$_api_response_body" "$_api_url"
fi
+
+# Clean up stderr file on success
+rm -f "$_api_stderr_file" 2>/dev/null || true
debug_log_file "ACS API call successful - HTTP status: $_api_http_code, Response: $_api_response_body"Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In project-qr-code-decoder-axis-camera-station/post_to_acs.sh around lines 98 to
100, the temporary stderr file used for the API call (named _err_stderr_file in
this block; ensure this matches any other occurrences like _api_stderr_file) is
only removed in the error path and left behind on success; after you capture
_err_curl_error (or the stderr content) on the success path, add a cleanup call
to remove the temp file (rm -f "$_err_stderr_file" or the correct variable name)
so the temp file is deleted whether the call succeeds or fails, and ensure this
removal happens before returning/continuing.
| # AXIS Camera Station Integration for the FixedIT QR Code Decoder | ||
|
|
||
| This example uses the [FixedIT Data Agent](https://fixedit.ai/products-data-agent/) to consume QR or barcode detections from the FixedIT QR Code Decoder ACAP application and push them to the external data sources in the AXIS Camera Station VMS. | ||
|
|
||
| ## How It Works | ||
|
|
||
| The FixedIT QR Code Decoder ACAP application has the capability to write each detected code as a JSON message to a Unix domain socket. We make use of this in the FixedIT Data Agent and uses the `inputs.socket_listener` plugin to read the messages from the socket. | ||
|
|
||
| TODO | ||
|
|
||
| ### AXIS OS Compatibility | ||
|
|
||
| - **Minimum AXIS OS version**: Any version of AXIS OS that supports the FixedIT QR Code Decoder ACAP application and the FixedIT Data Agent. | ||
| - **Commands used**: TODO | ||
|
|
||
| ### FixedIT Data Agent Compatibility | ||
|
|
||
| - **Minimum Data Agent version**: Any version. | ||
|
|
||
| ## Quick Setup | ||
|
|
||
| TODO | ||
|
|
||
| ## Configuration | ||
|
|
||
| TODO No newline at end of file |
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.
README is incomplete and missing required template structure.
Per the coding guidelines, this README should follow the standardized template at .project_readme_template.md. The current state has several issues:
- Missing table of contents: Add
<!-- toc -->and<!-- tocstop -->markers for markdown-toc generation. - Missing product page link: The first mention of "FixedIT Data Agent" on line 3 should link to the product page.
- Multiple TODO placeholders: Lines 9, 14, 22, and 26 contain incomplete sections.
- Missing required sections: Troubleshooting, local testing/host testing limitations, implementation details, and a mermaid diagram explaining the system flow.
Consider updating line 3 to include the product page link properly:
-This example uses the [FixedIT Data Agent](https://fixedit.ai/products-data-agent/) to consume QR or barcode detections from the FixedIT QR Code Decoder ACAP application and push them to the external data sources in the AXIS Camera Station VMS.
+This example uses the [FixedIT Data Agent](https://fixedit.ai/products-data-agent/) to consume QR or barcode detections from the FixedIT QR Code Decoder ACAP application and push them to the external data sources in the AXIS Camera Station VMS.The link is already present, but the README needs the full template structure including:
- Table of contents
- Compatibility sections (already partially present)
- Quick setup with complete instructions
- Troubleshooting section
- Developer-oriented notes for local testing
- Mermaid diagram showing the data flow
As per coding guidelines, the README should serve both IT professionals wanting plug-and-play solutions and developers wanting to customize.
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In project-qr-code-decoder-axis-camera-station/README.md lines 1-26, the README
is incomplete and doesn't follow the .project_readme_template.md: add TOC
markers <!-- toc --> and <!-- tocstop --> after the title, ensure the first
mention of "FixedIT Data Agent" at line 3 includes the official product page
link (replace or augment the existing link if needed), replace all TODO
placeholders (lines 9, 14, 22, 26) with concrete content from the template
(Quick Setup steps, Commands used, Compatibility details), and add the missing
required sections (Troubleshooting, Local/host testing limitations,
Implementation details/developer notes) plus a Mermaid diagram illustrating the
system flow; keep language suitable for both IT operators and developers and
follow the template ordering and headings exactly.
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.
TODO
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.
@daniel-falk, understood! I'll keep track of the README completion as you work through the TODOs. Feel free to mention me again once you'd like me to review the completed sections.
🧠 Learnings used
Learnt from: daniel-falk
Repo: fixedit-ai/fixedit-data-agent-examples PR: 5
File: project-strobe-color-from-github-workflow/README.md:57-62
Timestamp: 2025-08-07T15:23:05.927Z
Learning: In the fixedit-ai/fixedit-data-agent-examples repository, when GitHub generates anchors for headings that contain backticks with spaces around them (like `### `filename` - Description`), it removes the backticks but preserves those spaces as dashes in the anchor, creating triple dashes (---) between the filename and description parts. TOC generators may not handle this correctly and need manual adjustment.
Learnt from: daniel-falk
Repo: fixedit-ai/fixedit-data-agent-examples PR: 24
File: README.md:31-34
Timestamp: 2025-10-15T11:33:37.276Z
Learning: In the fixedit-ai/fixedit-data-agent-examples repository, prefer automatic TOC generation using `<!-- toc
Learnt from: daniel-falk
Repo: fixedit-ai/fixedit-data-agent-examples PR: 5
File: project-strobe-color-from-github-workflow/README.md:350-351
Timestamp: 2025-08-10T14:54:48.316Z
Learning: In the fixedit-data-agent-examples repository, shell portability requirements (such as Axis devices using POSIX /bin/sh instead of bash) should be documented in a general scripting guide rather than repeated in individual project README files. This approach was confirmed by daniel-falk for better documentation organization.
Learnt from: daniel-falk
Repo: fixedit-ai/fixedit-data-agent-examples PR: 18
File: dashboard-deployments/system-monitoring-influxdb2-flux-grafana/provisioning/dashboards/overview_of_devices.json:1121-1130
Timestamp: 2025-09-03T14:18:52.406Z
Learning: When fixing unit mismatches in Grafana dashboards, daniel-falk prefers changing the panel unit configuration to match the data rather than transforming the query values, choosing simplicity over data conversion when both approaches are valid.
| "externalDataType": $externalDataType, | ||
| "data": { | ||
| "Decoded Value": $decodedValue, | ||
| "Decoded at Time": $decodedTime, |
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.
Remove "Decoded at Time" since we have occurrenceTime already set to the frame capture time
🎨 Code Formatting RequiredPrettier Formatting IssuesSome files need to be formatted with Prettier (JSON, YAML, Markdown). Files that need prettier formatting:
To fix prettier issues: npx [email protected] --write "**/*.{json,yml,yaml,md}" ".github/**/*.{json,yml,yaml,md}" ".*.{yml,yaml,json,md}" --ignore-unknownTrailing Whitespace IssuesSome files have trailing whitespace (spaces/tabs at end of lines). Files with trailing whitespace:
To fix: Remove the trailing spaces/tabs at the end of lines in your favorite editor. Markdown Table of Contents IssuesSome markdown files need their table of contents updated. Files that need TOC updates:
To fix TOC issues:
After fixing:
|
🎨 Code Formatting RequiredTrailing Whitespace IssuesSome files have trailing whitespace (spaces/tabs at end of lines). Files with trailing whitespace:
To fix: Remove the trailing spaces/tabs at the end of lines in your favorite editor. After fixing:
|
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
♻️ Duplicate comments (1)
project-qr-code-decoder-axis-camera-station/qr-acs-bridge.conf (1)
48-50: Trailing comma makes the JSON example invalid.This was flagged in a previous review. The trailing comma after
"pid": "1805635"makes the example invalid JSON, which could confuse readers.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
project-qr-code-decoder-axis-camera-station/README.md(1 hunks)project-qr-code-decoder-axis-camera-station/qr-acs-bridge.conf(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- project-qr-code-decoder-axis-camera-station/README.md
🧰 Additional context used
📓 Path-based instructions (2)
project-*/**
⚙️ CodeRabbit configuration file
project-*/**: Each example project for the FixedIT Data Agent should be self-contained and designed as a standalone example / tutorial showing how to use the FixedIT Data Agent. The project should be well documented and include all the necessary files to run the example. A reader should be able to understand the background and the purpose of the project, and be able to understand the implementation details and how to use it. If the project includes a dashboard, it should be placed in a new folder in the repo-root/dashboard-deployments/ directory instead of being included in the project folder. In the README for the project, the first time the FixedIT Data Agent is mentioned, we should link to the product page: https://fixedit.ai/products-data-agent/ Emphasize that these solutions are accessible to system integrators and IT professionals without requiring complex C/C++ ACAP development. Highlight that custom edge intelligence can be implemented using familiar IT tools (configuration files, shell scripts, REST APIs) rather than traditional embedded programming approaches. Note that bash does not exist on the Axis devices, so .sh scripts should be written in portable shell syntax.
README Structure: All project README files should follow the standardized template at.project_readme_template.md. This template ensures consistent documentation that serves both audiences: (1) IT professionals who want plug-and-play solutions, and (2) developers who want to customize and extend the examples. The template enforces a logical structure: 1) Introduction and background (project purpose, how it works, why choose this approach) 2) Technical explanation and quick start guide (compatibility, setup, troubleshooting) 3) Developer-oriented notes (local testing, implementation details)
Key README Requirements: - Include compatibility sections for both AXIS OS and FixedIT Data Agent versions - Explain host testing and its limitations and why certain parts require actual Axis d...
Files:
project-qr-code-decoder-axis-camera-station/qr-acs-bridge.conf
**/*
⚙️ CodeRabbit configuration file
This repository serves FixedIT Data Agent users across a spectrum from plug-and-play dashboard deployment to advanced edge device customization. Consider whether changes maintain accessibility for both DevOps professionals (server-side focus) and developers (edge customization focus). If new features are added or existing ones changed significantly, ensure documentation clearly explains the intended audience and usage level. We use prettier for formatting of common file formats like markdown, yaml, json, etc. Example projects should be placed in the repo-root in a directory named project-*/. Whenever referencing Axis device model names like "D4100-VE mk II" or "M3045", prefix it with "AXIS" in capital letters (e.g. "AXIS D4100-VE mk II"). When using Axis as a company name, use "Axis Communications", note that all-caps is only used when "AXIS" is used in their product names, not their company name. When using the name of an Axis product, google on the name to verify that it is correctly identified. Avoid using 'cameras' or 'Axis cameras' unless the solution in related to visual analytics, otherwise prefer using 'Axis devices' to show that the FixedIT Data Agent also works with strobes, speakers, door stations, etc. Images used for the README should be placed in a directory called .images/ in the affected project folder. These images might also be referred to from other sources like the top-level README.md file.
Files:
project-qr-code-decoder-axis-camera-station/qr-acs-bridge.conf
🧠 Learnings (1)
📓 Common learnings
Learnt from: daniel-falk
Repo: fixedit-ai/fixedit-data-agent-examples PR: 18
File: dashboard-deployments/system-monitoring-influxdb2-flux-grafana/provisioning/dashboards/overview_of_devices.json:1121-1130
Timestamp: 2025-09-03T14:18:52.406Z
Learning: When fixing unit mismatches in Grafana dashboards, daniel-falk prefers changing the panel unit configuration to match the data rather than transforming the query values, choosing simplicity over data conversion when both approaches are valid.
⏰ 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). (1)
- GitHub Check: Cursor Bugbot
🔇 Additional comments (4)
project-qr-code-decoder-axis-camera-station/qr-acs-bridge.conf (4)
21-30: LGTM!The agent configuration is well-documented with sensible defaults. The
metric_buffer_limitof 10000 provides good resilience for temporary network outages without excessive memory usage.
53-100: LGTM!The socket listener configuration is well-structured:
- Sensible socket permissions (0664) for dynamic user access
- Appropriate buffer size for QR code payloads
- Correct JSON parsing with field flattening via
disable_prepend_keys
102-141: LGTM!The Starlark processor is well-implemented:
- Clean helper functions with proper None checking
- Correct rounding logic for percentage conversion (necessary since Starlark lacks
round())- Graceful handling when normalized coordinates are missing
143-175: LGTM!The exec output configuration is well-designed for real-time processing:
- Individual metric processing ensures immediate alerts
- 10-second timeout provides robustness against script hangs
- Good documentation explaining the design decisions
The combination of
metric_batch_size = 1with the agent'smetric_buffer_limit = 10000provides appropriate backpressure handling if the ACS server becomes temporarily unavailable.
| # - ACS_SOURCE: Source identifier for the data (required) | ||
| # - ACS_USERNAME: Username for basic authentication (required) | ||
| # - ACS_PASSWORD: Password for basic authentication (required) | ||
| # - HELPER_FILES_DIR: Directory for debug log files (required, set automatically by the FixedIT Data Agent) |
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.
Incorrect description for HELPER_FILES_DIR.
The comment states this is "Directory for debug log files" but it's actually the directory containing helper scripts like post_to_acs.sh (used on line 155).
Suggested fix
-# - HELPER_FILES_DIR: Directory for debug log files (required, set automatically by the FixedIT Data Agent)
+# - HELPER_FILES_DIR: Directory containing helper scripts (required, set automatically by the FixedIT Data Agent)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # - HELPER_FILES_DIR: Directory for debug log files (required, set automatically by the FixedIT Data Agent) | |
| # - HELPER_FILES_DIR: Directory containing helper scripts (required, set automatically by the FixedIT Data Agent) |
🤖 Prompt for AI Agents
In project-qr-code-decoder-axis-camera-station/qr-acs-bridge.conf around line
15, the comment for HELPER_FILES_DIR incorrectly says "Directory for debug log
files"; change it to accurately describe that HELPER_FILES_DIR is the directory
containing helper scripts (e.g., post_to_acs.sh) used by the agent (referenced
on line 155). Update the single-line comment to mention helper scripts and an
example filename so future readers know its purpose.
6e3e510 to
ade9cb5
Compare
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: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
project-qr-code-decoder-axis-camera-station/post_to_acs.sh(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
project-*/**
⚙️ CodeRabbit configuration file
project-*/**: Each example project for the FixedIT Data Agent should be self-contained and designed as a standalone example / tutorial showing how to use the FixedIT Data Agent. The project should be well documented and include all the necessary files to run the example. A reader should be able to understand the background and the purpose of the project, and be able to understand the implementation details and how to use it. If the project includes a dashboard, it should be placed in a new folder in the repo-root/dashboard-deployments/ directory instead of being included in the project folder. In the README for the project, the first time the FixedIT Data Agent is mentioned, we should link to the product page: https://fixedit.ai/products-data-agent/ Emphasize that these solutions are accessible to system integrators and IT professionals without requiring complex C/C++ ACAP development. Highlight that custom edge intelligence can be implemented using familiar IT tools (configuration files, shell scripts, REST APIs) rather than traditional embedded programming approaches. Note that bash does not exist on the Axis devices, so .sh scripts should be written in portable shell syntax.
README Structure: All project README files should follow the standardized template at.project_readme_template.md. This template ensures consistent documentation that serves both audiences: (1) IT professionals who want plug-and-play solutions, and (2) developers who want to customize and extend the examples. The template enforces a logical structure: 1) Introduction and background (project purpose, how it works, why choose this approach) 2) Technical explanation and quick start guide (compatibility, setup, troubleshooting) 3) Developer-oriented notes (local testing, implementation details)
Key README Requirements: - Include compatibility sections for both AXIS OS and FixedIT Data Agent versions - Explain host testing and its limitations and why certain parts require actual Axis d...
Files:
project-qr-code-decoder-axis-camera-station/post_to_acs.sh
project-*/**/*.sh
⚙️ CodeRabbit configuration file
project-*/**/*.sh: Shell scripts should be written in portable shell (/bin/sh) syntax since bash is not installed on the Axis devices. Sincelocalis not supported in all cameras (like AXIS OS 9.80), it should be avoided unless the AXIS OS limitations are explicitly mentioned. If not usinglocal, it can be good to use a function specific prefix for the variable names to avoid conflicts with other variables.
Clearly document in the head of the file which environment variables they expect and if they are optional or required.
It's normally good to useset -eufor stricter error handling, but-o pipefailis not supported in the Axis devices' shell.
When an error occurs in a helper script that is used with the exec or execd plugin of Telegraf, then the script should at minimum log an descriptive error message to stderr and exit with a non-zero error code. The exit code should be unique enough to identify the problem type and the error codes should be documented in the top of the script. When errors are logged to stderr, Telegraf will only show the first line that was logged followed by three dots. Therefore, a longer line might make more sense than multiple shorter lines. The error logs should not end with a newline.
It is also good if the script respects theTELEGRAF_DEBUGvariable, and if this is set to "true", then the script should log debug messages to a file in theHELPER_FILES_DIRwith the .debug suffix. This log can be more verbose and make use of multiple lines. When TELEGRAF_DEBUG is not set, logging to file should not be enabled since it can fill the flash storage or wear out the storage chip.
Files:
project-qr-code-decoder-axis-camera-station/post_to_acs.sh
**/*
⚙️ CodeRabbit configuration file
This repository serves FixedIT Data Agent users across a spectrum from plug-and-play dashboard deployment to advanced edge device customization. Consider whether changes maintain accessibility for both DevOps professionals (server-side focus) and developers (edge customization focus). If new features are added or existing ones changed significantly, ensure documentation clearly explains the intended audience and usage level. We use prettier for formatting of common file formats like markdown, yaml, json, etc. Example projects should be placed in the repo-root in a directory named project-*/. Whenever referencing Axis device model names like "D4100-VE mk II" or "M3045", prefix it with "AXIS" in capital letters (e.g. "AXIS D4100-VE mk II"). When using Axis as a company name, use "Axis Communications", note that all-caps is only used when "AXIS" is used in their product names, not their company name. When using the name of an Axis product, google on the name to verify that it is correctly identified. Avoid using 'cameras' or 'Axis cameras' unless the solution in related to visual analytics, otherwise prefer using 'Axis devices' to show that the FixedIT Data Agent also works with strobes, speakers, door stations, etc. Images used for the README should be placed in a directory called .images/ in the affected project folder. These images might also be referred to from other sources like the top-level README.md file.
Files:
project-qr-code-decoder-axis-camera-station/post_to_acs.sh
🧠 Learnings (2)
📓 Common learnings
Learnt from: daniel-falk
Repo: fixedit-ai/fixedit-data-agent-examples PR: 18
File: dashboard-deployments/system-monitoring-influxdb2-flux-grafana/provisioning/dashboards/overview_of_devices.json:1121-1130
Timestamp: 2025-09-03T14:18:52.406Z
Learning: When fixing unit mismatches in Grafana dashboards, daniel-falk prefers changing the panel unit configuration to match the data rather than transforming the query values, choosing simplicity over data conversion when both approaches are valid.
📚 Learning: 2025-08-10T14:54:48.316Z
Learnt from: daniel-falk
Repo: fixedit-ai/fixedit-data-agent-examples PR: 5
File: project-strobe-color-from-github-workflow/README.md:350-351
Timestamp: 2025-08-10T14:54:48.316Z
Learning: In the fixedit-data-agent-examples repository, shell portability requirements (such as Axis devices using POSIX /bin/sh instead of bash) should be documented in a general scripting guide rather than repeated in individual project README files. This approach was confirmed by daniel-falk for better documentation organization.
Applied to files:
project-qr-code-decoder-axis-camera-station/post_to_acs.sh
⏰ 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). (1)
- GitHub Check: Cursor Bugbot
🔇 Additional comments (7)
project-qr-code-decoder-axis-camera-station/post_to_acs.sh (7)
1-46: LGTM! Clean documentation and validation.The script header clearly documents all environment variables (required and optional) and error codes. The validation logic properly checks required variables and outputs descriptive error messages to stderr without trailing newlines, following the guidelines for Telegraf exec scripts.
60-66: Cleanup trap is correctly implemented.The temporary file cleanup is properly handled by the
trap cleanup EXIT INT TERMat line 66. The cleanup function will execute on any exit path (success at line 270, errors at lines 35, 40, 45, 141, 150, 164, 171, 177, 183, 189, 197, 207, 241). The previous review comments claiming the temp file isn't cleaned up on success are incorrect.
68-75: LGTM! Proper debug logging implementation.The function correctly avoids the
localkeyword (not supported on all Axis devices per guidelines), uses function-specific variable prefixes, respects theTELEGRAF_DEBUGenvironment variable, and handles logging errors gracefully.
77-94: LGTM! Robust error detection logic.The function properly detects both curl exit code errors and HTTP status code errors, with appropriate handling for non-numeric HTTP codes.
96-142: LGTM! Comprehensive error reporting.The function provides helpful, context-specific error messages for different failure scenarios (SSL verification, connection failures, HTTP errors) and properly formats multi-line error output following the guidelines for Telegraf exec scripts.
220-242: LGTM! Safe JSON payload construction.Using
jqto build the JSON payload is the right approach - it properly escapes special characters and prevents injection issues. The payload structure matches the ACS ExternalDataFacade API requirements withoccurrenceTimeat the top level and detection details in thedataobject.
246-270: LGTM! Robust API call implementation.The curl invocation properly handles authentication, content-type headers, SSL verification options, and error capture. Response parsing correctly extracts the HTTP status code and body. Error handling delegates to the comprehensive
log_api_errorfunction, and cleanup is managed by the trap set earlier.
| # Convert Unix timestamp to ACS format "YYYY-MM-DD HH:MM:SS" | ||
| # The frame_timestamp is in seconds since epoch | ||
| if ! _occurrence_time=$(date -d "@$_decoded_time" '+%Y-%m-%d %H:%M:%S' 2>/dev/null); then | ||
| debug_log_file "ERROR: Failed to format timestamp: $_decoded_time" | ||
| printf "Error: Failed to format timestamp '%s'" "$_decoded_time" >&2 | ||
| exit 13 | ||
| fi | ||
| debug_log_file "Formatted timestamp: $_occurrence_time" |
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.
Fix date -d compatibility for BusyBox on Axis devices.
The date -d "@$_decoded_time" syntax on line 204 is GNU-specific and not supported by BusyBox, where epoch seconds do not fall under the category of a valid input time format. Since this script must run on Axis devices that use BusyBox, this will fail in production. BusyBox date recognizes only specific time formats like hh:mm[:ss], YYYY-MM-DD hh:mm[:ss], and [[[[[YY]YY]MM]DD]hh]mm[.ss], not the @seconds notation. Replace this with a portable approach compatible with BusyBox's date command, such as converting the Unix timestamp to a recognized format first or using an alternative method to format the date string.
🤖 Prompt for AI Agents
In project-qr-code-decoder-axis-camera-station/post_to_acs.sh around lines 202
to 209, the script uses the GNU-only form date -d "@$_decoded_time" which fails
on BusyBox; replace it with the BusyBox-compatible epoch option (date -r) and
preserve the same format and error handling — e.g. use if !
_occurrence_time=$(date -r "$_decoded_time" '+%Y-%m-%d %H:%M:%S' 2>/dev/null);
then ... fi — so the timestamp formatting works on Axis devices running BusyBox.
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.
It is supported, at least on the new devices. But we might need to look at older devices to verify.
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.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for other date command usage patterns in shell scripts
echo "=== Date command usage in other shell scripts ==="
rg -n 'date.*-[dr]' --type sh -C 2
echo -e "\n=== AXIS OS compatibility mentions in README files ==="
rg -n 'AXIS OS|BusyBox' --type md -C 2
echo -e "\n=== Check if this project has compatibility documentation ==="
fd -t f 'README.md' project-qr-code-decoder-axis-camera-station --exec cat {}
Length of output: 7430
🏁 Script executed:
#!/bin/bash
# Search for any BusyBox version or compatibility documentation
echo "=== Search for BusyBox mentions in the repository ==="
rg -i 'busybox' -C 2
echo -e "\n=== Search for older AXIS OS version mentions (9.x, 10.x) ==="
rg -i 'axis os (9|10)\.' -C 2
echo -e "\n=== Search for date command documentation or comments ==="
rg -n 'date.*command|timestamp.*format' --type sh -C 3
Length of output: 1043
@daniel-falk, that makes sense! Since it works on newer devices, it's worth verifying the minimum AXIS OS version this project will support before deciding whether to change it.
Here are a few ways to verify:
-
Test on target devices: If you have access to older Axis devices (AXIS OS 9.x or 10.x), you could test this command directly:
date -d "@1734710400" '+%Y-%m-%d %H:%M:%S'
-
Check BusyBox version: On the device, check
busybox date --helpto see if the@notation is documented as supported. -
Fallback approach: If older devices need to be supported and
date -d "@..."doesn't work, we could usedate -r(modification time of a file) or implement a pure-shell timestamp conversion.
Once you've verified the compatibility, we can either:
- Document the minimum AXIS OS version in the README if
date -dis sufficient - Implement a fallback if older devices need support
Let me know what you find or if you'd like help with a compatibility fallback!
🧠 Learnings used
Learnt from: daniel-falk
Repo: fixedit-ai/fixedit-data-agent-examples PR: 5
File: project-strobe-color-from-github-workflow/README.md:350-351
Timestamp: 2025-08-10T14:54:48.316Z
Learning: In the fixedit-data-agent-examples repository, shell portability requirements (such as Axis devices using POSIX /bin/sh instead of bash) should be documented in a general scripting guide rather than repeated in individual project README files. This approach was confirmed by daniel-falk for better documentation organization.
Learnt from: daniel-falk
Repo: fixedit-ai/fixedit-data-agent-examples PR: 18
File: dashboard-deployments/system-monitoring-influxdb2-flux-grafana/provisioning/dashboards/overview_of_devices.json:1121-1130
Timestamp: 2025-09-03T14:18:52.406Z
Learning: When fixing unit mismatches in Grafana dashboards, daniel-falk prefers changing the panel unit configuration to match the data rather than transforming the query values, choosing simplicity over data conversion when both approaches are valid.
| if [ -z "$ACS_USERNAME" ] || [ -z "$ACS_PASSWORD" ]; then | ||
| printf "Error: ACS_USERNAME and ACS_PASSWORD must be set" >&2 | ||
| exit 10 | ||
| 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.
Missing validation for required HELPER_FILES_DIR variable
The HELPER_FILES_DIR environment variable is documented as required (lines 14-15) but isn't validated in the validation section like other required variables (ACS_SERVER_IP, ACS_SOURCE, ACS_USERNAME, ACS_PASSWORD). With set -u enabled, if HELPER_FILES_DIR is unset and debug mode is active, the script will fail with a cryptic "unbound variable" error when accessing ${HELPER_FILES_DIR} in debug_log_file(), rather than a clear error message. The || true on line 72 won't catch this since the error occurs during variable expansion before the command executes.
Additional Locations (1)
| position_size = "pos: x={}%,y={}% size: w={}%,h={}%".format(x_percent, y_percent, w_percent, h_percent) | ||
| metric.fields["code_position_size"] = position_size | ||
|
|
||
| return metric |
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.
Missing coordinates cause silent metric rejection
There's a mismatch between the Starlark processor and the shell script. The Starlark processor only adds code_position_size when all four normalized coordinates are present (has_all check on line 130), but still returns the metric without this field. The shell script then requires code_position_size to be non-empty and fails with a generic error about "Required fields cannot be empty". If a QR detection arrives without all normalized coordinates, the metric passes through Starlark but gets rejected by the script with an unclear error message that doesn't identify the root cause (missing source coordinates).
Additional Locations (1)
|



This PR adds a new project that integrates the FixedIT QR Code Decoder with the AXIS Camera Station VMS as seen in this video: https://youtu.be/O2by_JDe-GM
Summary by CodeRabbit
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.
Note
Adds a new QR-to-ACS bridge with Telegraf config and a posting script to forward detections from the FixedIT QR Code Decoder to AXIS Camera Station ExternalDataFacade.
project-qr-code-decoder-axis-camera-station)qr-acs-bridge.conf):inputs.socket_listenerreads QR/barcode detections via Unix domain socket with JSON parsing and tagging.processors.starlarkcomputescode_position_sizefrom normalized coordinates.outputs.execinvokespost_to_acs.shper detection with immediate, single-metric delivery.post_to_acs.sh):jq, formats timestamps, builds payload, and POSTs toExternalDataFacade/AddExternalDatawith basic auth and optional TLS skip.${HELPER_FILES_DIR}.README.md): Intro, workflow overview, and compatibility notes.Written by Cursor Bugbot for commit 3143923. This will update automatically on new commits. Configure here.