companion-actions

Implement Bitfocus Companion module actions with typed options, callbacks, and lifecycle hooks.

Updated May 19, 2026
One-click install
npx skills add https://github.com/digitaldrummerj/bitfocus-companion-skills --skill companion-actions-digitaldrummerj
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: companion-actions
Source: https://github.com/digitaldrummerj/bitfocus-companion-skills/tree/main/plugins/companion-actions
Command: npx skills add https://github.com/digitaldrummerj/bitfocus-companion-skills --skill companion-actions-digitaldrummerj

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @companion-module/base.

What problem does it solve? Building Bitfocus Companion modules requires correctly wiring actions through the @companion-module/base API, and mistakes in option definitions, callbacks, or lifecycle hooks cause broken button commands and stale registrations. ## Core Features & Use Cases - Typed Action Definitions: Define actions using CompanionActionDefinition with name, options, callback, subscribe, unsubscribe, and learn hooks. - Option Field Patterns: Configure textinput, number, dropdown, checkbox, colorpicker, and other Companion input fields with correct defaults and constraints. - Lifecycle & State Handling: Use subscribe/unsubscribe for stateful actions and re-register actions dynamically when device capabilities change. - Use Case: When adding a "Set Level" button command to a device module, define a slider number option, write an async callback that sends the value to the device, and re-register actions after connection updates. ## Quick Start Ask the agent to add a new action with a dropdown and number option to your Companion module and wire its callback to your device connection.

Frequently Asked Questions about companion-actions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add an action to a Bitfocus Companion module?▼

Define actions inside an UpdateActions function that calls self.setActionDefinitions with CompanionActionDefinition objects. Each action needs a name, an options array of input fields, and a callback that receives a CompanionActionEvent with user-configured option values.

What option field types does CompanionActionDefinition support?▼

The SomeCompanionActionInputField union covers textinput, number, dropdown, checkbox, colorpicker, multidropdown, bonjourdevice, static-text, and custom-variable. Every field requires id, type, and label, with type-specific extras like min/max for number and choices for dropdown.

When should I use subscribe and unsubscribe in Companion actions?▼

Use subscribe and unsubscribe for stateful actions that need setup or teardown tied to button usage, such as starting polling when an action is added to a button and stopping it when removed. The plain callback still fires on each button press.

Why are my Companion actions not updating after device state changes?▼

Actions are not re-registered automatically, so you must call UpdateActions(self) again after connection or capability changes. Forgetting this leaves stale option lists and outdated action definitions in the UI.

How do I handle errors inside a Companion action callback?▼

Mark callbacks as async, await device calls, and wrap them in try/catch blocks that log failures via self.log('error', ...). Avoid long synchronous operations, since blocking the callback degrades the module's responsiveness.