Skip to content

Commit

Permalink
Update to 5.0.40 to fix push connection
Browse files Browse the repository at this point in the history
  • Loading branch information
bbindreiter committed Sep 8, 2023
1 parent 309b2b2 commit e25e6e2
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 26 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
**node-red-contrib-alexa-remote2-applestrudel**
- **5.0.40**
- Updates dependency alexa-remote2 to v6.0.1 to make use of new push connection mechanism
- **5.0.34**
- Set WSMQTT legacy connection type as default
- Updates dependency alexa-remote2 to v5.10.3
Expand Down
10 changes: 5 additions & 5 deletions lib/alexa-remote-ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,8 @@ class AlexaRemoteExt extends AlexaRemote {
}

resetExt() {
if (this.alexaWsMqtt) {
this.alexaWsMqtt.on('error', this.logError);
if (this.alexahttp2Push) {
this.alexahttp2Push.on('error', this.logError);
}

if (this.readyState === 1) {
Expand All @@ -597,9 +597,9 @@ class AlexaRemoteExt extends AlexaRemote {
if (this.alexaCookie) {
this.alexaCookie.stopProxyServer();
}
if (this.alexaWsMqtt) {
this.alexaWsMqtt.on('error', this.logError);
this.alexaWsMqtt.removeAllListeners();
if (this.alexahttp2Push) {
this.alexahttp2Push.on('error', this.logError);
this.alexahttp2Push.removeAllListeners();
}

this.removeAllListeners();
Expand Down
14 changes: 3 additions & 11 deletions nodes/alexa-remote-account.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,12 @@
</select>
</div>
<div class="form-row">
<label for="node-config-input-useWsMqtt"><i class="fa fa-rocket"></i> Events</label>
<select id="node-config-input-useWsMqtt" style="width: 70%;">
<label for="node-config-input-usePushConnection"><i class="fa fa-rocket"></i> Events</label>
<select id="node-config-input-usePushConnection" style="width: 70%;">
<option value="on">On</option>
<option value="off">Off</option>
</select>
</div>
<div class="form-row">
<label for="node-config-input-usePushConnectType"><i class="fa fa-rocket"></i> Events Connect Type</label>
<select id="node-config-input-usePushConnectType" style="width: 70%;">
<option value="1">1</option>
<option value="2">2</option>
</select>
</div>
<hr>
<div class="form-row">
<label for="node-config-input-alexaServiceHost"><i class="fa fa-amazon"></i> Service Host</label>
Expand Down Expand Up @@ -242,8 +235,7 @@ <h3><strong>References</strong></h3>
acceptLanguage: { required: false, value: 'en-US' },
onKeywordInLanguage: { required: false, value: 'on' },
userAgent: { required: false, value: '' },
useWsMqtt: { required: true, value: 'on' },
usePushConnectType: { required: true, value: '1' },
usePushConnection: { required: true, value: 'on' },
autoInit: { required: true, value: 'on' }
},
paletteLabel: 'Alexa Account',
Expand Down
8 changes: 3 additions & 5 deletions nodes/alexa-remote-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,8 @@ module.exports = function (RED) {
function AlexaRemoteAccountNode(input) {
RED.nodes.createNode(this, input);

tools.assign(this, ['authMethod', 'proxyOwnIp', 'proxyPort', 'cookieFile', 'refreshInterval', 'alexaServiceHost', 'amazonPage', 'acceptLanguage', 'onKeywordInLanguage', 'userAgent', 'usePushConnectType'], input);
this.useWsMqtt = input.useWsMqtt === 'on';
this.usePushConnectionType = input.usePushConnectionType;
tools.assign(this, ['authMethod', 'proxyOwnIp', 'proxyPort', 'cookieFile', 'refreshInterval', 'alexaServiceHost', 'amazonPage', 'acceptLanguage', 'onKeywordInLanguage', 'userAgent'], input);
this.usePushConnection = input.usePushConnection === 'on';
this.autoInit = input.autoInit === 'on';
this.name = input.name;
this.onKeywordInLanguage = input.onKeywordInLanguage;
Expand Down Expand Up @@ -414,15 +413,14 @@ module.exports = function (RED) {
// this.initing = true;

let config = {};
tools.assign(config, ['proxyOwnIp', 'proxyPort', 'alexaServiceHost', 'amazonPage', 'acceptLanguage', 'onKeywordInLanguage', 'userAgent', 'useWsMqtt', 'usePushConnectType'], this);
tools.assign(config, ['proxyOwnIp', 'proxyPort', 'alexaServiceHost', 'amazonPage', 'acceptLanguage', 'onKeywordInLanguage', 'userAgent', 'usePushConnection'], this);
config.logger = this.debugCb;
config.refreshCookieInterval = 0;
config.proxyLogLevel = 'warn';
config.cookieJustCreated = true; // otherwise it just tries forever...
config.bluetooth = false;
config.setupProxy = false;
config.apiUserAgentPostfix = pjson.name + '/' + pjson.version;
config.usePushConnectType = parseInt(this.usePushConnectType) || 1;

switch (this.authMethod) {
case 'proxy':
Expand Down
2 changes: 1 addition & 1 deletion nodes/alexa-remote-event.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
}
</style>

<p>Listens to WsMqtt events.
<p>Listens to Push events.
Events must be enabled for this account.</p>
<hr>
<h3><strong>Outputs</strong></h3>
Expand Down
2 changes: 1 addition & 1 deletion nodes/alexa-remote-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = function (RED) {
this.account.alexa.addListener(this.event, this.onAlexaEvent);
};

if(!this.account.useWsMqtt) {
if(!this.account.usePushConnection) {
return this.status({ fill: "red", shape: "dot", text: "events not supported by account" });
}
else {
Expand Down
2 changes: 1 addition & 1 deletion nodes/markdown/event.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Listens to WsMqtt events.
Listens to Push events.
Events must be enabled for this account.

---
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-alexa-remote2-applestrudel",
"version": "5.0.34",
"version": "5.0.40",
"author": {
"name": "bbindreiter",
"email": "[email protected]"
Expand Down Expand Up @@ -43,6 +43,9 @@
"url": "https://github.com/bbindreiter/node-red-contrib-alexa-remote2-applestrudel/issues"
},
"dependencies": {
"alexa-remote2": "^5.10.3"
"alexa-remote2": "^6.0.1"
},
"engines": {
"node": ">=16.0.0"
}
}

0 comments on commit e25e6e2

Please sign in to comment.