Skip to content

Commit

Permalink
Fix windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
taurgis committed Jan 3, 2025
1 parent 8b49064 commit f6d806c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions src/getRoombas.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import child_process from 'child_process';
import { spawnSync } from 'child_process';
import { Logger, PlatformConfig } from 'homebridge';

export function getRoombas(email: string, password: string, log: Logger, config: PlatformConfig): Robot[] {
Expand All @@ -10,7 +10,8 @@ export function getRoombas(email: string, password: string, log: Logger, config:
} else {
log.info('Logging into iRobot...');

const Robots = child_process.execFileSync(__dirname + '/scripts/getRoombaCredentials.js', [email, password]).toString();
const result = spawnSync('node', [__dirname + '/scripts/getRoombaCredentials.js', email, password]);
const Robots = result.stdout.toString();

try {
robots = JSON.parse(Robots);
Expand All @@ -33,7 +34,8 @@ export function getRoombas(email: string, password: string, log: Logger, config:

log.info('Configuring roomba:', robot.name);

const robotIP = child_process.execFileSync(__dirname + '/scripts/getRoombaIP.js', [robot.blid]).toString();
const result = spawnSync('node', [__dirname + '/scripts/getRoombaIP.js', robot.blid]);
const robotIP = result.stdout.toString();

try {
const robotInfo = JSON.parse(robotIP);
Expand Down Expand Up @@ -63,8 +65,8 @@ export function getRoombas(email: string, password: string, log: Logger, config:
}

return goodRoombas;

}

function getModel(sku: string):string {
switch (sku.charAt(0)) {
case 'j':
Expand Down

0 comments on commit f6d806c

Please sign in to comment.