Skip to content

Commit

Permalink
* (Apollon77) Fix doNotDisturb sequence command when time string was …
Browse files Browse the repository at this point in the history
…used
  • Loading branch information
Apollon77 committed Aug 19, 2022
1 parent c6e6657 commit c017c5e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ Then it should work again
* docu docu docu (sorry ... will come)

## Changelog:

### __WORK IN PROGRESS__
* (Apollon77) Fix doNotDisturb sequence command when time string was used

### 5.8.1 (2022-08-18)
* (Apollon77) Fix doNotDisturb sequence command

Expand Down
13 changes: 12 additions & 1 deletion alexa-remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -2105,6 +2105,7 @@ class AlexaRemote extends EventEmitter {
let deviceOwnerCustomerId = 'ALEXA_CUSTOMER_ID';
let deviceAccountId;
let deviceFamily;
let deviceTimezoneId;
if (serialOrName && !Array.isArray(serialOrName)) {
const currDevice = this.find(serialOrName);
if (currDevice) {
Expand All @@ -2113,6 +2114,16 @@ class AlexaRemote extends EventEmitter {
deviceOwnerCustomerId = currDevice.deviceOwnerCustomerId;
deviceAccountId = currDevice.deviceAccountId;
deviceFamily = currDevice.deviceFamily;
if (currDevice.preferences && currDevice.preferences.timeZoneId !== undefined) {
deviceTimezoneId = currDevice.preferences.timeZoneId;
}
}
} else {
const currDevice = this.find(serialOrName[0]);
if (currDevice) {
if (currDevice.preferences && currDevice.preferences.timeZoneId !== undefined) {
deviceTimezoneId = currDevice.preferences.timeZoneId;
}
}
}
if (overrideCustomerId) {
Expand Down Expand Up @@ -2317,7 +2328,7 @@ class AlexaRemote extends EventEmitter {
throw new Error('Invalid timepoint value provided');
}
seqNode.operationPayload.until = `TIME#T${value}`;
//seqNode.operationPayload.timeZoneId = 'Europe/Berlin';
seqNode.operationPayload.timeZoneId = deviceTimezoneId || 'Europe/Berlin';
} else if (valueType !== 'boolean') {
throw new Error('Invalid timepoint provided');
}
Expand Down

0 comments on commit c017c5e

Please sign in to comment.