Skip to content
Snippets Groups Projects
Commit 2911fe53 authored by Tobias Ullerich's avatar Tobias Ullerich
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
node_modules/
package-lock.json
/pkg
/pkg.tgz
\ No newline at end of file
package.json
/LICENSE.md
\ No newline at end of file
LICENSE 0 → 100644
MIT License
Copyright (c) 2022 Bitfocus AS - Open Source
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# companion-module-[replace with module name]
See [HELP.md](./companion/HELP.md) and [LICENSE](./LICENSE)
module.exports = function (self) {
self.setActionDefinitions({
sample_action: {
name: 'Trigger Pad',
options: [
{
id: 'num',
type: 'number',
label: 'Test',
default: 5,
min: 0,
max: 100,
},
],
callback: async (event) => {
console.log('Hello world!', event.options.num)
},
},
})
}
## Your module
Write some help for your users here!
{
"id": "playwall",
"name": "PlayWall",
"shortname": "PlayWall",
"description": "A companion plugin to remotely control PlayWal",
"version": "0.0.1",
"license": "MIT",
"repository": "git+https://github.com/bitfocus/companion-module-your-module-name.git",
"bugs": "https://github.com/bitfocus/companion-module-your-module-name/issues",
"maintainers": [
{
"name": "Tobias Ullerich",
"email": "tobias.dev@icloud.com"
}
],
"runtime": {
"type": "node18",
"api": "nodejs-ipc",
"apiVersion": "0.0.0",
"entrypoint": "../main.js"
},
"legacyIds": [],
"manufacturer": "Tobisan",
"products": ["PlayWall"],
"keywords": []
}
const { combineRgb } = require('@companion-module/base')
module.exports = async function (self) {
self.setFeedbackDefinitions({
ChannelState: {
name: 'Example Feedback',
type: 'boolean',
label: 'Channel State',
defaultStyle: {
bgcolor: combineRgb(255, 0, 0),
color: combineRgb(0, 0, 0),
},
options: [
{
id: 'num',
type: 'number',
label: 'Test',
default: 5,
min: 0,
max: 10,
},
],
callback: (feedback) => {
console.log('Hello world!', feedback.options.num)
if (feedback.options.num > 5) {
return true
} else {
return false
}
},
},
})
}
main.js 0 → 100644
const { InstanceBase, Regex, runEntrypoint, InstanceStatus } = require('@companion-module/base')
const UpgradeScripts = require('./upgrades')
const UpdateActions = require('./actions')
const UpdateFeedbacks = require('./feedbacks')
const UpdateVariableDefinitions = require('./variables')
class ModuleInstance extends InstanceBase {
constructor(internal) {
super(internal)
}
async init(config) {
this.config = config
this.updateStatus(InstanceStatus.Ok)
this.updateActions() // export actions
this.updateFeedbacks() // export feedbacks
this.updateVariableDefinitions() // export variable definitions
}
// When module gets deleted
async destroy() {
this.log('debug', 'destroy')
}
async configUpdated(config) {
this.config = config
}
// Return config fields for web config
getConfigFields() {
return [
{
type: 'textinput',
id: 'host',
label: 'PlayWall IP',
width: 8,
regex: Regex.IP,
},
{
type: 'textinput',
id: 'port',
label: 'PlayWall Port',
width: 4,
regex: Regex.PORT,
},
]
}
updateActions() {
UpdateActions(this)
}
updateFeedbacks() {
UpdateFeedbacks(this)
}
updateVariableDefinitions() {
UpdateVariableDefinitions(this)
}
}
runEntrypoint(ModuleInstance, UpgradeScripts)
{
"name": "MyModule",
"version": "0.1.0",
"main": "main.js",
"scripts": {
"format": "prettier -w ."
},
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/bitfocus/companion-module-your-module-name.git"
},
"dependencies": {
"@companion-module/base": "~1.4.0"
},
"devDependencies": {
"@companion-module/tools": "^1.2.0"
},
"prettier": "@companion-module/tools/.prettierrc.json"
}
module.exports = [
/*
* Place your upgrade scripts here
* Remember that once it has been added it cannot be removed!
*/
// function (context, props) {
// return {
// updatedConfig: null,
// updatedActions: [],
// updatedFeedbacks: [],
// }
// },
]
module.exports = async function (self) {
self.setVariableDefinitions([
{ variableId: 'variable1', name: 'My first variable' },
{ variableId: 'variable2', name: 'My second variable' },
{ variableId: 'variable3', name: 'Another variable' },
])
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment