minor restructuring

This commit is contained in:
Luis Riegger 2021-05-10 09:53:47 +02:00
parent 969f843662
commit 0d54f15382
5 changed files with 10 additions and 6 deletions

View File

@ -55,7 +55,7 @@
"type": "string", "type": "string",
"enum": [ "enum": [
"clean", "clean",
"cleanThe", "cleanZone",
"cleanSpot", "cleanSpot",
"goToDock", "goToDock",
"dockState", "dockState",
@ -84,7 +84,7 @@
}, },
"default": [ "default": [
"clean", "clean",
"cleanThe", "cleanZone",
"goToDock", "goToDock",
"dockState", "dockState",
"binFull", "binFull",

View File

@ -131,11 +131,11 @@ export class KoboldVacuumRobotAccessory
setCharacteristicHandler: this.setGoToDock setCharacteristicHandler: this.setGoToDock
}]); }]);
this.dockStateService = this.registerService(RobotService.DOCKED, this.platform.Service.OccupancySensor, [{ this.dockStateService = this.registerService(RobotService.DOCKED, this.platform.Service.OccupancySensor, [{
characteristic: this.platform.Characteristic.OccupancyDetected, characteristic: this.platform.Characteristic.OccupancyDetected.OccupancyDetected,
getCharacteristicHandler: this.getDocked, getCharacteristicHandler: this.getDocked,
}]); }]);
this.binFullService = this.registerService(RobotService.BIN_FULL, this.platform.Service.OccupancySensor, [{ this.binFullService = this.registerService(RobotService.BIN_FULL, this.platform.Service.OccupancySensor, [{
characteristic: this.platform.Characteristic.OccupancyDetected, characteristic: this.platform.Characteristic.OccupancyDetected.OccupancyDetected,
getCharacteristicHandler: this.getBinFull, getCharacteristicHandler: this.getBinFull,
}]); }]);
this.findMeService = this.registerService(RobotService.FIND_ME, this.platform.Service.Switch, [{ this.findMeService = this.registerService(RobotService.FIND_ME, this.platform.Service.Switch, [{
@ -240,7 +240,7 @@ export class KoboldVacuumRobotAccessory
service = this.accessory.addService(serviceType, displayName, serviceName); service = this.accessory.addService(serviceType, displayName, serviceName);
} }
characteristicHandlers.forEach(ch => { characteristicHandlers.forEach(ch => {
const char = service.getCharacteristic(ch.characteristic) var char = service.getCharacteristic(ch.characteristic)
if (ch.getCharacteristicHandler) {char.onGet(ch.getCharacteristicHandler)} if (ch.getCharacteristicHandler) {char.onGet(ch.getCharacteristicHandler)}
if (ch.setCharacteristicHandler) {char.onSet(ch.setCharacteristicHandler)} if (ch.setCharacteristicHandler) {char.onSet(ch.setCharacteristicHandler)}
}); });

View File

@ -40,7 +40,6 @@ export class HomebridgeKoboldPlatform implements DynamicPlatformPlugin
discoverRobots() discoverRobots()
{ {
const client = new KoboldApi.Client(); const client = new KoboldApi.Client();
this.log.debug("blub");
try try
{ {
@ -126,6 +125,7 @@ export class HomebridgeKoboldPlatform implements DynamicPlatformPlugin
try try
{ {
robot.meta = state.meta; robot.meta = state.meta;
robot.availableServices = state.availableServices;
// Update existing robot accessor // Update existing robot accessor
if (cachedRobot) if (cachedRobot)

View File

@ -7,6 +7,7 @@ export enum availableLocales {
const localizationDicts = { const localizationDicts = {
'en': { 'en': {
"clean": "Clean", "clean": "Clean",
"cleanZone": "Clean Zone",
"cleanThe": "Clean the", "cleanThe": "Clean the",
"goToDock": "Go to Dock", "goToDock": "Go to Dock",
"dockState": "Docked", "dockState": "Docked",
@ -21,6 +22,7 @@ const localizationDicts = {
}, },
'de': { 'de': {
"clean": "Sauge", "clean": "Sauge",
"cleanZone": "Sauge Zone",
"cleanThe": "Sauge", "cleanThe": "Sauge",
"goToDock": "Zur Basis", "goToDock": "Zur Basis",
"dockState": "In der Basis", "dockState": "In der Basis",
@ -35,6 +37,7 @@ const localizationDicts = {
}, },
'fr': { 'fr': {
"clean": "Aspirer", "clean": "Aspirer",
"cleanZone": "Aspirer Zone",
"cleanThe": "Aspirer", "cleanThe": "Aspirer",
"goToDock": "Retour à la base", "goToDock": "Retour à la base",
"dockState": "Sur la base", "dockState": "Sur la base",

View File

@ -6,6 +6,7 @@ export enum CleanType {
export enum RobotService { export enum RobotService {
CLEAN = "clean", CLEAN = "clean",
CLEAN_SPOT = "cleanSpot", CLEAN_SPOT = "cleanSpot",
CLEAN_ZONE = "cleanZone",
GO_TO_DOCK = "goToDock", GO_TO_DOCK = "goToDock",
DOCKED = "dockState", DOCKED = "dockState",
BIN_FULL = "binFull", BIN_FULL = "binFull",