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

Commit

Permalink
Use dynamic factory and fix deferred turn off
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewturner committed Dec 13, 2019
1 parent 57b966c commit a55f281
Show file tree
Hide file tree
Showing 7 changed files with 715 additions and 627 deletions.
8 changes: 6 additions & 2 deletions aws/AlexaResponseBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AlexaResponseBuilder {
correlationToken: correlationToken
};

if (event.directive.endpoint) {
if (event.directive.endpoint && event.directive.endpoint.scope) {
this._options.endpointId = event.directive.endpoint.endpointId;
this._options.token = event.directive.endpoint.scope.token;
}
Expand Down Expand Up @@ -81,7 +81,7 @@ class AlexaResponseBuilder {
return this.errorResponseFrom(this._error);
}

let response = new AlexaResponse(this._options);
const response = new AlexaResponse(this._options);

this.addThermostatDetailsIfRequired(response,
this._thermostatDetails);
Expand All @@ -96,6 +96,10 @@ class AlexaResponseBuilder {

this.addModePropertyIfRequired(response, this._mode);

if (this._event.directive.endpoint && this._event.directive.endpoint.userId) {
response.event.endpoint = { userId: this._event.directive.endpoint.userId };
}

this._logger.debug('Response details:');
this._logger.debug(JSON.stringify(response));

Expand Down
2 changes: 1 addition & 1 deletion aws/handlers/Handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const {
MockProfileGateway
} = require('smartheat-aws/aws/ProfileGateway');
const helpers = require('smartheat-aws/aws/helpers');
const Factory = require('smartheat-clients/clients/Factory');
const Factory = require('smartheat-core/core/Factory');
const AlexaResponseBuilder = require('../AlexaResponseBuilder');

class Handler {
Expand Down
Loading

0 comments on commit a55f281

Please sign in to comment.