Skip to content

Commit 9fd8704

Browse files
rcoletti116karlvr
authored andcommitted
Reverse noDockOnStop function to DockOnStop
No uses positive languages to indicate DockOnStop. If True (Default), Roomba will return home when stopped.
1 parent eb39685 commit 9fd8704

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/accessory.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export default class RoombaAccessory implements AccessoryPlugin {
8181
private robotpwd: string
8282
private ipaddress: string
8383
private firmware: string
84-
private noDockOnStop: boolean
84+
private DockOnStop: boolean
8585

8686
private accessoryInfo: Service
8787
private filterMaintenance: Service
@@ -133,7 +133,7 @@ export default class RoombaAccessory implements AccessoryPlugin {
133133
this.robotpwd = config.robotpwd;
134134
this.ipaddress = config.ipaddress;
135135
this.firmware = "N/A";
136-
this.noDockOnStop = config.noDockOnStop;
136+
this.DockOnStop = config.DockOnStop;
137137

138138
const showDockAsContactSensor = config.dockContactSensor === undefined ? true : config.dockContactSensor;
139139
const showRunningAsContactSensor = config.runningContactSensor;
@@ -446,8 +446,13 @@ export default class RoombaAccessory implements AccessoryPlugin {
446446

447447
if (state.running) {
448448
this.log("Roomba is pausing");
449-
450449
await roomba.pause();
450+
if (this.DockOnStop) {
451+
this.log("Roomba paused, returning to Dock");
452+
await this.dockWhenStopped(roomba, 3000);
453+
} else {
454+
this.log("Roomba is paused");
455+
}
451456

452457
callback();
453458

@@ -457,12 +462,6 @@ export default class RoombaAccessory implements AccessoryPlugin {
457462
docking: false,
458463
});
459464

460-
if (!this.noDockOnStop) {
461-
this.log("Roomba paused, returning to Dock");
462-
await this.dockWhenStopped(roomba, 3000);
463-
} else {
464-
this.log("Roomba is paused");
465-
}
466465
} else if (state.docking) {
467466
this.log("Roomba is docking");
468467
await roomba.pause();

0 commit comments

Comments
 (0)