@ronniepettersson/homebridge-dummy
Version:
Create Homebridge accessories to help with automation and control — scheduling, delays, sensors, commands, webhooks, and more
37 lines • 2.13 kB
JavaScript
import { BlindAccessory } from './position/blind.js';
import { DoorAccessory } from './position/door.js';
import { GarageDoorAccessory } from './position/garage.js';
import { LightbulbAccessory } from './onoff/lightbulb.js';
import { LockAccessory } from './lock.js';
import { OutletAccessory } from './onoff/outlet.js';
import { SwitchAccessory } from './onoff/switch.js';
import { ThermostatAccessory } from './thermostat.js';
import { WindowAccessory } from './position/window.js';
import { strings } from '../i18n/i18n.js';
import { AccessoryType } from '../model/enums.js';
export function createDummyAccessory(Service, Characteristic, accessory, config, log, isGrouped = false) {
switch (config.type) {
case AccessoryType.Door:
return new DoorAccessory(Service, Characteristic, accessory, config, log, isGrouped);
case AccessoryType.GarageDoorOpener:
return new GarageDoorAccessory(Service, Characteristic, accessory, config, log, isGrouped);
case AccessoryType.Lightbulb:
return new LightbulbAccessory(Service, Characteristic, accessory, config, log, isGrouped);
case AccessoryType.LockMechanism:
return new LockAccessory(Service, Characteristic, accessory, config, log, isGrouped);
case AccessoryType.Outlet:
return new OutletAccessory(Service, Characteristic, accessory, config, log, isGrouped);
case AccessoryType.Switch:
return new SwitchAccessory(Service, Characteristic, accessory, config, log, isGrouped);
case AccessoryType.Thermostat:
return new ThermostatAccessory(Service, Characteristic, accessory, config, log, isGrouped);
case AccessoryType.Window:
return new WindowAccessory(Service, Characteristic, accessory, config, log, isGrouped);
case AccessoryType.WindowCovering:
return new BlindAccessory(Service, Characteristic, accessory, config, log, isGrouped);
default:
log.error(strings.startup.unsupportedType, `'${config.type}'`);
return null;
}
}
//# sourceMappingURL=helpers.js.map