diff --git a/.eslintrc.json b/.eslintrc.json index d781c8e..e6a0ca4 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -15,7 +15,7 @@ ], "linebreak-style": [ "error", - "linux" + "unix" ], "quotes": [ "error", diff --git a/.hound.yml b/.hound.yml new file mode 100644 index 0000000..3da6665 --- /dev/null +++ b/.hound.yml @@ -0,0 +1,5 @@ +fail_on_violations: true + +eslint: + enabled: true + config_file: .eslintrc.json \ No newline at end of file diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 2b6f469..0000000 --- a/.jshintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "esversion": 6 -} diff --git a/aws/lambda.js b/aws/lambda.js index 2855cf2..7e13340 100644 --- a/aws/lambda.js +++ b/aws/lambda.js @@ -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) => { diff --git a/core/ControlService.js b/core/ControlService.js index 593749f..40f4d65 100644 --- a/core/ControlService.js +++ b/core/ControlService.js @@ -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; diff --git a/core/test.js b/core/test.js index c2686ac..ba7dc83 100644 --- a/core/test.js +++ b/core/test.js @@ -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); @@ -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); @@ -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(); \ No newline at end of file