Skip to content

Commit

Permalink
enable or disable screensaver
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] authored and [email protected] committed Oct 19, 2019
1 parent 3ef5e5a commit 2cd7873
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@
"type": "boolean",
"role": "value",
"read": true,
"write": false
"write": true
},
"native": {}
},
Expand Down
20 changes: 20 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,26 @@ class LaMetric extends utils.Adapter {
'PUT',
null
);
} else if (id === this.namespace + '.meta.display.screensaver.enabled') {
this.log.debug('changing screensaver state to ' + state.val);

this.buildRequest(
'device/display',
content => {
this.setState('meta.display.screensaver.enabled', {val: content.success.data.screensaver.enabled, ack: true});
this.setState('meta.display.screensaver.widget', {val: content.success.data.screensaver.widget, ack: true});
this.setState('meta.display.screensaver.modes.timeBased.enabled', {val: content.success.data.screensaver.modes.time_based.enabled, ack: true});
this.setState('meta.display.screensaver.modes.timeBased.startTime', {val: content.success.data.screensaver.modes.time_based.start_time, ack: true});
this.setState('meta.display.screensaver.modes.timeBased.endTime', {val: content.success.data.screensaver.modes.time_based.end_time, ack: true});
this.setState('meta.display.screensaver.modes.whenDark.enabled', {val: content.success.data.screensaver.modes.when_dark.enabled, ack: true});
},
'PUT',
{
screensaver: {
enabled: state.val
}
}
);
} else if (id.match(/.+\.apps\.[a-z0-9]{32}\.activate$/g)) {
this.log.debug('changing to specific app');

Expand Down

0 comments on commit 2cd7873

Please sign in to comment.