{"id":15040015,"url":"https://github.com/automattic/biab-cli","last_synced_at":"2025-10-19T18:32:14.294Z","repository":{"id":66078734,"uuid":"81579846","full_name":"Automattic/biab-cli","owner":"Automattic","description":"Blog In A Box CLI","archived":false,"fork":false,"pushed_at":"2017-03-09T10:42:59.000Z","size":658,"stargazers_count":5,"open_issues_count":0,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-30T01:11:16.140Z","etag":null,"topics":["raspberrypi","wordpress"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Automattic.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-10T15:45:15.000Z","updated_at":"2023-07-31T20:46:22.000Z","dependencies_parsed_at":"2023-03-26T17:21:54.044Z","dependency_job_id":null,"html_url":"https://github.com/Automattic/biab-cli","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Automattic%2Fbiab-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Automattic%2Fbiab-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Automattic%2Fbiab-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Automattic%2Fbiab-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Automattic","download_url":"https://codeload.github.com/Automattic/biab-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237192376,"owners_count":19269890,"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":["raspberrypi","wordpress"],"created_at":"2024-09-24T20:44:06.721Z","updated_at":"2025-10-19T18:32:08.959Z","avatar_url":"https://github.com/Automattic.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blog In A Box\n\n[Blog In A Box](https://inabox.blog/) for WordPress comes as two parts:\n\n- [WordPress plugin](https://github.com/Automattic/biab-plugin)\n- [CLI utility](https://github.com/Automattic/biab-cli)\n\n### WordPress Plugin\n\nThe plugin may be found in the [companion repository](https://github.com/Automattic/biab-plugin) and it is installed as per a normal WordPress plugin.\n\n### CLI Utility Manual Installation\n\nThis repository contains the CLI tools, which should be installed in the following location (default, but can be changed):\n\n`/opt/bloginabox/`\n\n`sudo` access must be given to the `www-data` user so that PHP can call these tools. To do this:\n\n`sudo visudo`\n\nAnd add this line:\n\n`www-data ALL=(pi:pi) NOPASSWD: /opt/bloginabox/biab`\n\nThe WordPress plugin will then have access to the `/opt/bloginabox/biab` CLI tool, and from here can trigger and receive data from hardware devices.\n\nNote: this is done automatically when using [Blog In A Box Installer](https://github.com/Automattic/biab-installer).\n\n## CLI Utility\n\nThe web server can interface with devices through a single executable:\n\n`/opt/bloginabox/biab`\n\nThis can also be called from the command line or via any external tool.\n\nThe executable loads up a series of device handlers that listen for commands and perform actions. For example:\n\n`./biab camera-take-photo`\n\nThis triggers the camera module to take a picture and can optionally trigger the SenseHAT to display an image.\n\n### Developing a device handler\n\nDevice handlers are added in the `devices` directory, and should be loaded in `devices/index.js`.\n\nEach device should export a single entry function that accepts an `EventEmitter`. The device handler can listen to events on this emitter:\n\n```js\nmodule.exports = function( emitter ) {\n\temitter.on( 'do-something', function( args ) {\n\t\tconsole.log( 'Received do-something command with ' + args );\n\t} );\n};\n```\n\nThis will be triggered with:\n\n`./biab do-something some-data`\n\nThe listener can perform whatever functions it needs to achieve the desired effect. If the handler should return data to the caller then it can finish with:\n\n```js\nthis.emit( 'result', 'data-to-be-returned' );\n```\n\nThe utility is run as the `pi` user, and has access to all devices that this user can access.\n\n## Debugging\n\nTo debug problems edit `biab` and set and change the debug lines:\n\n```shell\n#DEBUGGER=\nDEBUGGER=biab:*\n```\n\nWhen you want to disable the debug mode then set it back to:\n\n```shell\nDEBUGGER=\n#DEBUGGER=biab:*\n```\n\nWhile enable a log of all actions will be output to `biab.log`:\n\n```log\nbiab:main Command: \"sensehat-capture\" with data \"\"\nbiab:sensehat:capture Capturing data: /usr/bin/python /opt/bloginabox/devices/sensehat/capture.py\nbiab:sensehat:capture Data captured - temp=25.04471492767334 humidity=52.390140533447266 pressure=1019.79345703125 tp=25.089582443237305 th=24.999847412109375\n```\n\nThis may be helpful in figuring out where a problem is.\n\n## Contributing\n\nWe welcome contributions in any form, and you can help reporting, testing, and detailing bugs.\n\n## License\n\nThe Blog In A Box theme is licensed under [GNU General Public License v2 (or later)](./LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautomattic%2Fbiab-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fautomattic%2Fbiab-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautomattic%2Fbiab-cli/lists"}