Skip to content

Commit

Permalink
Update platform.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Sinclair81 committed Nov 19, 2023
1 parent 20cc55a commit eb30ecf
Showing 1 changed file with 34 additions and 30 deletions.
64 changes: 34 additions & 30 deletions src/platform.ts
Expand Up @@ -20,7 +20,7 @@ import { Queue, QueueSendItem, QueueReceiveItem } from "./queue";

import { ErrorNumber } from "./error";
import { LoggerType, LoggerInterval } from "./logger";
import { LogoType, LogoInterface, LogoDefault } from "./logo";
import { LogoType, LogoInterface, LogoDefault, Accessory, Sensor } from "./logo";

import { SwitchPlatformAccessory } from './accessories/switchPlatformAccessory';
import { LightbulbPlatformAccessory } from './accessories/lightbulbPlatformAccessory';
Expand Down Expand Up @@ -129,114 +129,114 @@ export class LogoHomebridgePlatform implements StaticPlatformPlugin {
}

switch (device.type) {
case "switch":
case Accessory.Switch:
if (!(device.parentAccessory)){
this.accessoriesArray.push( new SwitchPlatformAccessory(this.api, this, device) );
}
this.queueMinSize += 1;
break;

case "lightbulb":
case Accessory.Lightbulb:
this.accessoriesArray.push( new LightbulbPlatformAccessory(this.api, this, device) );
this.queueMinSize += 2;
break;

case "blind":
case Accessory.Blind:
this.accessoriesArray.push( new BlindPlatformAccessory(this.api, this, device) );
this.queueMinSize += 3;
break;

case "window":
case Accessory.Window:
this.accessoriesArray.push( new WindowPlatformAccessory(this.api, this, device) );
this.queueMinSize += 3;
break;

case "garagedoor":
case Accessory.Garagedoor:
this.accessoriesArray.push( new GaragedoorPlatformAccessory(this.api, this, device) );
this.queueMinSize += 3;
break;

case "thermostat":
case Accessory.Thermostat:
this.accessoriesArray.push( new ThermostatPlatformAccessory(this.api, this, device) );
this.queueMinSize += 4;
break;

case "irrigationSystem":
case Accessory.IrrigationSystem:
this.accessoriesArray.push( new IrrigationSystemPlatformAccessory(this.api, this, device) );
this.queueMinSize += 5;
break;

case "valve":
case Accessory.Valve:
if (!(device.valveParentIrrigationSystem)){
this.accessoriesArray.push( new ValvePlatformAccessory(this.api, this, device) );
}
this.queueMinSize += 5;
break;

case "fan":
case Accessory.Fan:
this.accessoriesArray.push( new FanPlatformAccessory(this.api, this, device) );
this.queueMinSize += 3;
break;

case "filterMaintenance":
case Accessory.FilterMaintenance:
this.accessoriesArray.push( new FilterMaintenancePlatformAccessory(this.api, this, device) );
this.queueMinSize += 2;
break;

case "lightSensor":
case Accessory.Outlet:
this.accessoriesArray.push( new OutletPlatformAccessory(this.api, this, device) );
this.queueMinSize += 1;
break;

case Accessory.Other:
this.accessoriesArray.push( new OtherPlatformAccessory(this.api, this, device) );
this.queueMinSize += 1;
break;

case Sensor.Light:
this.accessoriesArray.push( new LightSensorPlatformAccessory(this.api, this, device) );
this.queueMinSize += 1;
break;

case "motionSensor":
case Sensor.Motion:
this.accessoriesArray.push( new MotionSensorPlatformAccessory(this.api, this, device) );
this.queueMinSize += 1;
break;

case "contactSensor":
case Sensor.Contact:
this.accessoriesArray.push( new ContactSensorPlatformAccessory(this.api, this, device) );
this.queueMinSize += 1;
break;

case "smokeSensor":
case Sensor.Smoke:
this.accessoriesArray.push( new SmokeSensorPlatformAccessory(this.api, this, device) );
this.queueMinSize += 1;
break;

case "temperatureSensor":
case Sensor.Temperature:
this.accessoriesArray.push( new TemperatureSensorPlatformAccessory(this.api, this, device) );
this.queueMinSize += 1;
break;

case "humiditySensor":
case Sensor.Humidity:
this.accessoriesArray.push( new HumiditySensorPlatformAccessory(this.api, this, device) );
this.queueMinSize += 1;
break;

case "carbonDioxideSensor":
case Sensor.CarbonDioxide:
this.accessoriesArray.push( new CarbonDioxideSensorPlatformAccessory(this.api, this, device) );
this.queueMinSize += 3;
break;

case "airQualitySensor":
case Sensor.AirQuality:
this.accessoriesArray.push( new AirQualitySensorPlatformAccessory(this.api, this, device) );
this.queueMinSize += 1;
break;

case "leakSensor":
case Sensor.Leak:
this.accessoriesArray.push( new LeakSensorPlatformAccessory(this.api, this, device) );
this.queueMinSize += 2;
break;

case "outlet":
this.accessoriesArray.push( new OutletPlatformAccessory(this.api, this, device) );
this.queueMinSize += 1;
break;

case "other":
this.accessoriesArray.push( new OtherPlatformAccessory(this.api, this, device) );
this.queueMinSize += 1;
break;

default:
this.accessoriesArray.push( new SwitchPlatformAccessory(this.api, this, device) );
Expand Down Expand Up @@ -293,6 +293,10 @@ export class LogoHomebridgePlatform implements StaticPlatformPlugin {

}

getAccessoryOrSensorByType(type: string) {

}

isAnalogLogoAddress(addr: string): boolean {
return this.logo.isAnalogLogoAddress(addr);
}
Expand Down

0 comments on commit eb30ecf

Please sign in to comment.