Skip to content

Commit 1287358

Browse files
v1.0.0
0 parents  commit 1287358

File tree

17 files changed

+4184
-0
lines changed

17 files changed

+4184
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/node_modules
2+
/pkg
3+
/*.tgz
4+
/.yarn

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License
2+
3+
Copyright (c) 2018 Bitfocus AS, William Viker & Håkon Nessjøen
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.
22+

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# companion-module-generic-http
2+
See [HELP.md](./companion/HELP.md) and [LICENSE](./LICENSE)

actions.js

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
import { FIELDS } from './fields.js'
2+
3+
export function getActions(instance) {
4+
return {
5+
setHeadsetName: {
6+
name: 'Set Headset Name',
7+
options: [ FIELDS.headsetId('headsetId'),
8+
{
9+
type: 'textinput',
10+
label: 'New Name',
11+
id: 'newHeadsetName',
12+
default: '',
13+
useVariables: true,
14+
},
15+
],
16+
callback: async (action, context) => {
17+
const headsetId = parseInt(action.options.headsetId)
18+
const newHeadsetName = await context.parseVariablesInString(action.options.newHeadsetName)
19+
await instance.setHeadsetName(headsetId, newHeadsetName)
20+
},
21+
},
22+
setHeadsetChannel: {
23+
name: 'Set Headset Channel',
24+
options: [
25+
FIELDS.showCheckbox('Use Headset ID', 'useHeadsetId', false),
26+
{
27+
...FIELDS.headsetId('headsetId'),
28+
isVisible: (options) => options.useHeadsetId === true,
29+
},
30+
{
31+
...FIELDS.headsetDropdown(instance, 'headsetName'),
32+
isVisible: (options) => options.useHeadsetId !== true,
33+
},
34+
FIELDS.comDropdown(),
35+
FIELDS.channelDropdown(),
36+
],
37+
callback: async (action, context) => {
38+
let headsetName = action.options.headsetName
39+
40+
// If using ID, convert ID to name
41+
if (action.options.useHeadsetId) {
42+
const headsetId = parseInt(action.options.headsetId)
43+
const headset = instance.ppInfoData?.[0]?.PP?.find(headset => headset.id === headsetId)
44+
headsetName = headset.name
45+
}
46+
47+
// if (action.options.channelPosition.label === 'None') {
48+
49+
// }
50+
51+
const channelPosition = action.options.channelPosition
52+
const comPosition = action.options.comPosition
53+
await instance.setHeadsetChannel(headsetName, channelPosition, comPosition)
54+
},
55+
},
56+
setHeadsetRole: {
57+
name: 'Set Headset Role',
58+
options: [
59+
FIELDS.showCheckbox('Use Headset ID', 'useHeadsetId', false),
60+
{
61+
...FIELDS.headsetId('headsetId'),
62+
isVisible: (options) => options.useHeadsetId === true,
63+
},
64+
{
65+
...FIELDS.headsetDropdown(instance, 'headsetName'),
66+
isVisible: (options) => options.useHeadsetId !== true,
67+
},
68+
FIELDS.roleDropdown(instance),
69+
{
70+
...FIELDS.showCheckbox('Head', 'isHead', false),
71+
isVisible: (options) => {
72+
const validRoles = ['Lighting', 'CamA', 'CamB', 'Production', 'Grip']
73+
return validRoles.includes(options.roleName)
74+
},
75+
},
76+
],
77+
callback: async (action, context) => {
78+
let headsetName = action.options.headsetName
79+
80+
// If using ID, convert ID to name
81+
if (action.options.useHeadsetId) {
82+
const headsetId = parseInt(action.options.headsetId)
83+
const headset = instance.ppInfoData?.[0]?.PP?.find(pp => pp.id === headsetId)
84+
if (headset) {
85+
headsetName = headset.name
86+
} else {
87+
instance.log('error', `Headset with ID ${headsetId} not found`)
88+
return
89+
}
90+
}
91+
92+
const roleName = await context.parseVariablesInString(action.options.roleName)
93+
const isHead = action.options.isHead
94+
await instance.setHeadsetRole(headsetName, roleName, isHead)
95+
},
96+
},
97+
setHeadsetTalkMode: {
98+
name: 'Set Headset Talk Mode',
99+
options: [
100+
FIELDS.showCheckbox('Use Headset ID', 'useHeadsetId', false),
101+
{
102+
...FIELDS.headsetId('headsetId'),
103+
isVisible: (options) => options.useHeadsetId === true,
104+
},
105+
{
106+
...FIELDS.headsetDropdown(instance, 'headsetName'),
107+
isVisible: (options) => options.useHeadsetId !== true,
108+
},
109+
FIELDS.talkModeDropdown(),
110+
],
111+
callback: async (action, context) => {
112+
let headsetName = action.options.headsetName
113+
114+
// If using ID, convert ID to name
115+
if (action.options.useHeadsetId) {
116+
const headsetId = parseInt(action.options.headsetId)
117+
const headset = instance.ppInfoData?.[0]?.PP?.find(pp => pp.id === headsetId)
118+
if (headset) {
119+
headsetName = headset.name
120+
} else {
121+
instance.log('error', `Headset with ID ${headsetId} not found`)
122+
return
123+
}
124+
}
125+
126+
const talkMode = action.options.talkMode
127+
await instance.setHeadsetTalkMode(headsetName, talkMode)
128+
},
129+
},
130+
}
131+
}

companion/HELP.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Generic HTTP Requests Module
2+
3+
Generic modules are only for use with custom applications. If you use this module to control a device or software on the market that more than you are using, <strong>PLEASE let us know</strong> about this software, so we can make a proper module for it. If we already support this and you use this to trigger a feature our module doesn't support, please let us know. We want Companion to be as easy as possible to use for anyone.
4+
5+
**Available commands**
6+
7+
* POST
8+
* GET
9+
* PUT
10+
* PATCH
11+
* DELETE

companion/manifest.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"id": "hollyland-solidcom",
3+
"name": "Hollyland Solidcom",
4+
"shortname": "Solidcom",
5+
"description": "Hollyland Solidcom",
6+
"version": "1.0.0",
7+
"license": "MIT",
8+
"repository": "git+https://github.com/bitfocus/companion-module-hollyland-solidcom.git",
9+
"bugs": "https://github.com/bitfocus/companion-module-hollyland-solidcom/issues",
10+
"maintainers": [
11+
{
12+
"name": "Ted Charles Brown",
13+
"email": "tedcharlesbrown.com"
14+
},
15+
{
16+
"name": "William Viker",
17+
"email": "william@bitfocus.io"
18+
},
19+
{
20+
"name": "Keith Rocheck",
21+
"email": "keith.rocheck@gmail.com"
22+
},
23+
{
24+
"name": "Jeffrey Davidsz",
25+
"email": "jeffrey.davidsz@vicreo.eu"
26+
},
27+
{
28+
"name": "Joseph Adams",
29+
"email": "josephdadams@gmail.com"
30+
}
31+
],
32+
"legacyIds": [],
33+
"runtime": {
34+
"type": "node22",
35+
"api": "nodejs-ipc",
36+
"apiVersion": "0.0.0",
37+
"entrypoint": "../index.js"
38+
},
39+
"manufacturer": "Hollyland",
40+
"products": [
41+
"Solidcom"
42+
],
43+
"keywords": [
44+
"solidcom",
45+
"hollyland",
46+
"http"
47+
]
48+
}

config.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { Regex } from "@companion-module/base";
2+
3+
export const configFields = [
4+
{
5+
type: 'static-text',
6+
id: 'info',
7+
width: 12,
8+
label: 'Information',
9+
value:
10+
"Hollyland Solidcom devices store credentials in plain text. Use at your own risk!",
11+
},
12+
{
13+
type: 'textinput',
14+
id: 'ipAddress',
15+
label: 'Device IP Address',
16+
width: 12,
17+
default: '192.168.218.10',
18+
regex: Regex.IP,
19+
},
20+
{
21+
type: 'textinput',
22+
id: 'username',
23+
label: 'Device Username',
24+
width: 12,
25+
default: 'admin',
26+
},
27+
{
28+
type: 'textinput',
29+
id: 'password',
30+
label: 'Device Password',
31+
width: 12,
32+
default: '12345678',
33+
},
34+
{
35+
type: 'number',
36+
id: 'pollInterval',
37+
label: 'Variable Polling Interval (ms)',
38+
tooltip: 'How often to refresh variables from the device. Set to 0 to disable automatic polling.',
39+
width: 12,
40+
default: 5000,
41+
min: 0,
42+
max: 60000,
43+
}
44+
]

0 commit comments

Comments
 (0)