Skip to content

Commit 5ab1507

Browse files
committed
Increase the frequency of Roomba status checks in order to support automations
#79
1 parent f100e9f commit 5ab1507

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

.changeset/four-fishes-clean.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"homebridge-roomba2": minor
3+
---
4+
5+
Increase the frequency of Roomba status checks in order to support automations

src/accessory.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const CONNECT_TIMEOUT_MILLIS = 60_000;
99
/**
1010
* When actively watching Roomba's status, how often to query Roomba and update HomeKit.
1111
*/
12-
const WATCH_INTERVAL_MILLIS = 30_000;
12+
const WATCH_INTERVAL_MILLIS = 5_000;
1313

1414
/**
1515
* After starting to actively watch Roomba's status, how long should we watch for after
@@ -21,17 +21,17 @@ const WATCH_IDLE_TIMEOUT_MILLIS = 600_000;
2121
/**
2222
* How often to query Roomba and update HomeKit when not actively watching Roomba's status.
2323
*/
24-
const LONG_WATCH_INTERVAL_MILLIS = 3600 * 1000; // 24 * 60 * 60 * 1000;
24+
const LONG_WATCH_INTERVAL_MILLIS = 60_000;
2525

2626
/**
27-
* How old a cached status can be before we ignore it.
27+
* How long will we wait for the Roomba to send status before giving up?
2828
*/
29-
const MAX_CACHED_STATUS_AGE_MILLIS = LONG_WATCH_INTERVAL_MILLIS + 600_000;
29+
const MAX_WAIT_FOR_STATUS_MILLIS = 60_000;
3030

3131
/**
32-
* How long will we wait for the Roomba to send status before giving up?
32+
* How old a cached status can be before we ignore it.
3333
*/
34-
const MAX_WAIT_FOR_STATUS_MILLIS = 60_000;
34+
const MAX_CACHED_STATUS_AGE_MILLIS = LONG_WATCH_INTERVAL_MILLIS + MAX_WAIT_FOR_STATUS_MILLIS * 5;
3535

3636
/**
3737
* Coalesce refreshState requests into one when they're less than this many millis apart.

0 commit comments

Comments
 (0)