Skip to content

Commit f15404e

Browse files
committed
Identify support
Resolves #77
1 parent e0c6d5d commit f15404e

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

.changeset/loud-goats-rhyme.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+
Added support for Identify method (supported in 3rd party HomeKit apps)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- Roomba docked notification
2121
- Roomba running notification
2222
- Roomba bin full notification
23+
- Find Roomba (Identify Function, supported in 3rd Party HomeKit apps)
2324

2425
The homebridge-roomba2 plugin polls Roomba for its status when requested by HomeKit, so when you first open
2526
the Home app you may see an old status, or no status, until Roomba has had time to respond (which may take

src/accessory.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export default class RoombaAccessory implements AccessoryPlugin {
170170

171171
this.accessoryInfo.setCharacteristic(Characteristic.Manufacturer, "iRobot");
172172
this.accessoryInfo.setCharacteristic(Characteristic.SerialNumber, this.serialnum);
173-
this.accessoryInfo.setCharacteristic(Characteristic.Identify, false);
173+
this.accessoryInfo.setCharacteristic(Characteristic.Identify, true);
174174
this.accessoryInfo.setCharacteristic(Characteristic.Name, this.name);
175175
this.accessoryInfo.setCharacteristic(Characteristic.Model, this.model);
176176
this.accessoryInfo.setCharacteristic(Characteristic.FirmwareRevision, version);
@@ -222,8 +222,18 @@ export default class RoombaAccessory implements AccessoryPlugin {
222222
this.startLongWatch();
223223
}
224224

225-
public identify(): void {
226-
this.log.debug("Identify requested. Not supported yet.");
225+
public identify() {
226+
this.log("Identify requested");
227+
this.connect(async(error, roomba) => {
228+
if (error || !roomba) {
229+
return;
230+
}
231+
try {
232+
await roomba.find();
233+
} catch (error) {
234+
this.log("Roomba failed to locate: %s", (error as Error).message);
235+
}
236+
});
227237
}
228238

229239
public getServices(): Service[] {

src/dorita980.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ declare module "dorita980" {
1212
stop(): Promise<CommandResult>
1313
end(): Promise<CommandResult>
1414
dock(): Promise<CommandResult>
15+
find(): Promise<CommandResult>
1516
getRobotState(states: string[]): Promise<RobotState>
1617
}
1718

@@ -44,6 +45,7 @@ declare module "dorita980" {
4445
public stop(): Promise<CommandResult>
4546
public end(): Promise<CommandResult>
4647
public dock(): Promise<CommandResult>
48+
public find(): Promise<CommandResult>
4749
public getRobotState(states: string[]): Promise<RobotState>
4850
}
4951
}

0 commit comments

Comments
 (0)