Skip to content

Commit

Permalink
refactor power state feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
josephdadams committed Sep 20, 2023
1 parent 9cee5b3 commit 6429219
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "canon-ptz",
"version": "2.0.11",
"version": "2.0.12",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down
27 changes: 10 additions & 17 deletions src/feedbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = {
feedbacks.powerState = {
type: 'boolean',
name: 'System - Power State',
description: 'Indicate if PTZ is Idle or Standby',
description: 'Indicate if Camera is in Idle Mode or in Standby Mode',
defaultStyle: {
color: foregroundColor,
bgcolor: backgroundColorRed,
Expand All @@ -52,29 +52,22 @@ module.exports = {
type: 'dropdown',
label: 'Indicate in X State',
id: 'option',
default: '1',
default: 'idle',
choices: [
{ id: '0', label: 'Idle' },
{ id: '1', label: 'Standby' },
{ id: 'idle', label: 'Idle' },
{ id: 'switch_idle', label: 'Switch Idle' },
{ id: 'standby', label: 'Standby' },
{ id: 'switch_standby', label: 'Switch Standby' },
],
},
],
callback: function (feedback, bank) {
let opt = feedback.options
switch (opt.option) {
case '0':
if ((self.data.powerState === 'idle') || (self.data.powerState === 'switch-idle')) {
return true
}
break
case '1':
if ((self.data.powerState === 'standby') || (self.data.powerState === 'switch-standby')) {
return true
}
break
default:
break

if (self.data.powerState === opt.option) {
return true
}

return false
},
}
Expand Down

0 comments on commit 6429219

Please sign in to comment.