Skip to content

Commit

Permalink
way to many warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
donavanbecker committed Jul 30, 2024
1 parent c995e1e commit 6c81b2a
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 79 deletions.
4 changes: 2 additions & 2 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1738,7 +1738,7 @@
}
]
},
"allowInvalidCharacter": {
"allowInvalidCharacters": {
"title": "Allow Invalid Characters",
"type": "boolean",
"description": "If true, invalid characters will be allowed in the device name."
Expand Down Expand Up @@ -1935,7 +1935,7 @@
"description": "<em class='primary-text'>Specifies the interval, in seconds, between pushes to the SwitchBot API.</em>"
},
"options.logging",
"options.allowInvalidCharacter"
"options.allowInvalidCharacters"
]
}
]
Expand Down
116 changes: 58 additions & 58 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@
"@types/node": "^22.0.0",
"eslint": "^9.8.0",
"globals": "^15.8.0",
"homebridge": "^2.0.0-beta.0",
"homebridge": "^1.8.4",
"homebridge-config-ui-x": "4.56.4",
"nodemon": "^3.1.4",
"npm-check-updates": "^16.14.20",
"shx": "^0.3.4",
"ts-node": "^10.9.2",
"typedoc": "^0.26.5",
"typescript": "^5.5.4",
"typescript-eslint": "^8.0.0-alpha.54"
"typescript-eslint": "^8.0.0-alpha.58"
}
}
20 changes: 10 additions & 10 deletions src/device/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ export class Bot extends deviceBase {
Service: accessory.getService(this.hap.Service.Outlet) as Service,
};
accessory.context.Outlet = this.Outlet as object;
await this.warnLog('Removing any leftover Outlet Service');
await this.debugWarnLog('Removing any leftover Outlet Service');
accessory.removeService(this.Outlet.Service);
}

Expand All @@ -1056,7 +1056,7 @@ export class Bot extends deviceBase {
Service: accessory.getService(this.hap.Service.GarageDoorOpener) as Service,
};
accessory.context.GarageDoor = this.GarageDoor as object;
await this.warnLog('Removing any leftover Garage Door Service');
await this.debugWarnLog('Removing any leftover Garage Door Service');
accessory.removeService(this.GarageDoor.Service);
}

Expand All @@ -1068,7 +1068,7 @@ export class Bot extends deviceBase {
Service: accessory.getService(this.hap.Service.Door) as Service,
};
accessory.context.Door = this.Door as object;
await this.warnLog('Removing any leftover Door Service');
await this.debugWarnLog('Removing any leftover Door Service');
accessory.removeService(this.Door.Service);
}

Expand All @@ -1080,7 +1080,7 @@ export class Bot extends deviceBase {
Service: accessory.getService(this.hap.Service.LockMechanism) as Service,
};
accessory.context.LockMechanism = this.LockMechanism as object;
this.warnLog('Removing any leftover Lock Service');
await this.debugWarnLog('Removing any leftover Lock Service');
accessory.removeService(this.LockMechanism.Service);
}

Expand All @@ -1092,7 +1092,7 @@ export class Bot extends deviceBase {
Service: accessory.getService(this.hap.Service.Valve) as Service,
};
accessory.context.Faucet = this.Faucet as object;
await this.warnLog('Removing any leftover Faucet Service');
await this.debugWarnLog('Removing any leftover Faucet Service');
accessory.removeService(this.Faucet.Service);
}

Expand All @@ -1104,7 +1104,7 @@ export class Bot extends deviceBase {
Service: accessory.getService(this.hap.Service.Fan) as Service,
};
accessory.context.Fan = this.Fan as object;
this.warnLog('Removing any leftover Fan Service');
await this.debugWarnLog('Removing any leftover Fan Service');
accessory.removeService(this.Fan.Service);
}

Expand All @@ -1116,7 +1116,7 @@ export class Bot extends deviceBase {
Service: accessory.getService(this.hap.Service.Window) as Service,
};
accessory.context.Window = this.Window as object;
await this.warnLog('Removing any leftover Window Service');
await this.debugWarnLog('Removing any leftover Window Service');
accessory.removeService(this.Window.Service);
}

Expand All @@ -1128,7 +1128,7 @@ export class Bot extends deviceBase {
Service: accessory.getService(this.hap.Service.WindowCovering) as Service,
};
accessory.context.WindowCovering = this.WindowCovering as object;
await this.warnLog('Removing any leftover Window Covering Service');
await this.debugWarnLog('Removing any leftover Window Covering Service');
accessory.removeService(this.WindowCovering.Service);
}

Expand All @@ -1140,7 +1140,7 @@ export class Bot extends deviceBase {
Service: accessory.getService(this.hap.Service.StatefulProgrammableSwitch) as Service,
};
accessory.context.StatefulProgrammableSwitch = this.StatefulProgrammableSwitch as object;
await this.warnLog('Removing any leftover Stateful Programmable Switch Service');
await this.debugWarnLog('Removing any leftover Stateful Programmable Switch Service');
accessory.removeService(this.StatefulProgrammableSwitch.Service);
}

Expand All @@ -1152,7 +1152,7 @@ export class Bot extends deviceBase {
Service: accessory.getService(this.hap.Service.Switch) as Service,
};
accessory.context.Switch = this.Switch as object;
await this.warnLog('Removing any leftover Switch Service');
await this.debugWarnLog('Removing any leftover Switch Service');
accessory.removeService(this.Switch.Service);
}

Expand Down
12 changes: 6 additions & 6 deletions src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2938,13 +2938,13 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {

/**
* Validate and clean a string value for a Name Characteristic.
* @param displayName
* @param name
* @param value
* @returns string value
*/
* @param displayName - The display name of the accessory.
* @param name - The name of the characteristic.
* @param value - The value to be validated and cleaned.
* @returns The cleaned string value.
*/
async validateAndCleanDisplayName(displayName: string, name: string, value: string): Promise<string> {
if (this.config.options?.allowInvalidCharacter) {
if (this.config.options?.allowInvalidCharacters) {
return value;
} else {
const validPattern = new RegExp(/^[\p{L}\p{N}][\p{L}\p{N} ']*[\p{L}\p{N}]$/u);
Expand Down
Loading

0 comments on commit 6c81b2a

Please sign in to comment.