{"id":28995096,"url":"https://github.com/axiscommunications/modbus-acap","last_synced_at":"2025-06-25T04:06:32.991Z","repository":{"id":40384791,"uuid":"454739744","full_name":"AxisCommunications/modbus-acap","owner":"AxisCommunications","description":"A small prototype ACAP that exports events from AXIS Object Analytics (AOA) over Modbus using libmodbus.","archived":false,"fork":false,"pushed_at":"2024-10-23T14:07:29.000Z","size":126,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-23T16:06:00.206Z","etag":null,"topics":["acap","aoa","modbus"],"latest_commit_sha":null,"homepage":"https://www.axis.com/developer-community/industry-4-0-integration","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AxisCommunications.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-02T11:01:17.000Z","updated_at":"2024-10-23T14:07:31.000Z","dependencies_parsed_at":"2024-10-25T11:58:58.309Z","dependency_job_id":null,"html_url":"https://github.com/AxisCommunications/modbus-acap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AxisCommunications/modbus-acap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxisCommunications%2Fmodbus-acap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxisCommunications%2Fmodbus-acap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxisCommunications%2Fmodbus-acap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxisCommunications%2Fmodbus-acap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AxisCommunications","download_url":"https://codeload.github.com/AxisCommunications/modbus-acap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxisCommunications%2Fmodbus-acap/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261801988,"owners_count":23211664,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acap","aoa","modbus"],"created_at":"2025-06-25T04:06:31.186Z","updated_at":"2025-06-25T04:06:32.955Z","avatar_url":"https://github.com/AxisCommunications.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"*Copyright (C) 2024, Axis Communications AB, Lund, Sweden. All Rights Reserved.*\n\n# Modbus ACAP\n\n[![Build ACAP packages](https://github.com/AxisCommunications/modbus-acap/actions/workflows/build.yml/badge.svg)](https://github.com/AxisCommunications/modbus-acap/actions/workflows/build.yml)\n[![GitHub Super-Linter](https://github.com/AxisCommunications/modbus-acap/actions/workflows/super-linter.yml/badge.svg)](https://github.com/AxisCommunications/modbus-acap/actions/workflows/super-linter.yml)\n\n**This repository contains the source code to build a small prototype\n[ACAP version 4](https://axiscommunications.github.io/acap-documentation/)\n(native) application that exports events from\n[AXIS Object Analytics](https://www.axis.com/products/axis-object-analytics)\n(AOA) over\n[Modbus](https://en.wikipedia.org/wiki/Modbus) using\n[libmodbus](https://libmodbus.org/).** The application can be run in either\nserver or client mode, meaning two Axis devices can be used to showcase it.\n\n![Architectural overview](images/acap_architecture.svg)\n\n\u003e [!NOTE]\n\u003e The purpose of this repo is to serve as boilerplate code and keep\n\u003e things simple, hence it uses basic Modbus/TCP without TLS and such.\n\n## Build\n\nThe build step creates `eap` (embedded application package) packages that can\nthen be deployed on the target Axis device e.g. via the device's web UI.\n\n*For more information about the `eap` files, their content, and other ways to\ndeploy, please see the documentation on how to\n[Develop ACAP applications](https://axiscommunications.github.io/acap-documentation/docs/develop/).*\n\nThe build process uses the\n[ACAP SDK build container](https://hub.docker.com/r/axisecp/acap-sdk)\nand Docker or Podman.\n\nThe Docker and Podman commands are integrated in the [Makefile](Makefile), so\nif you have Docker or Podman and `make` on your computer all you need to do is:\n\n```sh\nmake dockerbuild\n```\n\nor\n\n```sh\nmake podmanbuild\n```\n\nor perhaps build in parallel:\n\n```sh\nmake -j dockerbuild\n```\n\nalternatively\n\n```sh\nmake -j podmanbuild\n```\n\nIf you do have Docker but no `make` on your system:\n\n```sh\n# 32-bit ARM, e.g. ARTPEC-6- and ARTPEC-7-based devices\nDOCKER_BUILDKIT=1 docker build --build-arg ARCH=armv7hf -o type=local,dest=. .\n# 64-bit ARM, e.g. ARTPEC-8 and ARTPEC-9-based devices\nDOCKER_BUILDKIT=1 docker build --build-arg ARCH=aarch64 -o type=local,dest=. .\n```\n\nIf you do have Podman but no `make` on your system:\n\n```sh\n# 32-bit ARM, e.g. ARTPEC-6- and ARTPEC-7-based devices\npodman build --build-arg ARCH=armv7hf -o type=local,dest=. .\n# 64-bit ARM, e.g. ARTPEC-8 and ARTPEC-9-based devices\npodman build --build-arg ARCH=aarch64 -o type=local,dest=. .\n```\n\n## Setup\n\n### Manual installation and configuration\n\nUpload the ACAP application file (the file with the `.eap` extension for the\ncamera's architecture) through the camera's web UI: *Apps-\u003eAdd app*\n\nThe parameter settings are found in the three vertical dots menu:\n\n![Web UI Screenshot](images/web_ui_open_param_settings.png)\n\n![Web UI Screenshot](images/web_ui_param_settings.png)\n\nSelect if the application should run in Server or Client mode and what AOA scenario's\nevents it should subscribe to *(default: Scenario 1)*. If you run in Client\nmode, also make sure you have set the right hostname/IP address for the Modbus\nserver you want to send the events to.\n\nUse the Modbus address parameter to select what Modbus bit to use for state if\nthe event is active or inactive.\n\n### Scripted installation and configuration\n\nUse the camera's\n[applications/upload.cgi](https://www.axis.com/vapix-library/subjects/t10102231/section/t10036126/display?section=t10036126-t10010609)\nto upload the ACAP application file (the file with the `.eap` extension for the\ncamera's architecture):\n\n```sh\ncurl -k --anyauth -u root:\u003cpassword\u003e \\\n    -F packfil=@Modbus_Prototype_\u003cversion\u003e_\u003carchitecture\u003e.eap \\\n    https://\u003ccamera hostname/ip\u003e/axis-cgi/applications/upload.cgi\n```\n\nTo\n[start (or stop/restart/remove)](https://www.axis.com/vapix-library/subjects/t10102231/section/t10036126/display?section=t10036126-t10010606)\nthe ACAP application, you can make a call like this:\n\n```sh\ncurl -k --anyauth -u root:\u003cpassword\u003e \\\n    'https://\u003ccamera hostname/ip\u003e/axis-cgi/applications/control.cgi?package=modbusacap\u0026action=start'\n```\n\nUse the camera's\n[param.cgi](https://www.axis.com/vapix-library/subjects/t10175981/section/t10036014/display)\nto list and set the application's parameters:\n\nThe call\n\n```sh\ncurl -k --anyauth -u root:\u003cpassword\u003e \\\n    'https://\u003ccamera hostname/ip\u003e/axis-cgi/param.cgi?action=list\u0026group=modbusacap'\n```\n\nwill list the current settings:\n\n```sh\nroot.Modbusacap.Mode=0\nroot.Modbusacap.Scenario=1\nroot.Modbusacap.Server=172.25.75.172\n```\n\nIf you want to set the server to e.g. 192.168.42.21:\n\n```sh\ncurl -k --anyauth -u root:\u003cpassword\u003e \\\n    'https://\u003ccamera hostname/ip\u003e/axis-cgi/param.cgi?action=update\u0026root.Modbusacap.Server=192.168.42.21'\n```\n\n## Usage\n\n\u003e [!IMPORTANT]\n\u003e The default Modbus/TCP port 502 requires running as a privileged user.\n\u003e In order to run as a non-privileged user, this ACAP application only allows\n\u003e ports in the non-privileged range 1024–65535.\n\u003c!-- --\u003e\n\u003e [!IMPORTANT]\n\u003e The Modbus address parameter must be set to the same value for both the\n\u003e client and the receiving server.\n\nThe application can be run in either *client* mode (default) or *server* mode,\nconfigured with the application parameter `Mode`:\n\n### Client mode (default)\n\n![Camera to modbus device](images/cam_to_modbus.svg)\n\nThe application subscribes to\n[AXIS Object Analytics](https://www.axis.com/products/axis-object-analytics)\n(AOA) events for the specified scenario *(default: Scenario 1)* and sends\ntrigger status *(active/inactive)* over Modbus (TCP) to the server specified\nin the application configuration. **This the typical use case** where the Axis\ndevice pushes AOA events to a receiving Modbus device.\n\n### Server mode\n\n![Camera to other camera](images/cam_to_cam.svg)\n\nIn server mode, the application listens for incoming TCP requests and logs AOA\nstatus updates from a connected device running in client mode. **This mode is\nuseful for testing and debugging without a separate Modbus device.**\n*In server mode, the application also subscribes to AOA events from its host\ndevice, but does not send them anywhere. That is solely for easy debugging and\ntesting the application's subscription mechanism.*\n\n## License\n\n[Apache 2.0](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxiscommunications%2Fmodbus-acap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxiscommunications%2Fmodbus-acap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxiscommunications%2Fmodbus-acap/lists"}