Skip to content

Commit

Permalink
Emit payload of Generic command
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbungle64 committed Jan 13, 2024
1 parent abc1b13 commit f40a093
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions library/950type/ecovacsMQTT_JSON.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ class EcovacsMQTT_JSON extends EcovacsMQTT {
let abbreviatedCommand = command.replace(/^_+|_+$/g, '');
const commandPrefix = this.getCommandPrefix(abbreviatedCommand);
abbreviatedCommand = abbreviatedCommand.substring(commandPrefix.length);
if (this.vacBot.genericCommand) {
const genericCommandPrefix = this.getCommandPrefix(this.vacBot.genericCommand);
const abbreviatedGenericCommand = this.vacBot.genericCommand.substring(genericCommandPrefix.length);
if (abbreviatedGenericCommand.toLowerCase() === abbreviatedCommand.toLowerCase()) {
this.emit('genericCommandPayload', payload);
this.vacBot.genericCommand = null;
}
}
// e.g. T8, T9, T10, N8, X1 series
if (abbreviatedCommand.endsWith("_V2")) {
abbreviatedCommand = this.handleV2commands(abbreviatedCommand);
Expand Down
3 changes: 3 additions & 0 deletions library/vacBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ class VacBot {

this.schedule = [];

this.genericCommand = null;

if (this.is950type()) {
this.vacBotCommand = require('./950type/command');
} else {
Expand Down Expand Up @@ -524,6 +526,7 @@ class VacBot {
switch (command.toLowerCase()) {
case "Generic".toLowerCase(): {
this.sendCommand(new this.vacBotCommand.Generic(args[0], args[1]));
this.genericCommand = args[0];
break;
}
case "Clean".toLowerCase(): {
Expand Down

0 comments on commit f40a093

Please sign in to comment.