Skip to content

Commit

Permalink
Update logo.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Sinclair81 committed Nov 19, 2023
1 parent ae9e261 commit 20cc55a
Showing 1 changed file with 166 additions and 0 deletions.
166 changes: 166 additions & 0 deletions src/logo.ts
@@ -1,3 +1,28 @@
import { AccessoryPlugin, API, StaticPlatformPlugin } from 'homebridge';

import { SwitchPlatformAccessory } from './accessories/switchPlatformAccessory';
import { LightbulbPlatformAccessory } from './accessories/lightbulbPlatformAccessory';
import { BlindPlatformAccessory } from './accessories/blindPlatformAccessory';
import { WindowPlatformAccessory } from './accessories/windowPlatformAccessory';
import { GaragedoorPlatformAccessory } from './accessories/garagedoorPlatformAccessory';
import { ThermostatPlatformAccessory } from './accessories/thermostatPlatformAccessory';
import { IrrigationSystemPlatformAccessory } from './accessories/irrigationSystemPlatformAccessory';
import { ValvePlatformAccessory } from './accessories/valvePlatformAccessory';
import { FanPlatformAccessory } from './accessories/fanPlatformAccessory';
import { FilterMaintenancePlatformAccessory } from './accessories/filterMaintenancePlatformAccessory';
import { OutletPlatformAccessory } from './accessories/outletPlatformAccessory';
import { OtherPlatformAccessory } from './accessories/otherPlatformAccessory';

import { LightSensorPlatformAccessory } from './sensors/lightSensorPlatformAccessory';
import { MotionSensorPlatformAccessory } from './sensors/motionSensorPlatformAccessory';
import { ContactSensorPlatformAccessory } from './sensors/contactSensorPlatformAccessory';
import { SmokeSensorPlatformAccessory } from './sensors/smokeSensorPlatformAccessory';
import { TemperatureSensorPlatformAccessory } from './sensors/temperatureSensorPlatformAccessory';
import { HumiditySensorPlatformAccessory } from './sensors/humiditySensorPlatformAccessory';
import { CarbonDioxideSensorPlatformAccessory } from './sensors/carbonDioxideSensorPlatformAccessory';
import { AirQualitySensorPlatformAccessory } from './sensors/airQualitySensorPlatformAccessory';
import { LeakSensorPlatformAccessory } from './sensors/leakSensorPlatformAccessory';

export class LogoType {
static T_0BA7: string = "0BA7";
static T_0BA8: string = "0BA8";
Expand All @@ -18,4 +43,145 @@ export class LogoDefault {
static QueueInterval: number = 100;
static QueueSize: number = 100;
static QueueMinSize: number = 0;
}

export class Accessory {
static Switch: string = "switch";
static Lightbulb: string = "lightbulb";
static Blind: string = "blind";
static Window: string = "window";
static Garagedoor: string = "garagedoor";
static Thermostat: string = "thermostat";
static IrrigationSystem: string = "irrigationSystem";
static Valve: string = "valve";
static Fan: string = "fan";
static FilterMaintenance: string = "filterMaintenance";
static Outlet: string = "outlet";
static Other: string = "other";
}

export class Sensor {
static Light: string = "lightSensor";
static Motion: string = "motionSensor";
static Contact: string = "contactSensor";
static Smoke: string = "smokeSensor";
static Temperature: string = "temperatureSensor";
static Humidity: string = "humiditySensor";
static CarbonDioxide: string = "carbonDioxideSensor";
static AirQuality: string = "airQualitySensor";
static Leak: string = "leakSensor";
}

export class SubAccessory {

api: API;
platform: StaticPlatformPlugin;

constructor (api: API, platform: StaticPlatformPlugin) {

this.api = api;
this.platform = platform;

}

getNewAccessory(device:any, parent: any): SwitchPlatformAccessory | LightbulbPlatformAccessory | BlindPlatformAccessory |
WindowPlatformAccessory | GaragedoorPlatformAccessory | ThermostatPlatformAccessory |
IrrigationSystemPlatformAccessory | ValvePlatformAccessory | FanPlatformAccessory |
FilterMaintenancePlatformAccessory | OutletPlatformAccessory | OtherPlatformAccessory |
LightSensorPlatformAccessory | MotionSensorPlatformAccessory | ContactSensorPlatformAccessory |
SmokeSensorPlatformAccessory | TemperatureSensorPlatformAccessory | HumiditySensorPlatformAccessory |
CarbonDioxideSensorPlatformAccessory | AirQualitySensorPlatformAccessory | LeakSensorPlatformAccessory |
AccessoryPlugin | undefined {

switch (device.type) {
case Accessory.Switch:
return new SwitchPlatformAccessory(this.api, this.platform, device, parent);
break;

case Accessory.Lightbulb:
return new LightbulbPlatformAccessory(this.api, this.platform, device);
break;

case Accessory.Blind:
return new BlindPlatformAccessory(this.api, this.platform, device);
break;

case Accessory.Window:
return new WindowPlatformAccessory(this.api, this.platform, device);
break;

case Accessory.Garagedoor:
return new GaragedoorPlatformAccessory(this.api, this.platform, device);
break;

case Accessory.Thermostat:
return new ThermostatPlatformAccessory(this.api, this.platform, device);
break;

case Accessory.IrrigationSystem:
return new IrrigationSystemPlatformAccessory(this.api, this.platform, device);
break;

case Accessory.Valve:
if (!(device.valveParentIrrigationSystem)){
return new ValvePlatformAccessory(this.api, this.platform, device, parent);
}
break;

case Accessory.Fan:
return new FanPlatformAccessory(this.api, this.platform, device);
break;

case Accessory.FilterMaintenance:
return new FilterMaintenancePlatformAccessory(this.api, this.platform, device);
break;

case Accessory.Outlet:
return new OutletPlatformAccessory(this.api, this.platform, device);
break;

case Accessory.Other:
return new OtherPlatformAccessory(this.api, this.platform, device);
break;

case Sensor.Light:
return new LightSensorPlatformAccessory(this.api, this.platform, device);
break;

case Sensor.Motion:
return new MotionSensorPlatformAccessory(this.api, this.platform, device);
break;

case Sensor.Contact:
return new ContactSensorPlatformAccessory(this.api, this.platform, device);
break;

case Sensor.Smoke:
return new SmokeSensorPlatformAccessory(this.api, this.platform, device);
break;

case Sensor.Temperature:
return new TemperatureSensorPlatformAccessory(this.api, this.platform, device);
break;

case Sensor.Humidity:
return new HumiditySensorPlatformAccessory(this.api, this.platform, device);
break;

case Sensor.CarbonDioxide:
return new CarbonDioxideSensorPlatformAccessory(this.api, this.platform, device);
break;

case Sensor.AirQuality:
return new AirQualitySensorPlatformAccessory(this.api, this.platform, device);
break;

case Sensor.Leak:
return new LeakSensorPlatformAccessory(this.api, this.platform, device);
break;

}

}

}

0 comments on commit 20cc55a

Please sign in to comment.