Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
Fix stopping hold (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Turner authored Mar 31, 2019
1 parent 7306e75 commit 6f146cd
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"linebreak-style": [
"error",
"linux"
"unix"
],
"quotes": [
"error",
Expand Down
5 changes: 5 additions & 0 deletions .hound.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fail_on_violations: true

eslint:
enabled: true
config_file: .eslintrc.json
3 changes: 0 additions & 3 deletions .jshintrc

This file was deleted.

3 changes: 2 additions & 1 deletion aws/lambda.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ app.intent('SetTempIntent', {

app.intent('TurnIntent', {
'slots': {
'onoff': 'ONOFF'
'onoff': 'ONOFF',
'duration': 'AMAZON.DURATION'
},
'utterances': ['to turn {onoff}', 'to turn heating {onoff}', 'to turn the heating {onoff}']
}, async (request, response) => {
Expand Down
2 changes: 1 addition & 1 deletion core/ControlService.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class ControlService {
let intent = await this._holdStrategy.holdIfRequiredFor(duration);
return messages.concat(this.summarize(intent, updatedDevice));
} else {
await this._holdStrategy.stopHoldIfRequiredFor(thermostat.executionId);
await this._holdStrategy.stopHoldIfRequired(thermostat.executionId);
}
}
return messages;
Expand Down
12 changes: 9 additions & 3 deletions core/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ const say = (messages) => {
};

const main = async () => {
let onOff = 'on';
let duration = process.env.DURATION;
let context = { userId: process.env.ALEXA_USER_ID };
let context = { userId: process.env.ALEXA_USER_ID, source: 'user' };
let holdStrategy;
if (process.env.HOLD_STRATEGY === 'aws') {
holdStrategy = new AwsHoldStrategy(context);
Expand Down Expand Up @@ -50,7 +49,7 @@ const main = async () => {
}

try {
let messages = await service.turn(onOff, duration);
let messages = await service.turn('on', duration);
say(messages);
} catch (e) {
say(e);
Expand All @@ -62,6 +61,13 @@ const main = async () => {
} catch (e) {
say(e);
}

try {
let messages = await service.turn('off');
say(messages);
} catch (e) {
say(e);
}
};

main();

0 comments on commit 6f146cd

Please sign in to comment.