Skip to content

Commit

Permalink
improve power feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
daniep01 committed Apr 18, 2021
1 parent cde9b84 commit b739afe
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,11 @@ instance.prototype.init_feedbacks = function (system) {
type: 'dropdown',
label: 'Power State',
id: 'powerState',
default: '1 MAIN',
choices: self.powerOptions,
default: '1',
choices: [
{ id: '1', label: 'Power On' },
{ id: '0', label: 'Power Off' },
]
},
],
}
Expand Down Expand Up @@ -150,7 +153,6 @@ instance.prototype.init_tcp = function() {
console.log(line.toString())
line = line.replace('<','')
line = line.replace('>','')
console.log(line);
if (self.config.debuglog === true) {
self.log('debug','Received: ' + line)
}
Expand All @@ -172,7 +174,8 @@ instance.prototype.init_tcp = function() {
case 'p': {
// power status
self.setVariable('Power',line.substr(1).trim())
self.powerState = line.substr(1).trim()
// take only first char (0 or 1)
self.powerState = line.substr(1,1).trim()
self.checkFeedbacks('powerFeedback')
break;
}
Expand Down

0 comments on commit b739afe

Please sign in to comment.